Question: How do I identify my file system type? I like to upgrade my current file system to the latest ext4. Before that I would like to know what my current file system type is for various mount points I have on my UNIX system.
Answer: Use any one of the five methods mentioned below to identify your file system type.
Method 1: Use df -T Command
The -T option in the df command displays the file system type.
# df -T | awk '{print $1,$2,$NF}' | grep "^/dev"
/dev/sda1 ext2 /
/dev/sdb1 ext3 /home
/dev/sdc1 ext3 /u01
Method 2: Use Mount Command
Use the mount command as shown below.
# mount | grep "^/dev" /dev/sda1 on / type ext2 (rw) /dev/sdb1 on /home type ext3 (rw) /dev/sdc1 on /u01 type ext3 (rw)
As shown in the above example:
- /dev/sda1 is ext2 file system type. (mounted as /)
- /dev/sdb1 is ext3 file system type. (mounted as /home)
- /dev/sdc1 is ext3 file system type. (mounted as /u01)
Method 3: Use file Command
As root, use the file command as shown below. You need to pass the individual device name to the file command.
# file -sL /dev/sda1 /dev/sda1: Linux rev 1.0 ext2 filesystem data (mounted or unclean) (large files) # file -sL /dev/sdb1 /dev/sda1: Linux rev 1.0 ext3 filesystem data (needs journal recovery)(large files) # file -sL /dev/sdc1 /dev/sda1: Linux rev 1.0 ext3 filesystem data (needs journal recovery)(large files)
Note: You should execute the file command as root user. If you execute as non-root user, you’ll still get some output. But, that will not display the file system type as shown below.
$ file -sL /dev/sda1 /dev/sda1: writable, no read permission
Method 4: View the /etc/fstab file
If a particular mount point is configured to be mounted automatically during system startup, you can identify its file system type by looking at the /etc/fstab file.
As shown in the example below, / is ext2, /home is ext3, and /u01 is ext3.
# cat /etc/fstab LABEL=/r / ext2 defaults 1 1 LABEL=/home /home ext3 defaults 0 0 LABEL=/u01 /u01 ext3 defaults 0 0
Method 5: Use fsck Command
Execute the fsck command as shown below. This will display the file system type of a given device.
# fsck -N /dev/sda1 fsck 1.39 (29-May-2006) [/sbin/fsck.ext2 (1) -- /] fsck.ext2 /dev/sda1 # fsck -N /dev/sdb1 fsck 1.39 (29-May-2006) [/sbin/fsck.ext3 (1) -- /home] fsck.ext3 /dev/sdb1 # fsck -N /dev/sdc1 fsck 1.39 (29-May-2006) [/sbin/fsck.ext3 (1) -- /u01] fsck.ext3 /dev/sdc1
If you don’t have the root access, but would like to identify your file system type, use /sbin/fsck -N as shown above.
If you enjoyed this article, you might also like..
|
|
|
|











My name is Ramesh Natarajan. I will be posting instruction guides, how-to, troubleshooting tips and tricks on Linux, database, hardware, security and web. My focus is to write articles that will either teach you or help you resolve a problem. Read more about
{ 15 comments… read them below or add one }
i thought df -khT does it all on all distributions
df -khT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vg0-root
ext3 992M 386M 556M 41% /
/dev/mapper/vg0-var
ext3 3.9G 229M 3.5G 7% /var
/dev/mapper/vg0-usr
ext3 3.9G 972M 2.8G 26% /usr
/dev/mapper/vg0-home
ext3 992M 34M 908M 4% /home
/dev/mapper/vg0-opt
ext3 7.8G 702M 6.7G 10% /opt
/dev/mapper/vg0-srv
ext3 12G 158M 11G 2% /srv
/dev/sda1 ext3 145M 19M 119M 14% /boot
tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm
none tmpfs 1.0G 12K 1.0G 1% /tmp
There is also df -T:
/dev/hda4 ext3 191048 216716 160848 12% /usr/local
/dev/sda6 reiserfs 5242716 2315728 2926988 45% /var
/dev/sdb1 xfs 3135488 1952644 1182844 63% /opt
Another useful command:
# df -T | grep /dev/sda
/dev/sda1 ext4 73744616 35400512 34598056 51% /
Go check the command “dumpe2fs”. It does give you just what you are expecting.
another way to know your file system type is by issuing the command “df -T”
Another easiest way to check as follows:
[abanerjee@test1 abanerjee]$ df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext3 1011M 661M 299M 69% /
/dev/sda1 ext3 76M 24M 48M 33% /boot
/dev/sda5 ext3 1011M 455M 505M 48% /opt
none tmpfs 503M 0 503M 0% /dev/shm
/dev/sda7 ext3 494M 19M 449M 4% /tmp
/dev/sda8 ext3 28G 2.6G 23G 10% /usr
/dev/sda6 ext3 1011M 292M 668M 31% /var
Install gParted.
I think df is quicker and has a cleaner output:
df -hT
Although I now use ‘di’ which is a improved version of ‘df’ with better display options. I use the following to display disk status on my server with long LVM names.
di -f SMBuv2T -H -st -xnone
@All,
Thanks for pointing out the “df -T” command to get the file system type. I’ve updated the article accordingly.
There’s a command ‘blkid’ which will tell You what kind of filesystem (and what UUID) is on which partition:
sudo blkid /dev/sda1
/dev/sda1: UUID=”0986d8b7-c066-d9ee-2379-27252f387269″ TYPE=”linux_raid_member”
sudo blkid /dev/md2
/dev/md2: UUID=”3eaf4b7f-f912-439c-833c-287d6e082339″ TYPE=”reiserfs”
The ‘df’ command or ‘mount’ won’t help if the filesystem you’re checking is on not mounted partition.
one more command is blkid. (sudo blkid | awk ‘{print $1 ” ” $4}’)
sulti beat me in this.
Also please tell us ways to find out the size of a block in a file system ?
To find out the file system present in a disk we can also use this following command.
sudo /lib/udev/vol_id /dev/sda1
Sample Output:
ID_FS_USAGE=filesystem
ID_FS_TYPE=ext3
ID_FS_VERSION=1.0
ID_FS_UUID=8ebcdd36-44d2-456f-9b6b-97725e12d188
ID_FS_UUID_ENC=8ebcdd36-44d2-456f-9b6b-97725e12d188
ID_FS_LABEL=/boot
ID_FS_LABEL_ENC=\x2fboot
ID_FS_LABEL_SAFE=boot
Note:Only for Persistent file system(like ext2,ext3..).Not for logical file system like procfs, tmpfs.
sathiya, for the block sizes check with fdisk