Representation of file systems
1. Mounting
-
Before a file can be accessed, the file system must be mounted.
Example: consider
the following
mount
command:
$ mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom
The mount command
tells kernel three pieces of information:
1) the name of the file system
2) the physical block device that contains the file system
3) where in the existing file system topology the new file system is to
be mounted
What happens
with mounting?
-
1) The first thing that the VFS must do is to find the file
system -- search through the list of known file systems
-
If it finds a matching name, then the file system is supported
by this kernel, and it has the address to read this file system's superblock.
-
If it cannot find a matching file system name, the kernel
will request that the kernel daemon loads the appropriate file system module
before continuing as before.
-
2) Next if the physical device is not already mounted,
-
it must find the VFS inode of the directory that is to be
the new file system's mount point
-
once the inode has been found, it is checked to see that
it is a directory and that there is not already some other file system
mounted there.
-
( The same directory cannot be used as a mount point for
more than one file system.)
-
3) At this point the VFS mount code must allocate
a VFS superblock.
-
For the Ext2 file system, it simply reads the ext2 superblock
and fills out the VFS superblock from there.
-
For other file systems, such as MSDOS file system,
it is not quite so easy.
-
Whatever file system, filling out the VFS superblock
means that the file system must read from the block device that suports
it.
[next]