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?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
Found a solution in ubuntuforums:
sudo blkid /dev/sda1 /dev/sda1: UUID="...." TYPE="ext4"
External USB disk:
sudo blkid /dev/sdf1 /dev/sdf1: LABEL="backup" UUID="..." TYPE="ext3"
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)
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.
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]  [ 0] [dm-1 ] [swap ] [ ] [ 34.00 GB]  [ 1] [dm-2 ] [xfs ] [ ] [ 797.02 GB]  [ 2]
One can use the
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.,
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).