When your system uses more than one partition (excluding swap partition) it is desired to have them mounted at startup. For example, assume that you have two data partitions: one for the operating system with the root mount point / while the other for personal data with mount point of /home. You could configure these options when installing Linux, but what if you want to do it after installations are already complete? Well, here is how you can do this!
The file system table file /etc/fstab contains all the necessary configuration for mounting partitions at startup. Let's take a look at this file
$ vim /etc/fstab
The main ingredient of the file is organized as follows
1. <file sytem> can be either UUID or device path such as /dev/sda1. For robustness, UUID may be used. In order to find out UUID of your partitions, run
$ ls -l /dev/disk/by-uuid
2. <mount point> is where you would like to mount it as. The root partition will be / whereas user data partition could be /home.
3. <type> is the format of the partition, such as ext3, ext4, fat, ntfs, swap, etc
4. <options> specifies the mount options list separated by commas. For example, the system partition may be optioned with errors=remount-ro option, while default option is indicated as defaults. A swap partition can be specified with sw.
5. <dump> specifies whether to backup or not. Unless you know what you are doing, leave this as 0.
6. <pass> specifies disk check option. For root partition, leave this as 1. For other data partitions, leave this as 2. For partitions that do not require check, such as swap partition, leave this as 0.
With these in mid, you may want to first create a backup file,
$ sudo cp /etc/fstab /etc/fstab.bk
edit the file,
$ sudo vim /etc/fstab
and reboot for the system to take effect.
$ sudo reboot
A system-default entry would look like the following:
UUID=xxxxx-xxxxx-xxx-xx-xxxxx /home ext4 defaults 0 2
For more info, please refer to https://help.ubuntu.com/community/AutomaticallyMountPartitions
No comments:
Post a Comment