Operating System - Linux
1753946 Members
7444 Online
108811 Solutions
New Discussion юеВ

Re: how to get the filesystem of unmounted partition

 
iinfi1
Super Advisor

how to get the filesystem of unmounted partition

I have a partition in our production server
/dev/sdb1 and the partition is not mounted.
i do not know whether there is data in it or whether it is empty or formatted (ext3 or OCFS). is it possible to find out the filesystem in it while it is umounted so that i can mount it using the correct parameters?
5 REPLIES 5
Matti_Kurkela
Honored Contributor

Re: how to get the filesystem of unmounted partition

If you try to mount the filesystem using a wrong filesystem type, the mount operation will simply fail, causing no harm.

If you omit the filesystem type option from the mount command, or specify the type "auto", the mount command will attempt to determine the correct type automatically.

Example:
mount /dev/sdb1 /mnt
or
mount -t auto /dev/sdb1 /mnt


First it uses the blkid or volume_id library to try and determine the correct type; if that produces no results, it will attempt to use all filesystem types listed in /etc/filesystems in turn. If that file does not exist, the mount command will try all filesystems listed in /proc/filesystems (i.e. all filesystem types known by the kernel and currently-loaded modules).

If the auto-detection is successful, the filesystem will be mounted and you can run the "mount" command without arguments to see the detected filesystem type.

MK
MK
iinfi1
Super Advisor

Re: how to get the filesystem of unmounted partition

if it turns out to be ocfs partition,
do i do a

mount -t ocfs2 /dev/sdi1 /data4

on both nodes?
Matti_Kurkela
Honored Contributor

Re: how to get the filesystem of unmounted partition

If the test mount is successful and indicates the filesystem type is OCFS, unmount the test mount, then follow the OCFS documentation.

http://oss.oracle.com/projects/ocfs2/

http://oss.oracle.com/projects/ocfs2/dist/documentation/v1.2/ocfs2_users_guide.pdf

http://oss.oracle.com/projects/ocfs2/dist/documentation/v1.2/ocfs2_faq.html

Before mounting the OCFS (or any other cluster filesystem) on multiple nodes, the necessary cluster lock services must be running. Single-node mounting _may_ be possible without the lock services.

(I don't have experience with OCFS2.)

MK
MK
Mike Stroyan
Honored Contributor

Re: how to get the filesystem of unmounted partition

The command 'magic /dev/sdb1' will examine the contents of the partition and try to determine what type of 'file' it is. The magic command is mostly focused on identifying files. The data that magic has on file formats also includes many file system formats. But you may have a file system that is not recognized. It is possible to add more patterns by supplementing with local data files.
iinfi1
Super Advisor

Re: how to get the filesystem of unmounted partition

thank you all
sorry for not replying earlier ...
i was able to mount the partition on one node
using
mount /dev/sdi1 /mnt
further
mount command showed me its a formatted with ocfs and contains data.
thanks again

i have not tried the magic command till now.
will try it soon