Using Linux Mount Command

A Quick Guide to Using Linux Mount and Umount Commands

man working in the office at computer
Aping Vision/STS/Photodisc/Getty Images

The Linux Mount command is used to mount USBs, DVDs, SD cards, and other types of storage devices on a Linux computer. Linux uses a directory tree structure. Unless the storage device is mounted to the tree structure, the user can't open any of the files on the device.

How to Use the Mount and Umount Commands in Linux

The following example illustrates the typical uses of the Mount command for attaching the file directory of a device to the file directory tree of the Linux system.

In this case, the user has inserted a CD into the computer's CD drive. To see the files on the CD, open a terminal window and enter:

mount /dev/cdrom /mnt/cdrom

This command connects the device "/dev/cdrom" (the CD ROM drive) to the directory "/mnt/cdrom" so that you can access the files and directories on the CD ROM disk under the "/mnt/cdrom" directory. The "/mnt/cdrom" directory is called the mount point, and it must already exist when this command is executed.

umount /mnt/cdrom

This command unmounts the CD ROM drive. After this command is executed the files and directories on the CD ROM are longer accessible from the directory tree of the Linux system.

umount /dev/cdrom

This has the same effect as the previous command—it unmounts the CD ROM.

Each type of device has a different mount point. In these examples, the mount point is the "/mnt/cdrom" directory. The default mount points for the various devices are defined in the file "/etc/fstab." 

Some Linux distributions use a program called automount, which automatically mounts all the partitions and devices listed in /etc/fstab.

How to Make a Mount Point

If the device you are trying to access doesn't have a default mount point listed in "/etc/fstab," you have to make a mount point first. For example, if you want to access an SD card from a camera, but the SD card isn't listed in "/etc/fstab," you can do it from the terminal window:

Insert the SD card into the SD reader, either built-in or external.

Type this command to list the devices that are accessible on the computer:

/fdisk -l

Write down the device name assigned to the SD card. It will be in a format similar to "/dev/sdc1" and appear at the beginning of one of the lines. 

Type:

mkdir /mnt/SD 

to make a new mount point for the camera's SD card. Now you can use "/mnt/SD" in the mount command along with the device name you wrote down to mount the SD card. 

mount /dev/sdc1 /mnt/SD