Mounting is simply the process of “plugging” a directory into your file system tree. You can mount a whole partition, for instance when you add a hard drive. Or you can mount a shared network directory into your local file system tree.
There are a couple of critical principles to know. First, you will use a directory that already exists on your file system tree as a point to which you’ll mount. Normally you’d create an empty directory for just this purpose, but in the event that you use a directory that already has contents, those contents won’t be available until you dismount what you’ve mounted over them.
Second, file system type matters. Your system may or may not have support for various file systems, and in the case of some file systems like NTFS, you may have read-only access. You’ll be expected to know, in most cases, what type of file system you’re mounting as well.
mount is, more or less, a simple command. Its basic syntax is:
mount [options] device_to_mount mount_point
For example, to mount a partition to a directory:
mount -t ext3 /dev/hdc5 /projects
This assumes that you’ve created a directory, /projects, where you’ll access the contents of the new hard drive.
Use the full and formal:
mount -t ext2 /dev/fd0 /mnt/floppy
If the floppy disk is already listed in /etc/fstab (it ought to be) the mount command can consult that file if you supply only the barest information:
CD-ROMs generally (once they’re created) use the iso9660 filesystem, and are (generally) read-only:
mount -r -t iso9660 /dev/cdrom /mnt/cdrom
mount -t ext3 /dev/hdc1 /newdirectory
The File System Table (fstab) file holds a list of mountable drives. Not everything in this list mounts at boot; some entries are there to allow easy mounting of removable drives, for instance.
This the fstab file has two roles:
- It mounts partitions at boot time, and
- it holds information that allows users to mount partitions/drives with minimal information.
The file has six columns or fields:
- The device to mount, e.g. /dev/hda1
- The mount point, e.g. /home
- The filesystem type – ext3, swap, proc, udf, auto, etc.
- Mount options – defaults, ro, rw, noauto, owner, GID and more.
- dump# – 1=Back it up, 2=No backup
- fsck# – 0=No check, 1=Check first, 2=Check later
Filesystems with the noauto mount option are not mounted at boot time.
and you’ll get a list of currently mounted filesystems. Note that this command abstracts this information from the file /etc/mtab, which you can view directly yourself:
This can be a critical question when you’re performing an unmount. Command:
fuser -u /mnt/floppy
The -u option specifically checks for users. You can kill the processes accessing files on the filesystem with a -k:
fuser -k /mnt/floppy
Or be nice and ask first:
fuser -ik /mnt/floppy
Use the umount command, with either the device file or the mount point as the argument:
Note that floppies, CDs and other removable media must be unmounted before they are removed.
LinuxPlanet: Adding Additional Hard Drives In Linux, at http://www.linuxplanet.com/linuxplanet/tutorials/4232/1/