One of the things that many users want to do is automatically mount a partition automatically. In other words, suppose we have a part of the hard disk (100GB for example) in a different partition, a partition that we use to store our things, or play games on Windows.
How to do so that we can automatically access this partition from Linux?
There are several ways, but in this post I will show you the most common, using / etc / fstab
The / etc / fstab file is useful for many things, but ... let's focus on what we are dealing with now 😉
Suppose we have a partition called "Windows" (without the quotation marks), and we want that whenever we start the computer, this partition is accessible, that is, that it is mounted. For it …
1. We must first create a folder in /half/, for example: / media / windows To do this, open a terminal and put the following in it:
sudo mkdir /media/windows
2. Ready, now we must find out exactly what partition we want to mount, that is, its real location. To do this in the terminal write the following:
sudo fdisk -l | grep NTFS
3. It should appear something like this:
/ Dev / sda1 63 40965749 20482843+ 7 HPFS / NTFS / exFAT
I detail in bold what we need from that line, which is just the first thing in the line, in the example: / Dev / sda1
In fact ... here is the line that would show you just that:
sudo fdisk -l | grep NTFS | cut -d" " -f1
Well ... the point is that we remember VERY WELL what we need from that line.
4. So far we have to want to mount (following this example) the / dev / sda1 partition in the folder that we created at the beginning, / media / windows / ... for this in a terminal let's put:
sudo echo "/dev/sda1 /media/windows ntfs-3g auto,rw,users,umask=000 0 0" >> /etc/fstab
What it will do is write the instruction in / etc / fstab so that when the system starts it will automatically mount the partition.
Restart the computer and you should mount the partition as desired.