What command can be used to check different kinds of filesystem on Linux for errors?

Linux supports numerous filesystems, such as Btrfs, ext4, ext3, ext2, exFAT, sysfs, securityfs, FAT16, FAT32, NTFS, and many. The most commonly used filesystems are Ext4 and Btrfs. Have you ever wondered which filesystem you are currently using in your Linux system? No? No problem! This guide lists all possible ways to find the mounted filesystem type in Linux and Unix-like operating systems.

Different Ways To Find Filesystem Types In Linux

There can be many ways to find the filesystem type in Linux. Here, I have given 8 different methods to check Linux filesystem type with examples.

Method 1 - Find Filesystem Type In Linux Using Findmnt

The most commonly used command to determine the type of the underlying filesystem in Linux is Findmnt.

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.

The Findmnt command is the part of the util-linux package, which comes pre-installed in most Linux distributions. Just in case if findmnt command is not available in your system, simply install util-linux package as shown below

To 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 the mounted filesystems types in Linux.

When you run findmnt command without any options, it will list all mounted filesystems in a tree-like format:

$ findmnt

Sample output:

TARGET SOURCE FSTYPE OPTIONS / /dev/nvme0n1p2 ext4 rw,relatime,errors=remount-ro ├─/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime │ ├─/sys/kernel/security securityfs securityfs rw,nosuid,nodev,noexec,relatime │ ├─/sys/fs/cgroup cgroup2 cgroup2 rw,nosuid,nodev,noexec,relatime │ ├─/sys/fs/pstore pstore pstore rw,nosuid,nodev,noexec,relatime │ ├─/sys/firmware/efi/efivars efivarfs efivarfs rw,nosuid,nodev,noexec,relatime │ ├─/sys/fs/bpf bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 │ ├─/sys/kernel/debug debugfs debugfs rw,nosuid,nodev,noexec,relatime │ ├─/sys/kernel/tracing tracefs tracefs rw,nosuid,nodev,noexec,relatime │ ├─/sys/fs/fuse/connections fusectl fusectl rw,nosuid,nodev,noexec,relatime │ └─/sys/kernel/config configfs configfs rw,nosuid,nodev,noexec,relatime ├─/proc proc proc rw,nosuid,nodev,noexec,relatime │ └─/proc/sys/fs/binfmt_misc systemd-1 autofs rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=20897 ├─/dev udev devtmpfs rw,nosuid,relatime,size=16196312k,nr_inodes=4049078,mode=755,inode64 │ ├─/dev/pts devpts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 │ ├─/dev/shm tmpfs tmpfs rw,nosuid,nodev,inode64 │ ├─/dev/mqueue mqueue mqueue rw,nosuid,nodev,noexec,relatime │ └─/dev/hugepages hugetlbfs hugetlbfs rw,relatime,pagesize=2M ├─/run tmpfs tmpfs rw,nosuid,nodev,noexec,relatime,size=3249276k,mode=755,inode64 │ ├─/run/lock tmpfs tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k,inode64 │ ├─/run/rpc_pipefs sunrpc rpc_pipefs rw,relatime │ └─/run/user/1000 tmpfs tmpfs rw,nosuid,nodev,relatime,size=3249272k,nr_inodes=812318,mode=700,uid=1000,gid=1000,inode64 │ ├─/run/user/1000/gvfs gvfsd-fuse fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 │ └─/run/user/1000/doc portal fuse.portal rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 ├─/boot/efi /dev/nvme0n1p1 vfat rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro ├─/media/ostechnix/SK_WD_SSD /dev/sda1 exfat rw,nosuid,nodev,noexec,noatime,nodiratime,fmask=0000,dmask=0000,allow_utime=0022,iocharset=utf8,errors=remount-ro ├─/var/lib/lxcfs lxcfs fuse.lxcfs rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other └─/etc/pve /dev/fuse fuse rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other

Find Filesystem Type In Linux Using Findmnt

As you can see in the above output, 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 want to display the output in tree-like format, you can use -l flag to display filesystem types in simple, plain list format.

