13 Methods to Find the File System Type on Linux (Ext3, Ext4 or XFS)

In Linux, everything is configured as a file.

This includes not only text files, images, compiled programs, directories, partitions and hardware device drivers, etc,.

Each file system has two control modules, one containing the file system information and the other containing the inode information.

The inode (Metadata) contain information about individual files and directory (File name, File types, Permission, Owner name, Group name, Size, Time stamps, Deletion time, hard link and soft link, location, etc.,.)

The inode number is also called the index number, which contains the above parameters.

Go to the following article if you want to count inode usage on Linux.

Linux supports multiple file system types such as ext, ext2, ext3, ext4, hpfs, iso9660, JFS, minix, msdos, ncpfs nfs, ntfs, proc, Reiserfs, smb, sysv, umsdos, vfat, XFS, xiafs,.

Why did we write this article?

About a week ago, we successfully added a new hard drive into our client server. They recommended using an existing file system type when formatting a new disk.

To do so, we must specify the type of file system already used on the system.

I tried some of the commands I already know to get details about file system types. However, we decided to make it an article to help others find file system types easier.

I did a little Google search before posting this article to add an extra method I don’t know. In this article, we will show you nine ways to get the file system type in Linux.

Method-1: How to Determine the File System Type on Linux Using the df Command

df command stands for Disk Filesystem that provides disk space usage information of your file systems. Use the -T option with the df command to get the file system type.

# df -khT
Filesystem     Type   Size  Used Avail Use% Mounted on
/dev/sda3      ext4    99G   22G   73G  23% /
tmpfs          tmpfs  1.9G     0  1.9G   0% /dev/shm
/dev/sda1      ext4   477M  128M  325M  29% /boot
/dev/sda2      ext4   295G  166G  115G  60% /home
/usr/tmpDSK    ext3   3.6G   73M  3.4G   3% /tmp

Method-2: How to Find the File System Type on Linux Using the mount Command

The mount command is used to load a storage device or file system on a Linux system. Also, it makes them accessible and attaching into the existing directory structure.

# mount | grep "/dev"
/dev/sda3 on / type ext4 (rw,usrjquota=quota.user,jqfmt=vfsv0)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
/dev/sda2 on /home type ext4 (rw,usrjquota=quota.user,jqfmt=vfsv0)
/usr/tmpDSK on /tmp type ext3 (rw,noexec,nosuid,loop=/dev/loop0)

Method-3: How to Identify the File System Type Using the “/etc/fstab” file

Just print the contents of the /etc/fstab file in the terminal to identify your file system type on Linux. It contains mount point name, file system type, mount options and so on. Go to the following article if you want to understand /etc/fstab file.

# cat /etc/fstab

UUID=24263d9b-96f1-4b4c-a4b1-e84a91af31d1       /       ext4    usrjquota=quota.user,jqfmt=vfsv0        1       1
UUID=f21edf29-e9d2-45d0-a1bf-f7c0a6d6deab /boot                   ext4    defaults        1 2
UUID=7e87d2bd-af20-482f-a935-bebc5ef09dad       /home   ext4    usrjquota=quota.user,jqfmt=vfsv0        1       2
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
UUID=e9ac2ab4-56f2-48ad-a7aa-2aca8bd35c0a  none  swap  sw 0  0
/usr/tmpDSK             /tmp                    ext3    defaults,noauto        0 0

Method-4: How to Find the File System Type on Linux Using the fsck Command

The fsck command is used to check and optionally repair one or more Linux files ystems. Use the -N option with fsck to print file system type information instead of filesystem check (Don’t execute and just show output).

# fsck -N /dev/sda1
fsck from util-linux-ng 2.17.2
[/sbin/fsck.ext4 (1) -- /boot] fsck.ext4 /dev/sda1

# fsck -N /dev/sda2
fsck from util-linux-ng 2.17.2
[/sbin/fsck.ext4 (1) -- /home] fsck.ext4 /dev/sda2

# fsck -N /dev/sda3
fsck from util-linux-ng 2.17.2
[/sbin/fsck.ext4 (1) -- /] fsck.ext4 /dev/sda3

Method-5: How to Determine the File System Type on Linux Using the file Command

The file command is used to determine the file type. Use the -s option with the file command to print the given disk file system type.

# file -sL /dev/sda1
/dev/sda1: Linux rev 1.0 ext4 filesystem data (needs journal recovery) (extents) (huge files)

# file -sL /dev/sda2
/dev/sda2: Linux rev 1.0 ext4 filesystem data (needs journal recovery) (extents) (large files) (huge files)

# file -sL /dev/sda3
/dev/sda3: Linux rev 1.0 ext4 filesystem data (needs journal recovery) (extents) (large files) (huge files)

Method-6: How to Check the File System Type on Linux Using the parted Command

The parted command is a program to manipulate disk partitions. It supports multiple partition table formats, including MS-DOS and GPT. Use -l option to lists partition layout on all block devices.

It allows user to create, delete, resize, shrink, move and copy partitions, reorganizing disk usage, and copying data to new hard disks. GParted is a GUI frontend of parted.

