|Sometimes we need a partition se mount automatically when the system is being raised. The correct way to solve this problem is to use the file fstab located in / etc / fstab.|
It is necessary to have a small definition of some concepts before starting:
FileSystem: All physical media that can store files must have a filesystem to be able to fulfill this function (example: a partition of a hard disk). A filesystem is a system used to organize files on said storage medium, but we could see it as the storage medium itself (at the user level). It is necessary to clarify that this is not a formal definition, but it will bring us closer to the concept ...
Filesystem type: As we have seen, a filesystem is an organization system and it is reasonable that there are several different systems to organize files, each one with its pros and cons. For example: FAT, NTFS, EXT2, EXT3, EXT4, etc.
Mounting point: The mount point is a folder or directory. After mounting the filesystem in said directory we will be able to access the files through it (directory).
Mounting options: They allow you to specify certain parameters so that when the filesystem is mounted it is done in a special way, for example: ro (read-only) this means that files cannot be created, modified or deleted in that filesystem. Another example: errors = remount-ro (remount as read-only) in case of some serious error, the filesystem is mounted in read-only mode.
dump: Dump is a backup tool and I'm just going to mention it because I still don't understand it completely, and I also don't want you to spend all day thinking what this will be. When the number in this column is 0 (zero), dump will ignore that filesystem.
passport: We will start by explaining what fschk is. fschk is a tool to check filesystems for errors, etc. This is another column that I just want to name for the same reason as the one above. When the number in this column is 0 (zero), fschk will ignore that filesystem.
In case you want to continue deepening your knowledge of fstab, you may be interested in reading these old items from the blog.
Working with the fstab file
First we will see the structure of this file:
In this file, each line refers to a file system (filesystem) and each line respects the following structure:
Let's look at an example:
UUID = d4f1ec7e-f3d3-4bd4-becf-4f6da208237f / ext3 errors = remount-ro 0 1 / dev / sda5 / home ext3 defaults 0 2
How to get the correct UUID for each partition?
For this they must execute as root (or using sudo as in the example) the following line:
And we will see something like this:
/dev/sda1: UUID="B6F0C97EF0C94579" TYPE="ntfs" /dev/sda5: UUID="d4f1ec7e-f3d3-4bd4-becf-4f6da208237f" TYPE="ext3" /dev/sda6: UUID="b8146e8f-77aa-44b8-9b37-5a2a90706eea" TYPE="ext3" /dev/sda7: UUID="57cfda85-b5ce-4288-b42e-c19dc57a65d9" TYPE="swap"/dev/sdb1: LABEL="Backup" UUID="5D9A907246C7446B" TYPE="ntfs"
You just have to send us a mail including the trick or mini-tutorial of your own.