$ findmnt -l

Display Filesystem Types In List Format With Findmnt Command

You can also list the partitions of a particular filesystem only, 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 also produce df style output as well.

$ findmnt --df

Or,

$ findmnt -D

Sample output:

Findmnt Output In Df Style Format

This is equivalent to df -T command.

You can also display the underlying filesystem of a specific partition, or mountpoint as well.

Search for a device:

$ findmnt /dev/nvme0n1p2 TARGET SOURCE FSTYPE OPTIONS / /dev/nvme0n1p2 ext4 rw,relatime,errors=remount-ro /run/timeshift/backup /dev/nvme0n1p2 ext4 rw,relatime,errors=remount-ro

Search for a mountpoint:

$ findmnt / TARGET SOURCE FSTYPE OPTIONS / /dev/nvme0n1p2 ext4 rw,relatime,errors=remount-ro

You can even find filesystems with specific label:

$ findmnt LABEL=Storage

For more details, refer the findmnt command 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 a few other ways available to view filesystem types in Linux. If you're interested to know, read on.

Method 2 - Check Filesystem Type In Linux 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 along with the filesystem type, simply run it without any parameters:

$ sudo blkid

Sample output:

/dev/nvme0n1p1: UUID="CF87-3143" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="9dc59fb7-f900-484d-b4c5-c9090b901727" /dev/nvme0n1p2: UUID="99406049-9ff5-47d1-a1ce-d5e27cd859c0" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="f2d515b2-a3c4-4c8c-a609-91d5b755b001" /dev/nvme0n1p3: UUID="1ff239fc-674c-4749-9c73-fe5d0668071a" TYPE="swap" PARTUUID="95db6d7b-903b-4f8c-8583-bd00070aa45a" /dev/sda1: LABEL="SK_WD_SSD" UUID="2A81-C276" BLOCK_SIZE="512" TYPE="exfat" PTTYPE="dos" PARTUUID="6251cb36-01" /dev/sda2: SEC_TYPE="msdos" LABEL_FATBOOT="VTOYEFI" LABEL="VTOYEFI" UUID="5A89-BA75" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="6251cb36-02"

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

$ sudo blkid /dev/sda1 /dev/sda1: LABEL="SK_WD_SSD" UUID="2A81-C276" BLOCK_SIZE="512" TYPE="exfat" PTTYPE="dos" PARTUUID="6251cb36-01"

You can also display more detailed information using command:

$ sudo blkid -po udev /dev/sda1 ID_FS_LABEL=SK_WD_SSD ID_FS_LABEL_ENC=SK_WD_SSD ID_FS_UUID=2A81-C276 ID_FS_UUID_ENC=2A81-C276 ID_FS_VERSION=1.0 ID_FS_BLOCK_SIZE=512 ID_FS_TYPE=exfat ID_FS_USAGE=filesystem ID_PART_TABLE_TYPE=dos ID_PART_ENTRY_SCHEME=dos ID_PART_ENTRY_UUID=6251cb36-01 ID_PART_ENTRY_TYPE=0x7 ID_PART_ENTRY_FLAGS=0x80 ID_PART_ENTRY_NUMBER=1 ID_PART_ENTRY_OFFSET=2048 ID_PART_ENTRY_SIZE=1953457584 ID_PART_ENTRY_DISK=8:0

For more details, refer blkid command's man pages.

$ man blkid

Method 3 - Determine Linux Filesystem Type Using df command

The df command is used to report filesystem disk space usage in Linux and Unix-like operating systems.

To find the type of all mounted filesystems, simply run:

$ sudo df -T

Sample output:

Determine Linux Filesystem Type Using Df Command

Remember we can get the same result with findmnt -df or findmnt -D command.

For details about df command, refer the following guide.

  • The df Command Tutorial With Examples For Beginners

Also, check df command man pages.

$ man df

Method 4 - View Linux 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/nvme0n1p2 /dev/nvme0n1p2: Linux rev 1.0 ext4 filesystem data, UUID=99406049-9ff5-47d1-a1ce-d5e27cd859c0 (needs journal recovery) (extents) (64bit) (large files) (huge files)

