Friday, November 23, 2012

Identifying the Linux file system Type

Release:
RHEL

Problem:
This document guides you on how to identify the Linux file system type of a partition.
 

Solution:
Method 1:

Using the df command you can know the type of the file system using the “T” switch.

[root@akhisar /]# df -T

Filesystem    Type   1K-blocks      Used Available Use% Mounted on

/dev/mapper/vg_akhisar-lv_root

              ext4     6362016   3340220   2698624  56% /

tmpfs        tmpfs      345956       260    345696   1% /dev/shm

/dev/sda1     ext4      495844     31884    438360   7% /boot

/dev/sr0   iso9660     3516418   3516418         0 100% /media/RHEL_6.1 x86_64 Disc 1

/dev/sr0   iso9660     3516418   3516418         0 100% /mnt

Limitation: Only mounted partitions will be listed by this command.

 

Method 2:

You can use the mount command as root to know the file system type of your partitions:

[root@akhisar /]# mount | grep "^/dev"

/dev/mapper/vg_akhisar-lv_root on / type ext4 (rw)

/dev/sda1 on /boot type ext4 (rw)

/dev/sr0 on /media/RHEL_6.1 x86_64 Disc 1 type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=0,gid=0,iocharset=utf8,mode=0400,dmode=0500)

/dev/sr0 on /mnt type iso9660 (ro)

Limitation: Only mounted partitions will be listed by this command.

 

Method 3:

You can use the file command as root by inputting the individual device name. Illustration of the same is given below. You may get the device name for the partitions from the “fdisk –l” command output.

[root@akhisar /]# file -sL /dev/sdb2

/dev/sdb2: Linux rev 1.0 ext3 filesystem data

Method 4:

You can check for the entry in /etc/fstab file. The third field refers to the file system.

[root@akhisar /]# cat /etc/fstab

#

# /etc/fstab

# Created by anaconda on Mon Aug 13 17:02:54 2012

#

# Accessible filesystems, by reference, are maintained under '/dev/disk'

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

/dev/mapper/vg_akhisar-lv_root /                       ext4    defaults        1 1

UUID=eb572a9e-49dc-451a-94e1-6d1de54af5d6 /boot                   ext4    defaults        1 2

/dev/mapper/vg_akhisar-lv_swap swap                    swap    defaults        0 0

tmpfs                   /dev/shm                tmpfs   defaults        0 0

devpts                  /dev/pts                devpts  gid=5,mode=620  0 0

sysfs                   /sys                    sysfs   defaults        0 0

proc                    /proc                   proc    defaults        0 0

 
Limitations: It may contain only the default entries created during the installation or the one provided by the administrator. It can only be used as a quick reference on the partitions.

 
Method 5:

You can execute the fsck command with the “-N” switch followed by the individual partitions to know the partition file system type.

[root@akhisar /]# fsck -N /dev/sdb2

fsck from util-linux-ng 2.17.2

[/sbin/fsck.ext3 (1) -- /dev/sdb2] fsck.ext3 /dev/sdb2

[root@akhisar /]# fsck -N /dev/sdb1

fsck from util-linux-ng 2.17.2

[/sbin/fsck.ext2 (1) -- /dev/sdb1] fsck.ext2 /dev/sdb1

 

******************************

No comments:

Post a Comment