# parted -l
Model: Msft Virtual Disk (scsi)
Disk /dev/sda: 429GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  525MB  524MB  primary  ext4         boot
 2      525MB   322GB  321GB  primary  ext4
 3      322GB   429GB  107GB  primary  ext4

Method-7: How to Find the File System Type on Linux Using the lsblk Command

The lsblk command lists information about all available or the specified block devices. The lsblk command reads the sysfs filesystem and udev db to gather information.

# lsblk -f
NAME   FSTYPE LABEL UUID                                 MOUNTPOINT
loop0  ext3         2a681ef6-4566-4205-9446-4e56c53272e8 /tmp
sda
├─sda1 ext4         f21edf29-e9d2-45d0-a1bf-f7c0a6d6deab /boot
├─sda2 ext4         7e87d2bd-af20-482f-a935-bebc5ef09dad /home
└─sda3 ext4         24263d9b-96f1-4b4c-a4b1-e84a91af31d1 /
sr0

Method-8: How to Determine the File System Type on Linux Using the blkid Command

The blkid program is the command-line interface that locate/print block device information (e.g. filesystem or swap).

# blkid /dev/sda1
/dev/sda1: UUID="f21edf29-e9d2-45d0-a1bf-f7c0a6d6deab" TYPE="ext4"

# blkid /dev/sda2
/dev/sda2: UUID="7e87d2bd-af20-482f-a935-bebc5ef09dad" TYPE="ext4"

# blkid /dev/sda3
/dev/sda3: UUID="24263d9b-96f1-4b4c-a4b1-e84a91af31d1" TYPE="ext4"

Method-9: How to Identify the File System Type on Linux Using the cfdisk Command

The cfdisk comamnd is a curses-based program for partitioning any block device. It display or manipulate a disk partition table information.

# cfdisk 
                                 Disk: /dev/sda
               Size: 40 GiB, 42949672960 bytes, 83886080 sectors
                       Label: dos, identifier: 0x6ad96b19

    Device       Boot      Start       End  Sectors Size Id Type
>>  /dev/sda1    *          2048  79691775 79689728  38G 83 Linux               
    /dev/sda2           79693822  83884031  4190210   2G  5 Extended
    └─/dev/sda5         79693824  83884031  4190208   2G 82 Linux swap / Solaris





 ┌────────────────────────────────────────────────────────────────────────────┐
 │ Partition type: Linux (83)                                                 │
 │     Attributes: 80                                                         │
 │     Filesystem: ext4                                                       │
 │Filesystem UUID: a0ee5533-e698-4359-9ddf-9ccf8679b5ec                       │
 │     Mountpoint: / (mounted)                                                │
 └────────────────────────────────────────────────────────────────────────────┘
     [Bootable]  [ Delete ]  [  Quit  ]  [  Type  ]  [  Help  ]  [  Write ]
     [  Dump  ]

                  Quit program without writing partition table

Method-10: How to Find the File System Type on Linux Using the udevadm Command

udevadm expects a command and command specific options. It controls the runtime behavior of systemd-udevd, requests kernel events, manages the event queue, and provides simple debugging mechanisms.

# udevadm info -q all -n /dev/sda1 | grep -i FS_TYPE | cut -d "=" -f2
ext4

Method-11: How to Determine the File System Type on Linux Using the inxi Command

inxi command is a nifty tool for verifying hardware information on Linux, and provides a wide range of options to check all hardware information on a Linux system.

# inxi -p
Partition: ID-1: / size: 25.97 GiB used: 5.14 GiB (19.8%) fs: ext4 dev: /dev/dm-0 
           ID-2: /boot size: 476.2 MiB used: 40.7 MiB (8.5%) fs: ext4 dev: /dev/sda1 
           ID-3: swap-1 size: 3.00 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/dm-1 

Method-12: How to Identify the File System Type on Linux Using the /etc/mtab file

The mount and umount commands maintain a list of currently mounted filesystems in the file /etc/mtab.

# cat /etc/mtab | grep "/dev"
/dev/mapper/vg_2daygeek-lv_root / ext4 rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs rw,rootcontext="system_u:object_r:tmpfs_t:s0" 0 0
/dev/sda1 /boot ext4 rw 0 0

Method-13: How to Identify the File System Type on Linux Using the /proc/mounts file

The proc filesystem (procfs) is a special filesystem in Unix-like operating systems that presents information about processes and other system information.

# cat /proc/mounts | grep "/dev"
devtmpfs /dev devtmpfs rw,seclabel,relatime,size=947256k,nr_inodes=236814,mode=755 0 0
devpts /dev/pts devpts rw,seclabel,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /dev/shm tmpfs rw,seclabel,relatime 0 0
/dev/mapper/vg_2daygeek-lv_root / ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0
devtmpfs /dev devtmpfs rw,seclabel,relatime,size=947256k,nr_inodes=236814,mode=755 0 0
/dev/sda1 /boot ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

One Comment on “13 Methods to Find the File System Type on Linux (Ext3, Ext4 or XFS)”

  1. you forgot tune2fs -l | grep features
    if it shows “extent” then it is ext4. if there is no “extent” but has “has_journal”, then it is ext3. if there is none then it is ext2

Leave a Reply

Your email address will not be published. Required fields are marked *