Check man pages for more details:

$ man file

Method 5 - Display Filesystem Type In Linux 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 with fsck command by passing the partition as an argument like below.

$ sudo fsck -N /dev/nvme0n1p2 fsck from util-linux 2.36.1 [/usr/sbin/fsck.ext4 (1) -- /] fsck.ext4 /dev/nvme0n1p2

For more details, refer fsck command man pages.

$ man fsck

Method 6 - Find Mounted Filesystem Type Using Fstab File

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

Sample output:

# /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # systemd generates mount units based on this file, see systemd.mount(5). # Please run 'systemctl daemon-reload' after making changes here. # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/nvme0n1p2 during installation UUID=99406049-9ff5-47d1-a1ce-d5e27cd859c0 / ext4 errors=remount-ro 0 1 # /boot/efi was on /dev/nvme0n1p1 during installation UUID=CF87-3143 /boot/efi vfat umask=0077 0 1 # swap was on /dev/nvme0n1p3 during installation UUID=1ff239fc-674c-4749-9c73-fe5d0668071a none swap sw 0 0 LABEL=SK_WD_SSD /media/ostechnix/SK_WD_SSD exfat errors=remount-ro,defaults,users,noatime,nodiratime,umask=0 0 2

For more details about Fstab file, refer the following guide.

  • What is Fstab in Linux | An introduction to Linux /etc/fstab file

Also refer fsck command man pages.

$ man fstab

Method 7 - Get Filesystem Type In Linux Using lsblk command

The lsblk command displays the information about devices.

To display information about mounted filesystems, simply run:

$ lsblk -f NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINT sda ├─sda1 exfat 1.0 SK_WD_SSD 2A81-C276 747.5G 20% /media/ostechnix/SK_WD_SSD └─sda2 vfat FAT16 VTOYEFI 5A89-BA75 nvme0n1 ├─nvme0n1p1 vfat FAT32 CF87-3143 507.6M 1% /boot/efi ├─nvme0n1p2 ext4 1.0 99406049-9ff5-47d1-a1ce-d5e27cd859c0 214.4G 48% /run/timeshift/backup └─nvme0n1p3 swap 1 1ff239fc-674c-4749-9c73-fe5d0668071a [SWAP]

For more usage details, refer lsblk command man pages.

$ man lsblk

Method 8 - Find 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/nvme0n1p2 on / type ext4 (rw,relatime,errors=remount-ro) /dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro) /dev/sda1 on /media/ostechnix/SK_WD_SSD type exfat (rw,nosuid,nodev,noexec,noatime,nodiratime,fmask=0000,dmask=0000,allow_utime=0022,iocharset=utf8,errors=remount-ro) /dev/fuse on /etc/pve type fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other) /dev/nvme0n1p2 on /run/timeshift/backup type ext4 (rw,relatime,errors=remount-ro)

Check mount command man pages for more details.

$ man mount

Conclusion

These are 8 different Linux commands to find the mounted filesystem types in Linux. 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:

  • How To List Filesystems In Linux Using Lfs

What command can be used to check different kinds of file systems on Linux for errors?

What command can be used to check different kinds of filesystems on Linux for errors? - chkdsk.

What is the command to check file system in Linux?

Examples.
To check all the default file systems, enter: fsck. This command checks all the file systems marked check=true in the /etc/filesystems file. ... .
To fix minor problems with the default file systems automatically, enter: fsck -p..
To check a specific file system, enter: fsck /dev/hd1..

What is the use of fdisk command in Linux?

fdisk also known as format disk is a dialog-driven command in Linux used for creating and manipulating disk partition table. It is used for the view, create, delete, change, resize, copy and move partitions on a hard drive using the dialog-driven interface.

What does the command dumpe2fs H do?

The dumpe2fs command is used to print the super block and blocks group information for the filesystem present on device. Can be used with ext2/ext3/ext4 filesystem for information.

Toplist

Neuester Beitrag

Stichworte