Mounting & Dismounting

What Is Mounting?

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.


The mount Command

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.


Mounting A Floppy Disk

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:

mount /dev/fd0


mount /mnt/floppy


Mounting a CD

CD-ROMs generally (once they’re created) use the iso9660 filesystem, and are (generally) read-only:

mount -r -t iso9660 /dev/cdrom /mnt/cdrom


Mounting A Partition


mount -t ext3 /dev/hdc1 /newdirectory


How can I mount everything that’s supposed to be mounted at boot time?

mount -a


The /etc/fstab File

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:

  1. It mounts partitions at boot time, and
  2. it holds information that allows users to mount partitions/drives with minimal information.

The file has six columns or fields:

  1. The device to mount, e.g. /dev/hda1
  2. The mount point, e.g. /home
  3. The filesystem type – ext3, swap, proc, udf, auto, etc.
  4. Mount options – defaults, ro, rw, noauto, owner, GID and more.
  5. dump# – 1=Back it up, 2=No backup
  6. fsck# – 0=No check, 1=Check first, 2=Check later

Filesystems with the noauto mount option are not mounted at boot time.


What’s Currently Mounted?

Simply command:


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:

cat /etc/mtab


Who’s Using It?

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:

umount /mnt/floppy

umount /newdirectory

Note that floppies, CDs and other removable media must be unmounted before they are removed.



LinuxPlanet: Adding Additional Hard Drives In Linux, at