Systemd mount volume at boot
Since fstab (even with <em>nofail</em>
option enabled) doesn’t seem to behave too good when trying to mount at boot something that isn’t actually plugged in (like an USB HDD) I realized it was a good idea to write a small script to run at startup which will be able to handle the situation a bit better.
Arch Linux uses Systemd and even though a rc.local file can be created I decided to take the opportunity to understand a little bit of how it works and write a mount script for it.
Following what’s written here it seems pretty easy, just write a text file and put it in <em>/etc/systemd/system</em>
:
[root@k*** ~]# cd /etc/systemd/system
[root@k*** system]# vi mnt-wd2tb.mount
[Unit]
Description = Mount USB 2 TB HDD
[Mount]
What = UUID=d4634c04-***
Where = /mnt/wd2tb
Type = ext4
[Install]
WantedBy = multi-user.target
UUID can be found with the utilitiy blkid:
[root@k* system]# blkid /dev/sda1
/dev/sda1: UUID="d4634c04-***" TYPE="ext4" PARTUUID="***"
The utility systemctl can be used to manage the script as any other service.