How to detect the file system type of an unmounted device on Linux

Last updated on January 22, 2021 by Dan Nanni

Question: I have a USB memory stick that was formatted before, and I would like to know what filesystem format is used for the USB device. Can I know the filesystem type of the USB drive without mounting it on Linux?

If you want to store data on a new hard drive or a USB memory stick, what you first need to do is to create a "filesystem" on it. This step is also known as "formating" the drive or the USB stick. A filesystem determines in exactly what format data is organized, stored and accessed on a physical device. It is often necessary to know the type of filesystem created on a hard disk or a USB thumb drive even before mounting it. For example, you may need to explicitly specify filesystem type when mounting a disk device, or have to use a filesystem-specific mount command (e.g., mount.aufs, mount.ntfs).

When you want to identify the filesystem type on Linux, the first command that comes to mind may be df, which is a standard Linux command that reports disk space usage. However, df command (with -T option) is only useful to show the filesystem type for mounted devices. Thedf command does not show any information about a USB device which is plugged in, but not mounted.

There are several ways to determine the file system type of an unmounted device. In this example, let's assume that the unmounted USB drive is mapped to /dev/sda.

Method One: lsblk

The first command you can use is lsblk, which shows information about available block devices. This command can read information of a block device whether or not it is mounted. When run wlith -f option, it shows filesystem type of every mounted or unmounted block device.

$ lsblk -f

The output shows that /dev/sda has FAT filesystem (vfat is a driver for FAT filesystem).

You can filter out the output and display only information relevant to the USB device.

$ lsblk -f | grep sda

Method Two: blkid

Another useful command-line is blkid which also shows block device attributes.

$ blkid | grep sda
/dev/sda: LABEL="usb" UUID="AB24-FB63" TYPE="vfat"

Method Three: gnome-disks

If you are using GNOME desktop, you can use a GUI-based disk utility called gnome-disks to determine filesystem type of a device even before it is mounted.

Launch the disk utility by entering Disks in GNOME Activities, or run the following from the command line.

$ gnome-disks

On the GUI screen, choose the USB thumb drive on the left-side panel, and its filesystem type will appear on the right-side panel.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean