Filesystem Mounting

Each filesystem has its own root directory. The filesystem whose root directory is the root of the system's directory tree is called root filesystem. Other filesystems can be mounted on the system's directory tree; the directories on which they are inserted are called mount points. A mounted filesystem is the child of the mounted filesystem to which the mount point directory belongs. For instance, the /proc virtual filesystem is a child of the root filesystem (and the root filesystem is the parent of /proc).

In most traditional Unix-like kernels, each filesystem can be mounted only once. Suppose that an Ext2 filesystem stored in the /dev/fd0 floppy disk is mounted on /flp by issuing the command:

mount -t ext2 /dev/fd0 /flp

Until the filesystem is unmounted by issuing a umount command, any other mount command acting on /dev/fd0 fails.

However, Linux 2.4 is different: it is possible to mount the same filesystem several times. For instance, issuing the following command right after the previous one will likely succeed in Linux:

As a result, the Ext2 filesystem stored in the floppy disk is mounted both on /flp and on /flp-ro; therefore, its files can be accessed through both /flp and /flp-ro (in this example, accesses through /flp-ro are read-only).

Of course, if a filesystem is mounted n times, its root directory can be accessed through n mount points, one per mount operation. Although the same filesystem can be accessed by several paths, it is really unique. Thus, there is just one superblock object for all of them, no matter of how many times it has been mounted.

Mounted filesystems form a hierarchy: the mount point of a filesystem might be a directory of a second filesystem, which in turn is already mounted over a third filesystem, and so

Was this article helpful?

0 0

Post a comment