Get Filesystem Type on Linux

Get Filesystem Type on Linux

When working with Linux systems, you might need to know what type of filesystem (like ext4, xfs, or vfat) is being used on the disks. This is especially useful for system administrators, DevOps engineers, or anyone managing servers - since different filesystem types have different performance characteristics, limitations, and tuning options. This tutorial demonstrates how to get filesystem type on Linux.

The df command reports filesystem disk space usage. To include the filesystem type, use the -T option:

df -hT

Example output:

Filesystem     Type      Size  Used Avail Use% Mounted on
tmpfs          tmpfs     9.2G  2.5M  9.2G   1% /run
/dev/nvme0n1p5 ext4      492G  280G  187G  60% /
tmpfs          tmpfs      46G  3.1M   46G   1% /dev/shm
efivarfs       efivarfs  256K  129K  123K  52% /sys/firmware/efi/efivars
tmpfs          tmpfs     5.0M   24K  5.0M   1% /run/lock
tmpfs          tmpfs     1.0M     0  1.0M   0% /run/credentials/systemd-journald.service
tmpfs          tmpfs     1.0M     0  1.0M   0% /run/credentials/systemd-resolved.service
tmpfs          tmpfs      46G  8.0K   46G   1% /tmp
/dev/nvme0n1p1 vfat       96M   33M   64M  34% /boot/efi
tmpfs          tmpfs     9.2G  104K  9.2G   1% /run/user/1000

Here, you can see:

  • / is using ext4.
  • /boot/efi is using vfat.
  • Several temporary filesystems are tmpfs.

If you prefer a minimal, script-friendly output, use the --output option:

df --output=source,fstype,target

Example output:

Filesystem     Type     Mounted on
tmpfs          tmpfs    /run
/dev/nvme0n1p5 ext4     /
tmpfs          tmpfs    /dev/shm
efivarfs       efivarfs /sys/firmware/efi/efivars
tmpfs          tmpfs    /run/lock
tmpfs          tmpfs    /run/credentials/systemd-journald.service
tmpfs          tmpfs    /run/credentials/systemd-resolved.service
tmpfs          tmpfs    /tmp
/dev/nvme0n1p1 vfat     /boot/efi
tmpfs          tmpfs    /run/user/1000

This command will show only specific fields.

Leave a Comment

Cancel reply

Your email address will not be published.