Learn How To Mount and Unmount Hard Drives From Command Line

Posted on: February 7th, 2011 by No Comments

Linux Library Logo

Linux and Unix filesystems are arranged into a hierarchy like a tree. Everything starts at the root or /. Your files may be separated, even on different hard drives.

Learn How To Mount Devices

Using the mount command will attach a device into your file tree at the location you specify. This program has many options and functions so we will only list a few of the most important items.

Unmount Drives Too

You should use the umount command to unmount hard drives. Note that the n is missing, this is the most common mistake when using the umount command.

Display Partition Information

To display your system partition information use the command below.

$ cat /proc/partitions

Mount Commands and Options


Here are some useful commands and options that will help you mount devices from the Linux command line.

Standard Syntax

This is the standard usage for the mount command.

$ mount option /device /directory

Detailed Example

Another example of the mount command.

$ mount /dev/sda1 /home/user/folder

List Mounted File Systems

This will list all of the filesystems that you currently have mounted.

$ mount -l -t type

Ged Extra Help

This will give you further help.

$ mount -h

Mount Version Information

See the version information for the mount tool.

$ mount -V

Use Verbose Mode

The next command will p ut mount into verbose mode.

$ mount -v

Mount Fstab Devices

Will mount all filesystems listed in your /etc/fstab

$ mount -a

Use Read Only Mode

The next command will mount your filesystem in read-only mode.

$ mount -r

Use Read Write Permissions

Mounts the filesystem with read and write permissions enabled. This is the default.

$ mount -w

Mount File System By Label

Use this to mount the filesystem that has the Label you choose.

$ mount -L

Mount File System By UUID

This will mount the filesystem with the UUID you specify.

$ mount -U

Umount Commands and Options


This is the standard usage for the umount command.

$ umount option directory or device

This will unmount the specified device.

$ mount /dev/sda1

This will unmount the device that is mounted in the specified folder.

$ mount/home/user/folder

Will print the version information.

-V

Use this to get help.

-h

Turns on verbose mode.

-v

This will unmount all devices listed in your /etc/mtab file.

-a

Use this to find unmount file systems of the specified type.

-t type

Will force an unmount.

-f

Tags: , , , , | Posted in Command Line