How to show the filesystem type via the terminal?

Possible Duplicate:
How to tell what type of filesystem you’re on?
Find filesystem of an unmounted partition from a script

How can I quickly check the filesystem of the partition? Can I do that by using df?

Asked By: tux_drummer

||

Yes, according to man df you can:

-T, --print-type      print file system type

Another way is to use the mount command. Without parameters it lists the currently mounted devices, including their file systems.

In case you need to find out only one certain file system, is easier to use the stat command’s -f option instead of parsing out one value from the above mentioned commands’ output.

Answered By: manatwork

If the filesystem is not mounted (but if it is as well):

blkid -o value -s TYPE /dev/xxx

or:

file -Ls /dev/xxx

where xxx stands for actual block device name like sda1.

You’ll generally need read access to the block device. However, in the case of blkid, if it can’t read the device, it will try to get that information as cached in /run/blkid/blkid.tab or /etc/blkid.tab.

lsblk -no FSTYPE /dev/xxx

will also give you that information, this time by querying the udev data (something like /run/udev/data/b$major:$minor).

Answered By: Stéphane Chazelas
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.