In Detail: UNIX File Systems - Mounting file systems
(Page 2 of 5 )
As described in the article I wrote entitled "UNIX File Systems," the structure of the file system is similar to a tree. The root folder (/) is the root of this tree. From here the entire structure branches out, and at every directory you can add new files/directories below it. This structure lets the system mount a new file system anywhere in this tree.
The kernel will mount the root file system at system startup. You can mount further systems anywhere in the three except the /. A mount point is a directory. When you mount a file system to that, the directory will just vanish and its place will be taken by what you just mounted.
When you unmount that, the directory will return to its previous state. You can mount file systems with the mount command line. If you run this with no options/arguments, it will return all of the file systems currently mounted.
Every file system mounted will be added to the mount table. This is a file held in /etc. Here you can find out what systems are mounted, the device on which they reside, the mount point to which they are mounted and a list of options that were used to mount the system. Under Linux, the name of this file is mtab.
On a drive, you can have multiple partitions. The partitions can have different formats, such as NTFS, Ext3 and so on. This will determine their structure. The structure that describes the files in UNIX is the i-node. The i-node table holds all the information about the file under its name.
This is organized by the system and is assigned an integer number. You can view these numbers if you add the -i option to the ls command. The syntax of the mount command looks as follows:
mount [device] [directory where to mount] [options]
The following example will mount the first SCSI-connected hard drive's third partition that has an msdos partition type:
mount /dev/sda3 /media/alfa -t msdos
The command for doing the opposite is unmount. The file systems that should automatically mount are added into the /etc/fstab file. The du and df commands will also help you get a better picture of the space and the files on your system.
Example of the /etc/mtab and /etc/fstab on an Ubuntu 8.10 Linux distribution:


Next: Links in UNIX >>
More Miscellaneous Articles
More By Gabor Bernat