≡ Menu

5 Methods to Identify Your Linux File System Type (Ext2 or Ext3 or Ext4)

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.

Add your comment

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

Comments on this entry are closed.

  • ganai April 18, 2011, 2:43 am

    i thought df -khT does it all on all distributions

    df -khT
    Filesystem Type Size Used Avail Use% Mounted on
    ext3 992M 386M 556M 41% /
    ext3 3.9G 229M 3.5G 7% /var
    ext3 3.9G 972M 2.8G 26% /usr
    ext3 992M 34M 908M 4% /home
    ext3 7.8G 702M 6.7G 10% /opt
    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

  • VulcanRidr April 18, 2011, 2:50 am

    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

  • bezha April 18, 2011, 2:53 am

    Another useful command:

    # df -T | grep /dev/sda
    /dev/sda1 ext4 73744616 35400512 34598056 51% /

  • Koutheir April 18, 2011, 3:47 am

    Go check the command “dumpe2fs”. It does give you just what you are expecting.

  • Elgene April 18, 2011, 4:12 am

    another way to know your file system type is by issuing the command “df -T”

  • Arunabha Banerjee April 18, 2011, 4:32 am

    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

  • Blammo April 18, 2011, 5:47 am

    Install gParted.

  • Cas April 18, 2011, 7:25 am

    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

  • Ramesh Natarajan April 18, 2011, 8:04 am


    Thanks for pointing out the “df -T” command to get the file system type. I’ve updated the article accordingly.

  • sulti April 18, 2011, 9:12 am

    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.

  • kgas April 18, 2011, 11:41 am

    one more command is blkid. (sudo blkid | awk ‘{print $1 ” ” $4}’)

  • kgas April 18, 2011, 11:43 am

    sulti beat me in this.

  • sathiya April 19, 2011, 5:27 am

    Also please tell us ways to find out the size of a block in a file system ?

  • yuva April 20, 2011, 6:00 am

    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:

    Note:Only for Persistent file system(like ext2,ext3..).Not for logical file system like procfs, tmpfs.

  • kgas April 22, 2011, 5:39 am

    sathiya, for the block sizes check with fdisk

  • Jalal Hajigholamali May 21, 2012, 6:46 am

    New version of “df” command has some new useful options like “–total”

  • Emanuele August 4, 2012, 1:55 pm

    WARNING: The file command does NOT work for ext4 fs type, as shown below.

    $ sudo file -sL /dev/sdb1
    /dev/sdb1: Linux rev 1.0 ext2 filesystem data (mounted or unclean), UUID=e5280988-66ff-44af-9eda-caff33db6413 (large files)

    $ fsck -N /dev/sdb1
    fsck from util-linux-ng 2.17.2
    [/sbin/fsck.ext4 (1) — /mnt/sdc1] fsck.ext4 /dev/sdb1

  • Anonymous January 18, 2013, 11:22 am

    blkid will also give file system type

  • ASG January 22, 2017, 6:13 am

    Another useful command:
    You can see file system type of non-mounted partition also.

    lsblk -fs