I was reading about mounting in Operating Systems and have the following question related to it:
When we plug an external hard disk it gets automatically mounted in our file system, the one our operating system is using.But how does the operating system know which file system format, like NTFS or FAT32, the Hard Disk is using?
In other words, how will it know which type of File System to mount when we plug a hard-disk into our system?

  • I suppose the OS checks the partition type and other filesystem signature checks eventually.
    – cylgalad
    Commented Sep 29, 2015 at 8:35

2 Answers 2


Almost every filesystem out there starts with some magic values, so you can determine the filesystem type by reading the first few bytes and comparing their values against a list of supported values provided by the drivers.

Some types of partition formats provide information about the filesystem that's on the partition. However this information is incomplete and not always reliable, so Linux largely if not completely ignores it.


I believe the Operating System takes a list of filesystems that it knows of (FAT, EXT2, EXT3 etc.) and matches each one of them in a defined order (based on their popularity probably) against the disk partition, until it finds a match.

The command blkid can be used to determine the filesystem type of a partition. It has a parameter -n to limit the list of filesystems that it probes. for example:

blkid -p -n vfat,ext3,ext4 /dev/sda1
# this will only probe for vfat, ext3 and ext4 filesystems on /dev/sda1
# -p     Switch to low-level superblock probing mode (bypass cache)
  • Information in the partition table is also used at least as a hint.
    – tripleee
    Commented Sep 29, 2015 at 9:20

You must log in to answer this question.

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