How to mount and unmount a drive in linux
Mounting refers to logically attaching a device/drive (such as cd drives, usb, floppy drive, hard disk, etc.) to a specified location on currently accessible filesystem(s), so that its content can be accessible.
Mounting can be done with the mount command. You need to tell mount command what device or the partition needs to be mount and what will be the mount point. Mount point must exist in your current filesystem and should be a directory.
1. First create a mount point for your device. Many linux distribution contain /mnt folder that is used to mount various devices.
$ mkdir /mnt/usb
2. Now check the name of your drive/device, which you want to access, with the help of following command:
$ fdisk –l
This will list all the devices which are attached with your machine.
3. Now mount your device, which you already attach with the machine, on this mount point.
$ mount /dev/sdb0 /mnt/usb
In the above example /dev/sdb0 is the usb device and it is mounted on /mnt/usb directory. Now you can access the usb device/drive.
Unmount A Drive In Linux
Unmounting is the process of detaching a device/drive from a filesystem. Unmount a device, drive and filesystem can be done using the ‘umount’ command. For example:
$ umount /mnt/floppy $ umount /mnt/cdrom
This will detached the floppy and cdrom from your machine.