How to Mount & Unmount a Drive in Linux

Save

A computer running Linux may only make a few drives (e.g., partitions on a hard disk or on a flash drive) available, among all drives recognized by the system. Unlike Windows, Linux does not keep independent folder hierarchies on separate drives designated by different letters. Linux integrates the files stored on separate drives into the same folder hierarchy. Users add a new drive by "mounting" it, that is, by designating a folder in the global hierarchy under which the contents of the new drive will be placed. You can easily mount and unmount drives on Linux.

  • Log in to the Linux computer as user "root." Launch a command shell by logging in in text mode.

  • Verify the drive you want to mount is not yet mounted by entering this command into the shell:

    mount

    Press "Enter." Search for the Linux name of the drive (e.g., "/dev/sda2") at the beginning of every line in the "mount" output. If there is no line beginning with the drive's name, the drive has not yet been mounted.

  • Mount the drive by typing the following commands into the shell:

    mkdir -p /media/mountPoint

    mount /dev/sda2 /media/mountPoint

    Replace "/media/mountPoint" by the location in the global folder hierarchy where you want to mount the new drive. Replace "/dev/sda2" by the name of the drive to be mounted. Press "Enter." All files in the drive will be available under "/media/mountPoint."

  • Unmount the drive by making sure that no process is currently accessing a file or folder on it. Enter the following command into the shell:

    umount /media/mountPoint

    Press "Enter." Linux will continue to understand the name of the drive ("/dev/sda2" in the example) for future commands, but its files will no longer be accessible until it gets mounted again.

References

  • Photo Credit Jupiterimages/Photos.com/Getty Images
Promoted By Zergnet

Comments

You May Also Like

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!