Home Command line utilities How To Find The Mounted Filesystem Type In Linux
Find The Mounted Filesystem Type In Linux

How To Find The Mounted Filesystem Type In Linux

By sk
5786 Views

As you may already know, Linux supports numerous filesystems, such as Ext4, ext3, ext2, sysfs, securityfs, FAT16, FAT32, NTFS, and many. The most commonly used filesystem is Ext4. Ever wondered what type of filesystem are you currently using in your Linux system? No? No prolem! This guide explains how to find the mounted filesystem type in Linux and Unix-like operating systems.

Find The Mounted Filesystem Type In Linux

There can be many ways to find the filesystem type in Linux. Here, I have given 8 different methods. Let us get started, shall we?

Method 1 - Find The Mounted Filesystem Type In Linux Using Findmnt

This is the most commonly used method to find out the type of a filesystem. The findmnt command will list all mounted filesystems or search for a filesystem. The findmnt command can be able to search in /etc/fstab, /etc/mtab or /proc/self/mountinfo.

findmnt command comes pre-installed in most Linux distributions, because it is part of the package named util-linux. Just in case if it is not available, simply install this package and you're good to go. For instance, you can install util-linux package in Debian-based systems using command:

$ sudo apt install util-linux

Let us go ahead and see how to use findmnt command to find out the mounted filesystems.

If you run it without any arguments/options, it will list all mounted filesystems in a tree-like format as shown below.

$ findmnt

Sample output:

Find The Mounted Filesystem Type In Linux Using Findmnt

Find The Mounted Filesystem Type In Linux Using Findmnt

As you can see, the findmnt command displays the target mount point (TARGET), source device (SOURCE), file system type (FSTYPE), and relevant mount options, like whether the filesystem is read/write or read-only. (OPTIONS). In my case, my root(/) filesystem type is EXT4.

If you don't like/want to display the output in tree-like format, use -l flag to display in simple, plain format.

$ findmnt -l
findmnt command output in tree-like format

findmnt command output in tree-like format

You can also list a particular type of filesystem, for example ext4, using -t option.

$ findmnt -t ext4
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda2 ext4 rw,relatime,commit=360
└─/boot /dev/sda1 ext4 rw,relatime,commit=360,data=ordered

Findmnt can produce df style output as well.

$ findmnt --df

Or

$ findmnt -D

Sample output:

SOURCE FSTYPE SIZE USED AVAIL USE% TARGET
dev devtmpfs 3.9G 0 3.9G 0% /dev
run tmpfs 3.9G 1.1M 3.9G 0% /run
/dev/sda2 ext4 456.3G 342.5G 90.6G 75% /
tmpfs tmpfs 3.9G 32.2M 3.8G 1% /dev/shm
tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
bpf bpf 0 0 0 - /sys/fs/bpf
tmpfs tmpfs 3.9G 8.4M 3.9G 0% /tmp
/dev/loop0 squashfs 82.1M 82.1M 0 100% /var/lib/snapd/snap/core/4327
/dev/sda1 ext4 92.8M 55.7M 30.1M 60% /boot
tmpfs tmpfs 788.8M 32K 788.8M 0% /run/user/1000
gvfsd-fuse fuse.gvfsd-fuse 0 0 0 - /run/user/1000/gvfs

You can also display filesystems for a specific device, or mountpoint too.

Search for a device:

$ findmnt /dev/sda1
TARGET SOURCE FSTYPE OPTIONS
/boot /dev/sda1 ext4 rw,relatime,commit=360,data=ordered

Search for a mountpoint:

$ findmnt /
TARGET SOURCE FSTYPE OPTIONS
/ /dev/sda2 ext4 rw,relatime,commit=360

You can even find filesystems with specific label:

$ findmnt LABEL=Storage

For more details, refer the man pages.

$ man findmnt

The findmnt command is just enough to find the type of a mounted filesystem in Linux. It is created for that specific purpose only. However, there are also few other ways available to find out the filesystem type. If you're interested to know, read on.

Method 2 - Find The Mounted Filesystem Type Using blkid command

The blkid command is used locate and print block device attributes. It is also part of the util-linux package, so you don't bother to install it.

To list all block devices, simply run it without any parameters:

$ sudo blkid

Sample output:

