About Me

header ads

Ubuntu: how to automatically mount a Hard Disk at startup

I do not know how many times I will ever receive requests such as "Hello, how can I automatically mount a hard disk at startup Ubuntu?". Finally I managed to find some 'time to write this article I will show you the steps necessary to ensure that, in a completely automatic, power of your Ubuntu are also mounted the Hard Disk or Hard Disk you need. We start with a first method ,Longer and more cumbersome, but you will have full control of what you are doing. Open the terminal and type:
sudo mkdir /media/personalnamedirectory
Of course replace "personalnamedirectory" With a name to your liking. With this command we are not doing is create a directory under /media where we set up our hard drive. Now comes the slightly more difficult to know the name of your HD (/dev/sda2 /dev/sda3 and so on). To do this you can type the command in terminal:
sudo fdisk -l
or the command:
df -h
Now we must edit the fstab file is a configuration file used to indicate how many and which driver to load at system startup, with the respective options. Enter, therefore, the following command:
sudo gedit /etc/fstab
and, at the end of the file, add:
/dev/sda3 /media/personalnamedirectory ntfs auto,rw,exec,users,dmask=000,fmask=111,nls=utf8 0 0
As you can see it, in this case, a HD with NTFS File System. To check that the HD is really mounted, type:
sudo mount -a
Another effective method, And very fast, is to create a small startup script. Type:
gedit ~/mount.sh
and paste the following code:
#!/bin/sh
gvfs-mount -d /dev/sdaX
Where, of course, instead of sdaX you have to put the id of your HD. Now granted permission to execute this script:
chmod +x ~/mount.sh
And add it to "Applications startup" Of Ubuntu. All very simple, do not you think?

Post a Comment

0 Comments