Mounting a disk persistently on your saltbox server¶
Perhaps you want to mount a disk partition persistently in the file system like a media drive at /mnt/local/Media or a fast SSD for Usenet at /mnt/local/downloads.
Now you need to edit the fstab file, which controls what gets mounted at system startup.
sudonano/etc/fstab
You want to add a line to the bottom of that file. Don't edit anything in the file already.
In my case, I want to mount that 12.7T partition at /mnt/hdd.
The line you need to add should look something like this (details may differ):
/dev/disk/by-uuid/9d4c3257-8e05-4228-b970-15ddbc99e86f /mnt/hdd ext4 defaults 0 2
| | └ format from blkid output
| └ directory where you want to mount this partition
└ UUID from blkid output
In my case, /etc/fstab starts looking like this:
/srv/git/saltbox$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/ubuntu-vg/lv-0 during curtin installation
/dev/disk/by-id/dm-uuid-LVM-087oBvV8gi2gDtJZBPmc0owcPXPdkpzTdwtdNt8jU3SNavox61p3nyq1gfaIRzz0 / ext4 defaults 0 1
# /boot was on /dev/nvme0n1p2 during curtin installation
/dev/disk/by-uuid/ecc24163-8465-4983-9676-7d85f9cdb31a /boot ext4 defaults 0 1
# /boot/efi was on /dev/nvme0n1p1 during curtin installation
/dev/disk/by-uuid/5524-9590 /boot/efi vfat defaults 0 1
/swap.img none swap sw 0 0
And I add one line at the end so it looks like this:
/srv/git/saltbox$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/ubuntu-vg/lv-0 during curtin installation
/dev/disk/by-id/dm-uuid-LVM-087oBvV8gi2gDtJZBPmc0owcPXPdkpzTdwtdNt8jU3SNavox61p3nyq1gfaIRzz0 / ext4 defaults 0 1
# /boot was on /dev/nvme0n1p2 during curtin installation
/dev/disk/by-uuid/ecc24163-8465-4983-9676-7d85f9cdb31a /boot ext4 defaults 0 1
# /boot/efi was on /dev/nvme0n1p1 during curtin installation
/dev/disk/by-uuid/5524-9590 /boot/efi vfat defaults 0 1
/swap.img none swap sw 0 0
/dev/disk/by-uuid/9d4c3257-8e05-4228-b970-15ddbc99e86f /mnt/hdd ext4 defaults 0 2
Then save the file.
Now go create the directory and set the ownership: