Any Operating system in the market whether its Windows, Linux, Unix, macOS, and any other, must be able to access and manage files and data on storage devices.
How an operating system accesses and manages these files is determinant on the file system used. For example, a USB drive formatted using the basic Linux file system (ext4) is inaccessible on a Windows computer.
A lot of Linux distributions support quite a variety of file systems. They include ext, ext2, ext3, ext4, hpfs, iso9660, JFS, minix, msdos, ncpfs nfs, NTFS, proc, Reiserfs, smb, sysv, vfat, XFS, xiafs, and many more.
With Linux operating systems, every data is configured as a file, from text data, images, device drivers, and many more. Every file system is divided into two parts; User data, which contains file system information and metadata, which holds the inode information.
The inode(metadata) holds information like Filename, type of file, file-permission, file-owner, Group-name, file-size, time-created, modified-time, time-deleted, hard-link, and soft-link, location in the directory hierarchy, etc..
Ways to find out your Linux system’s file type
In this post, we will put our focus on the Linux file systems. We will discuss ways that you can use to find out your Linux file system type. Most of them are commands that are executed on the Linux Terminal. Our distro of choice is Ubuntu 19.04 (Disco Dingo) and Fedora.
1. The DF command
The df Linux command stands for Disk File-system. DF command alone displays the disk space utilization on your operating system. However, several parameters can be added to give it a lot more functionality. Execute df –help to see all of the parameters available.
To display the file system, you will need to include the -Th parameter. In case you need elevated privileges, add the sudo command.
fosslinux-tuts:~$ sudo df -Th
The file system-type is listed under the Type column. You can also use it with a combination of other commands like grep to get detailed information. For example, to know the file system of all device (/dev) files, execute the command below.
fosslinux-tuts:~$ sudo df -Th | grep dev
Alternatively, use the df command to display the file system of a specific device. For example, the df command below prints the file system of the partition holding your current operating system.
fosslinux-tuts:~$ df -Th /boot
2. The FSCK command
The fsck command checks the Linux file system and attempts repairs in case of an issue. However, with an additional parameter -N and the device path, it shows you the file system type.
fosslinux-tuts:~$ fsck -N /dev/sda
fosslinux-tuts:~$ fsck -N /dev/sdb1
3. The lsblk command
The lsblk command displays all the necessary information about all block devices present or a specific device depending on the path used. lsblk command gathers information by reading the sysfs filesystem and udev db. To display the file system type with lsblk, we will add the -f parameter.
Execute the command lsblk -f or lsblk -fs
fosslinux-tuts:~$ lsblk -f
4. The mount command
The mount command is used to load a file system in a Linux operating system. Other than that, it loads a remote file system or loads an ISO image.
fosslinux-tuts:~$ mount | grep "/dev"
5. The blkid command
The blkid command displays the block device information, i.e., filesystem or swap. You will need to add the device label when using the blkid command.
fosslinux-tuts:~$ blkid /dev/sda
6. The file command
The file command determines the type of a file in a Linux system. It displays all the information about a given file. See the below example:
fosslinux-tuts:~$ file DSC_0627.JPG
To determine the disk file system, we will need to add the -s parameter.
fosslinux-tuts:~$ file -sL /dev/sda1
Note, the file command might require elevated privileges; in such a case, use the sudo command.
fosslinux-tuts:~$ sudo file -sL /dev/sdb1
That’s it! Those are six ways to use to identify the file system used on your Linux system. Is there another method we have not listed? Please let our readers know in the comment section below.