/dev/sda1: UUID="3968763a-adde-46e0-ae93-e2a1e51120da" TYPE="ext4" PARTUUID="8dd04bfd-01"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"
/dev/loop6: TYPE="squashfs"
/dev/loop7: TYPE="squashfs"
/dev/loop8: TYPE="squashfs"
/dev/loop9: TYPE="squashfs"
/dev/loop10: TYPE="squashfs"
/dev/loop11: TYPE="squashfs"
/dev/loop12: TYPE="squashfs"
/dev/loop13: TYPE="squashfs"
/dev/loop14: TYPE="squashfs"
/dev/loop15: TYPE="squashfs"
/dev/loop16: TYPE="squashfs"
/dev/loop17: TYPE="squashfs"

To find out the type of a filesystem of specific device, for example /dev/sda1, run:

$ sudo blkid /dev/sda1
/dev/sda1: UUID="3968763a-adde-46e0-ae93-e2a1e51120da" TYPE="ext4" PARTUUID="8dd04bfd-01"

You can also display more detailed information using command:

$ sudo blkid -po udev /dev/sda1
ID_FS_UUID=3968763a-adde-46e0-ae93-e2a1e51120da
ID_FS_UUID_ENC=3968763a-adde-46e0-ae93-e2a1e51120da
ID_FS_VERSION=1.0
ID_FS_TYPE=ext4
ID_FS_USAGE=filesystem
ID_PART_ENTRY_SCHEME=dos
ID_PART_ENTRY_UUID=8dd04bfd-01
ID_PART_ENTRY_TYPE=0x83
ID_PART_ENTRY_FLAGS=0x80
ID_PART_ENTRY_NUMBER=1
ID_PART_ENTRY_OFFSET=2048
ID_PART_ENTRY_SIZE=976769024
ID_PART_ENTRY_DISK=8:0

For more details, refer man pages.

$ man blkid

Method 3 - Find The Mounted Filesystem Type Using df command

The df command is used to report filesystem disk space usage in Unix-like operating systems. To find the type of all mounted filesystems, simply run:

$ df -T

Sample output:

Find The Mounted Filesystem Type In Linux Using df command

Find The Mounted Filesystem Type In Linux Using df command

For details about df command, refer the following guide.

Also, check man pages.

$ man df

Method 4 - Find The Mounted Filesystem Type Using file command

The file command determines the type of a specified file. It works just fine for files with no file extension.

Run the following command to find the filesystem type of a partition:

$ sudo file -sL /dev/sda1
[sudo] password for sk: 
/dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=83a1dbbf-1e15-4b45-94fe-134d3872af96 (needs journal recovery) (extents) (large files) (huge files)

Check man pages for more details:

$ man file

Method 5 - Find The Mounted Filesystem Type Using fsck command

The fsck command is used to check the integrity of a filesystem or repair it. You can find the type of a filesystem by passing the partition as an argument like below.

$ fsck -N /dev/sda1
fsck from util-linux 2.32
[/usr/bin/fsck.ext4 (1) -- /boot] fsck.ext4 /dev/sda1

For more details, refer man pages.

$ man fsck

Method 6 - Find The Mounted Filesystem Type Using fstab Command

fstab is a file that contains static information about the filesystems. This file usually contains the mount point, filesystem type and mount options.

To view the type of a filesystem, simply run:

$ cat /etc/fstab
Find The Mounted Filesystem Type In Linux Using fstab Command

Find The Mounted Filesystem Type In Linux Using fstab Command

For more details, refer man pages.

$ man fstab

Method 7 - Find The Mounted Filesystem Type Using lsblk command

The lsblk command displays the information about devices.

To display info about mounted filesystems, simply run:

$ lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
loop0 squashfs /var/lib/snapd/snap/core/4327
sda 
├─sda1 ext4 83a1dbbf-1e15-4b45-94fe-134d3872af96 /boot
├─sda2 ext4 4d25ddb0-5b20-40b4-ae35-ef96376d6594 /
└─sda3 swap 1f8f5e2e-7c17-4f35-97e6-8bce7a4849cb [SWAP]
sr0

For more details, refer man pages.

$ man lsblk

Method 8 - Find The Mounted Filesystem Type Using mount command

The mount command is used to mount a local or remote filesystems in Unix-like systems.

To find out the type of a filesystem using mount command, do:

$ mount | grep "^/dev"
/dev/sda2 on / type ext4 (rw,relatime,commit=360)
/dev/sda1 on /boot type ext4 (rw,relatime,commit=360,data=ordered)

For more details, refer man pages.

$ man mount

And, that's all for now folks. You now know 8 different Linux commands to find out the type of a mounted Linux filesystems. If you know any other methods, feel free to let me know in the comment section below. I will check and update this guide accordingly.

Related read:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

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

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More