Take the 2-minute tour ×

As I know, Linux has an abstract layer of all filesystems and this layer is VFS. If I create a new filesystem, I should follow rules made by VFS (see "Anatomy of the Linux virtual file system switch" for more information). After I made this new filesystem, I am going to mount it to the directory hierarchy. But I have a problem here: how the linux OS know my filesystem?

Actually, there can be many filesystems in Linux. Some of them are mounted and can be found with command mount, others are not mounted but you can mount them anytime you like. Are these unmounted ones recorded in some place in the OS? I know there are two files /etc/fstab and /etc/filesystems may be concerned with my question but I am not sure.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Filesystems that aren't mounted are not accessible at the moment. You might be able to modify them by indirect means, such as accessing the underlying device directly (for filesystems stored on a local disk) or by accessing them from another machine (for network filesystems). But otherwise, unmounted filesystems don't exist as far as the OS is concerned. Given the existence of network filesystems (amongst others), there is an unending supply of unmounted filesystems (every directory on every).

Think of the file /etc/fstab as a configuration file for the mount command. It contains shortcuts, so that you can call mount /path/to/mount/point or mount /dev/device_name and mount will search for a matching line in /etc/fstab and complete the command line with a device name or mount point, a filesystem type and mount options. If an entry has the user option, any user may call the mount command on this entry (in general, mount is reserved to root).

In addition, /etc/fstab lists filesystems that are mounted at boot time. All entries in that file that do not have the noauto option are mounted at boot time with the supplied options. There are usually other filesystems not mentioned in this file that are mounted by boot scripts (on a typical Linux system, this includes /dev, /dev/pts, /proc, /sys, and a few more).

/etc/filesystems is a rarely-used feature of mount under Linux that allows you to customize its behavior when you don't pass a filesystem type or pass auto. Without this file, mount tries the filesystem types listed in /proc/filesystems. The filesystem types are tried in sequence: if mounting with the first entry fails, mount tries the second, and so on.

share|improve this answer
Thanks. And I find that devices described by entries in /etc/fstab with noauto option can be only mounted explicitly, please see en.wikipedia.org/wiki/Fstab#Common_options_to_all_filesystems –  xanpeng Nov 9 '11 at 1:49
add comment

Short answer is that it doesn't know.

But there are ways of giving hints. Historically this was done via a label in the partition table of a fixed disk. But this is still just a hint to what filesystem is in there - some tools will rely on this hint (e.g. mkfs - which is just a simple front end to mkfs.umsdos, mkfs.ext3, mkfs.reiserfs....)

Another approach is to try to sniff the filesystem type by reading bytes off the raw partition (mount does this to select between the different MSDOS compatable types). Or retain a database of filesystems on known device identifiers.

Given the diversity of filesystems there's no unified approach which will always be accurate.

So the system will use the filesystem type (or at least family) the admin tells it to use.

share|improve this answer
add comment

Your Answer


