In this tutorial, we look at how you can auto-mount your hard drives on Linux systems. The best part is we are showing you easy GUI method of mounting your drives automatically on your Linux desktop. Now the software we are going to be used for this purposes is gnome Disk Utility. The Disk Utility is available in most of your Linux distros and Repos as well as it should be available out of the box in most of the gnome desktops.
Now if are automate your hard drive with the help of fstab file. Then you need to require an editor to edit fstab file and change it from there. Now the problem lies is if you change anything and or if you add anything that’s incorrect your system will not boot. Then you will have to go to the headache of figuring out how exactly do you remove certain things in order for the system to work again. If you haven’t taken a snapshot you then you might face difficulty to roll back your system in the previous state.
So here we came up with a much safer method to automate your drives especially if you are new to the Linux systems. So let’s start with a quick GUI way of doing it. Now the first step we want to take is to create a folder in /medium directory and how we gonna do that is we can open up our terminal and going to the media folder. Type the following command in the terminal to get in the media drive
After that type ls cmd in this directory if you find nothing in this then you haven’t plugged in any external hard drive. Now we have to create a folder here so type the following commands
sudo mkdir directory name.
sudo mkdir data
mkdir stands for make directory and gives it whatever name you choose to give like here we going to name directory as data.
Once you typed in that command the new folder should be created just do a quick ls cmd and it showed up the name of your newly created folder. Now close the terminal and go back to your GUI tool then navigate and choose the drive that you want to automount. But keep in mind if your hard drive is formatted in multiple different partitions then it’s only going to mount the specific partition.
But if it is not then it is automatically mounted the whole drive don’t worry about that. So now we gonna click on this backup after that click on edit partitions or edit mount options. Then we want to disable user session defaults and under the display name, you can give it whatever name you want to like disk1. After that under the mount point option change the default name to /media and slash the name whatever you have given it in the earlier part.
Now, guys, we don’t change anything else and hit ok. So if you do run into problems and it’s giving you a filesystem type error or something like that you might have to change the filesystem type field. Change it to ext4, NTFS or whatever filesystem type you are using. But most of the time we never run into any of those issues so it should work out of the box for you.
If you didn’t get any error then it should prompt you for your password go ahead and type that in and after that you good to go. Click on this play button in the disks option and type in your password. Once you successfully authenticate with your password at the bottom it should say it’s mounted under /media/data. Now open up your terminal and we will find what it did in the fstab. So all this was done automatically without any manual editing in fs tab.
So to open fstab type
sudo nano /etc/fstab and if ask for password enter your password.
Here you can use whatever text editor you want here we just gonna use nano. If you do all steps correctly you will see a new entry on the bottom of this last line. You can match it to your new mounted partition look at the UUID number it shows exactly the same as well as the name of given it was data. So pretty easy steps instead of you typing all those lines the gnome disk utility did everything for you. If you have found this tutorial useful let me know in the comments down below.