A file system is the way in which files are named, stored, retrieved as well as updated on a storage disk or partition; the way files are organized on the disk.

A file system is divided in two segments called: User Data and Metadata (file name, time it was created, modified time, it’s size and location in the directory hierarchy etc).

In this guide, we will explain seven ways to identify your Linux file system type such as Ext2, Ext3, Ext4, BtrFS, GlusterFS plus many more.

1. Using df Command

df command reports file system disk space usage, to include the file system type on a particular disk partition, use the -T flag as below:

$ df -Th
$ df -Th | grep "^/dev"
emre@server:~$ sudo su
root@server:/home/emre# df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
udev           devtmpfs  1.8G     0  1.8G   0% /dev
tmpfs          tmpfs     370M  5.2M  365M   2% /run
/dev/sda1      ext4      9.7G  1.2G  8.5G  13% /
tmpfs          tmpfs     1.9G     0  1.9G   0% /dev/shm
tmpfs          tmpfs     5.0M     0  5.0M   0% /run/lock
tmpfs          tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs          tmpfs     370M     0  370M   0% /run/user/100

2. Using fsck Command

fsck is used to check and optionally repair Linux file systems, it can also print the file system type on specified disk partitions.

The flag -N disables checking of file system for errors, it just shows what would be done (but all we need is the file system type):

$ fsck -N /dev/sda1
root@server:/home/emre# fsck -N /dev/sda1
fsck from util-linux 2.27.1
[/sbin/fsck.ext4 (1) -- /] fsck.ext4 /dev/sda1

3. Using lsblk Command

lsblk displays block devices, when used with the -f option, it prints file system type on partitions as well:

$ lsblk -f
root@server:/home/emre# lsblk -f
NAME   FSTYPE LABEL           UUID                                 MOUNTPOINT
└─sda1 ext4   cloudimg-rootfs 0f37190f-0081-4ed3-bdb5-d2741eb5a51c /

4. Using mount Command

mount command is used to mount a file system in Linux, it can also be used to mount an ISO image, mount remote Linux filesystem and so much more.

When run without any arguments, it prints info about disk partitions including the file system type as below:

$ mount | grep "^/dev"
root@server:/home/emre# mount | grep "^/dev"
/dev/sda1 on / type ext4 (rw,relatime,data=ordered)

5. Using blkid Command

blkid command is used to find or print block device properties, simply specify the disk partition as an argument like so:

$ blkid /dev/sda1
root@server:/home/mazhochist# blkid /dev/sda1
/dev/sda1: LABEL="cloudimg-rootfs" UUID="0f37190f-0081-4ed3-bdb5-d2741eb5a51c" TYPE="ext4" PARTUUID="8e6c680b-01"

6. Using file Command

file command identifies file type, the -s flag enables reading of block or character files and -L enables following of symlinks:

$ sudo file -sL /dev/sda1
root@server:/home/emre# file -sL /dev/sda1
/dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=0f37190f-0081-4ed3-bdb5-d2741eb5a51c, volume name "cloudimg-rootfs" (needs journal recovery) (extents) (large files) (huge files)

7. Using fstab File

The /etc/fstab is a static file system info (such as mount point, file system type, mount options etc) file:

$ cat /etc/fstab
root@server:/home/mazhochist# cat /etc/fstab
LABEL=cloudimg-rootfs   /        ext4   defaults        0 0


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.