1. Computing

Discuss in my forum

Example uses of the Linux Command mount

An Introductory Tutorial

By

The following examples illustrate typical uses of the command mount for attaching the file directory of a device or partition to the file directory tree of the Linux system.

 mount /dev/fd0 /mnt/floppy
This command will connect the device "/dev/fd0" (usually the floppy drive) to the directory "/mnt/floppy" so that you can access the files and directories (folders) on the floppy disk in the floppy drive under the "/mnt/floppy" directory. The directory "/mnt/floppy" is also called the "mount point", which must already exist when this command is executed.

 mount /dev/cdrom /mnt/cdrom
This command will connect the device "/dev/cdrom" (usually the CD ROM drive) to the directory "/mnt/cdrom" so that you can access the files and directories on the CD ROM disk in the CD ROM drive under the "/mnt/cdrom" directory, which must already exist when this command is executed.

 umount /mnt/floppy
This command unmounts the floppy drive. After this command is executed the files and directories on the floppy will no longer be accessible from the directory tree of the Linux system.

 umount /dev/fd0
This has the same effect as the previous command.

 umount /mnt/cdrom
This command unmounts the CD ROM drive. After this command is executed the files and directories on the CD ROM will no longer be accessible from the directory tree of the Linux system.

 umount /dev/cdrom
This has the same effect as the previous command.

The default mount points for the various devices are defined the file /etc/fstab. Some Linux distributions use a program called automount, which automatically mounts all the partitions and devices listed in /etc/fstab.

Complete syntax of the command: mount
  1. About.com
  2. Computing
  3. Linux

©2014 About.com. All rights reserved.