Determining a File System type (updated)
As a seasoned data storage engineer I've dealt with many a file system type across many an operating system. But even to this day I still get a query from sys admins and engineers alike asking how to determine what type of file system is this disk or partition.
Under Solaris my favourite has always been the one and only fstyp
command. Under various flavours of Linux I've encountered df -T
and blkid
are the most common. If all else fails and the file system is mounted, simply parsing the output from mount
will reveal all.
The remainder of this article show a series of output from various *NIX operating systems as a guideline :-)
Solaris
- fstyp
Using the
fstyp
command you can determine a file sytems type (if the disk slice contains a file system).fstyp [-v] <device>
For example:# fstyp /dev/rdsk/c0t0d0s0 zfs # fstyp /dev/rdsk/c0t0p0 pcfs # fstyp /dev/rdsk/c2t3d0s7 ufs
From the above we notice that the file systems are zfs, pcfs and ufs file sytems associated with various disk slices. - /etc/fstab
Any mountable file system will have entries in /etc/vfstab. The fourth field provides the file system type:
# head /etc/vfstab #device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # /dev/dsk/c0t3d0s0 /dev/rdsk/c0t3d0s0 / ufs 1 no - /dev/dsk/c0t3d0s1 - - swap - no - /dev/dsk/c0t0d0s7 /dev/rdsk/c0t0d0s7 /export/home ufs 2 yes - /dev/dsk/c0t3d0s7 /dev/rdsk/c0t3d0s7 /files1 ufs 2 yes - pluto:/export/man - /usr/man nfs - yes ro,soft /dev/vx/dsk/fsvol/vol1 /dev/vx/rdsk/fsvol/vol1 /ext vxfs 1 yes -
From the above we have ufs, swap, nfs and vxfs type file systems.
AIX
- lsvf
Running
lspv
to get a list of disks and volume groups, and then runlsvg -l <vg>
will also show the FS type. For example:# lspv disk1234 pvg11 active hdisk234 pvg12 active # lsvg -l pvg11 pvg11: LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT varcorelv jfs2 12203 12203 11 open/syncd /var/core
- mount
Using the
mount
command we see the output, for example:# mount node mounted mounted vfs date options over ---- ------- --------- --- ------------ ------- --------- /dev/hd0 / jfs Dec 17 08:04 rw, log =/dev/hd8 /dev/hd3 /tmp jfs Dec 17 08:04 rw, log =/dev/hd8 /dev/hd1 /home jfs Dec 17 08:06 rw, log =/dev/hd8 /dev/hd2 /usr jfs Dec 17 08:06 rw, log =/dev/hd8
Linux
With the many Linux distributions available, come many a tool also, a few examples below
- lsblk
Using the
lsblk
command with the-f
flag produces the following output$ sudo lsblk -f NAME FSTYPE LABEL MOUNTPOINT sda |-sda1 ntfs OS |-sda2 ntfs Data |-sda3 |-sda5 ext4 / |-sda6 swap [SWAP]
- blkid
% sudo blkid /dev/sda1: UUID="7ae4b6dc-08d0-4a82-b5c4-4b454c8b32ea" TYPE="ext3" PARTUUID="18eb2616-01" /dev/sdb1: UUID="bbde8017-1893-49d1-b51e-431325c57589" TYPE="ext4" PARTUUID="1dcbe7ab-01" /dev/sdb5: UUID="b3c840a0-ee05-4607-a151-bdb038f7a76a" TYPE="swap" PARTUUID="1dcbe7ab-05" /dev/sdd1: UUID="5C2B729713874C4F" TYPE="ntfs"
- df
Using
df -T
also prints the file system types, for example:$ df -T Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/sda1 ext4 190230236 102672812 77894244 57% / udev devtmpfs 1021128 12 1021116 1% /dev tmpfs tmpfs 412884 816 412068 1% /run none tmpfs 5120 0 5120 0% /run/lock none tmpfs 1032208 2584 1029624 1% /run/shm cgroup tmpfs 1032208 0 1032208 0% /sys/fs/cgroup /dev/sdb1 fuseblk 1953480700 1141530424 811950276 59% /library
- fdisk
Or simply use
fdisk -l
, but whilst it shows the generic file system family type it doesn't provide the exact FS type associated with the partition. For example:$ sudo fdisk -l | grep "^/" /dev/sda1 * 2048 976773167 976771120 465.8G 83 Linux /dev/sdb1 * 2048 619126783 619124736 295.2G 83 Linux /dev/sdb2 619128830 625141759 6012930 2.9G 5 Extended /dev/sdb5 619128832 625141759 6012928 2.9G 82 Linux swap / Solaris /dev/sdd1 256 732566644 732566389 2.7T 7 HPFS/NTFS/exFAT /dev/sdc1 63 732566643 732566581 2.7T 83 Linux