How to Add Links to Other Hard Drives in the File Manager
By default, other hard drives/disks on your computer get listed in the File Manager by their names, and they are not mounted. You have to click on them to mount the drive and then explore their files.
For frequently accessed drives, it’s better to automatically mount them on system boot and create names for them in the Home directory using symbolic links. You may also create symbolic links to folders within these disks. Then it is easy to reference these locations as if they are part of your home directory.
How to automatically mount hard disks on system boot
For this, we will add entries to the /etc/fstab
file. We will specify mappings of hard disks to mount points in the file system.
First off, we want to identify the universally unique identifier values for our hard disks by running the blkid
command in the terminal. Stretch the terminal window out wide so that each line of text is easy to read.
It will display lines like:
/dev/sda2: BLOCK_SIZE="512" UUID="D41A9F4A1A9F290E" TYPE="ntfs" PARTUUID="0c521437-02"
In my case, /dev/sda2
is a partition on my PC containing Windows and I want to use a directory on it to store data, even for use on Linux. The UUID
value is what we will use next.
To correlate what drives are associated with the dev IDs, we may run the lsblk
command.
Now, to map this Windows drive to a mount point on Linux, I will add a line to the /etc/fstab
file as follows:
UUID=D41A9F4A1A9F290E /mnt/windows ntfs defaults,noatime
I called my mount point windows and specified the type of file system that it uses (ntfs).
We need SU privileges to edit this file, so I used: sudo nano /etc/fstab
to fire up the text editor.
The column headings in the file show that these entries correspond to:
<file system> <mount point> <type> <options>
Save the file, and reboot the computer. Then this drive will be accessible at the mount point in the file system.
Now we are able to create a symbolic link to it in the File Manager or from the command line of the terminal (I prefer this method).
To create the link:
ln -s /mnt/windows ~/Windows
Then a folder appears in your home directory called Windows
with a small annotation to indicate that it is a link.
You may delete this link with rm ~/Windows
.
But, my purpose was to use a folder on this drive to store data. So I would make a symbolic link to this folder such as:
ln -s /mnt/windows/wdata ~/WData
So now this location is simply accessed via scripts or from the command line with the path of ~/WData
.
Summary
We set up auto-mounting of hard disks on our Linux system and were able to add a folder entry to our home directory that makes it seem like just another folder that is available to us with an appropriate name.