Mounting and Unmounting a drive is a very essential thing for any Linux
user. Today we will learn how to Mount and unmount a drive on Linux.
Mounting is an act of making a Physical Drive accessible to an Operating System. The reverse of Mounting is Un-mounting, which means removing the physical drive from the operating system and hence making them inaccessible.
Okay! So now we will learn how to mount a drive.
Mount a Flash Drive
By default whenever you insert physical drive then your OS mount it and also provides you the ability to unmount it graphically. But we will learn how to do it using a terminal or from command line.
First we will list all the drives and partitions on your OS and the device paths. To do so we write the following on the Terminal :-
fdisk is a tool built into linux (Almost all the versions) which can be used to see all the partitions. You will see something like the following (based on your partitions table) :-
As you can see we have a physical drive attached to the PC which is about 8 GB in size and the device path being /dev/sdb1
Mounting is an act of making a Physical Drive accessible to an Operating System. The reverse of Mounting is Un-mounting, which means removing the physical drive from the operating system and hence making them inaccessible.
Okay! So now we will learn how to mount a drive.
Mount a Flash Drive
By default whenever you insert physical drive then your OS mount it and also provides you the ability to unmount it graphically. But we will learn how to do it using a terminal or from command line.
First we will list all the drives and partitions on your OS and the device paths. To do so we write the following on the Terminal :-
sudo fdisk -l
fdisk is a tool built into linux (Almost all the versions) which can be used to see all the partitions. You will see something like the following (based on your partitions table) :-
As you can see we have a physical drive attached to the PC which is about 8 GB in size and the device path being /dev/sdb1
Knowing the device path is essential.
To mount point the drive we have to first create a mount point. A mount point is a physical location in the partition used as a root filesystem. We have to create a folder and then mount it there, where the files will be shown. We create a folder mnt_pnt and then mount the drive there.
Commands :-
In the above commands we create a folder named mnt_pnt using mkdir. You also need to specify the type of the file system of the physical drive that you want to mount. We do this by passing an argument "-t vfat" which means that the type of file system is FAT.
Now open the folder using your system file manager or simple changing the directory to mnt_pnt folder using "cd" command and then listing the directory will show you the content of the drive.
Un-Mounting a Drive
Un-mounting a drive is the easiest thing to do. You just need the device path which you can get by using fdisk as shown above. The command to do so is "umount <device-path>".
Example :-
To mount point the drive we have to first create a mount point. A mount point is a physical location in the partition used as a root filesystem. We have to create a folder and then mount it there, where the files will be shown. We create a folder mnt_pnt and then mount the drive there.
Commands :-
mkdir mnt_pnt
sudo mount -t vfat /dev/sdb1 ./mnt_pnt
In the above commands we create a folder named mnt_pnt using mkdir. You also need to specify the type of the file system of the physical drive that you want to mount. We do this by passing an argument "-t vfat" which means that the type of file system is FAT.
Now open the folder using your system file manager or simple changing the directory to mnt_pnt folder using "cd" command and then listing the directory will show you the content of the drive.
Un-Mounting a Drive
Un-mounting a drive is the easiest thing to do. You just need the device path which you can get by using fdisk as shown above. The command to do so is "umount <device-path>".
Example :-
umount /dev/sdb1
Video Demonstration
I hope you liked this Simple Tutorial. Stay Tuned for More. Share this tutorial among your friends and on Social Networks :)
Thank you.
0 comments :
Post a Comment