VFS Mount Structures
Unix employs a single filesystem hierarchy into which new filesystems can be integrated, as shown in Figure 8-4.
bin bin share bin
tmp data cdrom
Figure 8-4: Filesystem hierarchy with various filesystem types.
The illustration shows three different filesystems. The global root directory / uses the Ext2 filesystem (see Chapter 9), /mnt has a Reiserfs, and /mnt/cdrom uses the ISO9660 format commonly used on CD-ROMs. This scenario can be queried using mount.
[email protected]> mount /dev/hda7 on / type ext2 (rw) /dev/hda3 on /mnt type reiserfs (rw)
/dev/hdc on /mnt/cdrom type iso9660 (ro,noexec,nosuid,nodev,user=wolfgang)
The /mnt and /mnt/cdrom directories are known as mount points because this is where filesystems are attached (mounted). Each mounted filesystem has a local root directory that contains the system directories (the source and libs directories in the case of a CD-ROM). When a directory is mounted, the contents of the mount point are replaced with the relative root directory of the mounted filesystem. The previous directory data disappear until the new directory is unmounted (naturally, the data in the old filesystem remain unchanged but can no longer be accessed).
Mounts can be nested as in our example. The CD-ROM is mounted in the directory /mnt/cdrom. This means that the relative root directory of the ISO9660 filesystem is mounted within a Reiser filesystem and is therefore totally divorced from the Second Extended Filesystem used for the global root directory.
The child-parent relationship common to other parts of the kernel is also used to better describe the relationship between two filesystems. Ext2 is the parent filesystem of the Reiserfs in /mnt. /mnt/cdrom contains the child filesystem of /mnt, which is unrelated to the Ext2 root filesystem (at least from this point of view).
The platform for each mounted filesystem is an instance of the vfsmount structure, which is defined as follows:
Continue reading here: Info
Was this article helpful?