Using a fstab
file we can mounting and linking an extra partition in an elegant way. To adding the partition on fstab
file, you need to find the correct UUID from the partition you want to add.
List the by-uuid file for finding out:
$ ls -lh /dev/disk/by-uuid
lrwxrwxrwx 1 root root 842db29e-56d8-4ccf-b857-44e039bb065f -> ../../sda1
lrwxrwxrwx 1 root root f57a0952-0a96-4140-8aa1-b2df924e3389 -> ../../sdb1
Now, I know the right UUID: the second in the list (sdb1). Edit fstab file:
$ sudo vim /etc/fstab
UUID=f57a0952-0a96-4140-8aa1-b2df924e3389 /media/extra ext4 defaults 0 2
This will automount the partition in the location /media/extra
, using the default options. Don't forget to create this directory and set the right permissions for your user:
$ mkdir /media/extra
$ chown -R USER.GROUP /media/extra
Then, to test your settings, run:
$ sudo mount -a