Knowing the filesystem type behind a path or block device matters before choosing mount options, running repair tools, or troubleshooting why one volume behaves differently from another. Filesystems such as ext4, xfs, btrfs, and vfat support different features, limits, and recovery workflows.
Linux exposes filesystem type information in two main places: the live mount table for paths that are already attached to the directory tree, and the on-disk signatures stored on a partition, logical volume, or whole-disk filesystem. findmnt resolves the filesystem behind a mounted path, blkid probes a known device directly, and lsblk or df provide a wider inventory view.
The command should match the object being checked. A mounted path and a raw device do not answer the same question, and a whole disk with partitions may show only the partition table rather than a filesystem. Containerized or rescue environments can also leave lsblk filesystem fields blank, and stat -f -c %T can report a broader kernel family name such as ext2/ext3 for an ext4 filesystem, so use findmnt or blkid when the exact type matters.
Steps to show filesystem type in Linux:
- Show the mounted filesystem that contains a path with findmnt.
$ findmnt --target /etc --output TARGET,SOURCE,FSTYPE,OPTIONS TARGET SOURCE FSTYPE OPTIONS / /dev/sda2 ext4 rw,relatime
The TARGET column shows the mount that contains the queried path, so checking /etc usually resolves to the root filesystem rather than a separate mount.
- Print only the filesystem type for a path when a script or a quick terminal check does not need the other mount columns.
$ findmnt --noheadings --output FSTYPE --target /etc ext4
This form is easier to reuse in shell scripts because it returns only the filesystem type value.
- Probe a specific partition or logical volume with blkid when the device path is already known.
$ sudo blkid /dev/sda2 /dev/sda2: UUID="c7f70fb1-ad04-47c0-8aa2-873cbef19d05" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="ef3ea15d-b212-4c1c-b1df-09f77e3fb2b2"
Use a partition or logical-volume path such as /dev/sda2, /dev/nvme0n1p2, or /dev/mapper/vg0-data. A whole disk such as /dev/sda often reports only PTTYPE and PTUUID when the filesystem lives inside partitions.
- Print only the filesystem type from blkid when the extra metadata is not needed.
$ sudo blkid --match-tag TYPE --output value /dev/sda2 ext4
blkid reads metadata directly from the target device. Its own documentation recommends lsblk or lsblk –fs for a wider overview and findmnt for already mounted paths.
- List filesystem types across visible block devices with explicit lsblk columns.
$ lsblk --output NAME,FSTYPE,FSVER,LABEL,UUID,MOUNTPOINT NAME FSTYPE FSVER LABEL UUID MOUNTPOINT loop0 squashfs 4.0 /snap/core22/1720 ##### snipped ##### sda ├─sda1 vfat FAT32 058E-72AC /boot/efi └─sda2 ext4 1.0 c7f70fb1-ad04-47c0-8aa2-873cbef19d05 /
lsblk –fs is the preset filesystem view, but explicit –output columns keep the published output stable. Some containers and rescue environments can still leave FSTYPE blank there, so fall back to blkid for the authoritative answer on one specific device.
- Use df when the filesystem type for a mounted path is needed together with size and usage.
$ df -hT /etc Filesystem Type Size Used Avail Use% Mounted on /dev/sda2 ext4 62G 11G 48G 19% /
df only reports mounted filesystems, so it cannot identify an unmounted partition or a raw image file.
- Use stat only as a quick fallback when another path-based tool is unavailable.
$ stat -f -c '%n -> %T' /etc /etc -> ext2/ext3
This output comes from the kernel filesystem family name rather than the exact on-disk label, so an ext4 filesystem can still appear here as ext2/ext3. Prefer findmnt or blkid when the exact filesystem type must be confirmed before a mount, repair, resize, or migration task.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
