Is there a command that will show which file system (ext3, ext4, FAT32, ...) the various partitions and disks are using?

Similar to how sudo fdisk -l lists information about disks and partitions?

  • What do you mean by "similar to" sudo fdisk -l? ,,, Even when the drive is not mounted, fisk gives you the file system type, and it is a command line tool.... I unmounted two of my drives (a USB, and an Internal) and this worked fine: sudo fdisk -l|grep "^/dev"
    – Peter.O
    Jan 2, 2011 at 4:59
  • @fred fdisk says things like "Linux" and "Linux swap", can't see that it tells me whether it's ext3 or ext4. Jan 2, 2011 at 5:02
  • Don't go by the name;; go by the filesystem Id ... if its 83, fdisk reports it as "Linux, **gpart** as mentioned by Luke Maurer) reports it as **ext2** ,, same thing.. The drives I tested are Ext4 (but were reported as 'ext2' and 'Linux' by the two apps), but it seems that this identity is a higher abstraction. Whether you really need to go further is up to you... but the **Id** certainly gives you a pretty closes idea. (if you need to know specifically, perhaps 'gpart in full scan mode will do it... (I havent tried its full scan, but I suspect it won't say much more (??)..
    – Peter.O
    Jan 2, 2011 at 5:29

11 Answers 11



me@hostname:/$ mount
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)


  • 2
    Except that the disks aren't mounted - I'm trying to figure out which FS to put in /etc/fstab for a USB external disk Jan 2, 2011 at 1:48
  • Can't you mount it in Nautilus and then check?
    – frabjous
    Jan 2, 2011 at 3:04
  • 1
    I don't have a desktop environment, running headless over ssh. Jan 2, 2011 at 4:16
  • 1
    @frabjous Why use Nautilus? Could also just mount it on the command line and then check; this usually works even if you don't specify the filesystem. Jan 2, 2011 at 4:28
  • 1
    @Luke: It worked :) Jan 2, 2011 at 4:53

Found a solution in ubuntuforums: blkid

System disk:

sudo blkid /dev/sda1
/dev/sda1: UUID="...." TYPE="ext4"

External USB disk:

sudo blkid /dev/sdf1
/dev/sdf1: LABEL="backup" UUID="..." TYPE="ext3"     

mdadm RAID:

sudo blkid /dev/md0
/dev/md0: LABEL="raid" UUID="..." TYPE="ext4" 

Mount without specifying filesystem (commenting out any entries in fstab) works as well:

sudo mount /dev/sdf1 /mnt/tmp
mount | grep /mnt/tmp
/dev/sdf1 on /mnt/tmp type ext3 (rw)
  • 1
    Another advantage of blkid: No need to be root (or sudo) to run the command.
    – jap1968
    May 30, 2016 at 8:56
  • blkid required root to detect an external hard drive.
    – qwr
    Jan 23 at 17:16

df -h -T will list all disks used with filesystem type.

This command will also let you query which filesystem is in use for an arbitrary given directory.

For example, the following output shows that the /usr/local/lib directory is on the /dev/xvdb device, and it's formatted with the ext4 filesystem.

user@disp556:~$ sudo df -h -T /usr/local/lib
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/xvdb      ext4  2.0G  135M  1.8G   7% /usr/local

lsblk -f

Will give you the filesystem of any attached devices, whether they are mounted or not.

It also gives you other useful information for creating the needed line for your fstab file such as the UUID.


All of the solutions suggested here are valid, but don't allow to see if for instance a partition is FAT16 or FAT32. For this level of detail, the best command is

sudo file -s /dev/sda1

Example, on a USB key:

/dev/sdc: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "MSWIN4.1", sectors/cluster 32, Media descriptor 0xf8, sectors/track 63, heads 255, sectors 15794176 (volumes > 32 MB) , FAT (32 bit), sectors/FAT 3856, reserved 0x1, serial number 0x4c437f55, unlabeled

It's somewhat overkill, but there's always gpart. It's meant for when the partition table is broken, but it does tell you what type all the filesystems it can find are.

EDIT: This doesn't seem to work if something on the disk is mounted already, though (I just tried it on my running system).

Theoretically, if you just want it to print the partition table, you can use a command like this (from the man page):

$ sudo gpart -vvd /dev/sda

But again I can't try it right now; not sure if it'll tell you the filesystems if it's not doing a scan.

  • I just tried it... I unmounted my "sdb" data drive via Nautilus.. It's mounpoint directory showed as "Total 0" via "ls -l" and anothe File Browser (PCMan) prompted me to mount it... but even though it wasn't mounted gpart did return basic partiton information; in particuar, it did show the filesystem
    – Peter.O
    Jan 2, 2011 at 5:03
  • It works, but a bit slower than the other answers - it takes a while to scan a 1TB disk. Still thanks for the pointer to a useful tool, I'm sure gpart will come in handy. Jan 2, 2011 at 5:22

A nice simple tool to find out information about attached devices... and to do backups is the fsarchiver program.

You probably have to install it to use it...

The command I usually use to find out what is on the system is :

 sudo fsarchiver probe simple

and that comes back with something like :

[======DISK======] [=============NAME==============] [====SIZE====] [MAJ] [MIN]
[sda ] [WDC WD1001FALS-0               ] [   931.51 GB] [  8] [  0]
[sdb ] [ST31000524AS                   ] [   931.51 GB] [  8] [ 16]
[sdg ] [DataTraveler 3.0               ] [    29.31 GB] [  8] [ 96]

[=====DEVICE=====] [==FILESYS==] [======LABEL======] [====SIZE====] [MAJ] [MIN] 
[sda1 ] [xfs        ] [        ] [   500.00 MB] [  8] [  1] 
[sda2 ] [LVM2_member] [        ] [   931.02 GB] [  8] [  2] 
[sdb5 ] [ext4       ] [mydisk_data_01   ] [   931.51 GB] [  8] [ 21] 
[sdg1 ] [vfat       ] [KINGSTON         ] [    29.30 GB] [  8] [ 97] 
[dm-0 ] [xfs        ] [        ] [   100.00 GB] [253] [  0] 
[dm-1 ] [swap       ] [        ] [    34.00 GB] [253] [  1] 
[dm-2 ] [xfs        ] [        ] [   797.02 GB] [253] [  2] 

One can use the udisksctl command.

First, execute udisksctl status to list devices and determine the relevant device's three-letter ID.

Given the three-letter ID "sdc" (for example), execute udisksctl info --block-device /dev/sdc to get the relevant device's four‐character partition ID.

Given the four-character ID "sdc1" (for example), execute udisksctl info --block-device /dev/sdc1 to get the filesystem via the IdVersion attribute (e.g., FAT32).

This is useful if you're accessing a device using a virtual filesystem (e.g., an SD card plugged into a USB-A adapter/dongle).


I use either of these two commands

lsblk -f -e7


df -Th -x squashfs -x tmpfs -x devtmpfs


Below command is used to determine the file system type of a device.

sudo file -sL /dev/sdb enter image description here

  • Please don’t post a screenshot of a terminal window - much better to paste the actual text into this site.
    – Will
    Dec 3, 2023 at 17:06

You can use parted at a command prompt to print partition details:

parted -l

(that's a letter-L).

The parted command is used by GUI apps like gparted and kpartitionmanager.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .