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:

mount -t ext2 -o ro /dev/fd0 /flp-ro

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 ...

Get Understanding the Linux Kernel, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.