The mount and umount Commands

Now that the file system has been created, you can mount the partition. Initially, it will be empty, since the system has not had access to the file system for files to have been added to it. The command to mount file systems is mount , and its syntax is as follows:

mount [options] <-t type> [-o mount options] <device> <mounting point>

In this case, we want to temporarily mount our partition on /mnt (or any other mount point you have chosen – remember that the mount point must exist). The command for mounting our newly created partition is:

    $ mount -t ext2 /dev/hdb1 /mnt
   

The -t option is used to specify what type of file system the partition is supposed to host. The file systems you will most frequently encounter are ext2FS (the GNU/Linux file system) or ext3FS (an improved version of ext2FS with journal capabilities), VFAT (for all DOS/Windows partitions: FAT 12, 16 or 32) and ISO9660 (CD-ROM filesystem). If you do not specify any type, mount will try and guess which file system is hosted by the partition by reading the superblock.

The -o option is used to specify one or more mounting options. The options appropriate for a particular file system will depend on the file system being used. Refer to the mount(8) man page for more details.

Now that you have mounted your new partition, it's time to copy the entire /usr directory onto it:

$ (cd /usr && tar cf - .) | (cd /mnt && tar xpvf -)

Now that the files are copied, we can unmount our partition. To do this, use the umount command. The syntax is simple:

umount <mount point|device>

So, to unmount our new partition, we can type:

$ umount /mnt

or:

$ umount /dev/hdb1

Since this partition is going to “become” our /usr directory, we need to tell this to the system. To do this, we edit: