I use the below six step procedure to mount my usb thumb drive at startup. It works fine, until it stops working for no apparent reason. When it fails, attempts to mount the drive with Disks eventually are successful, but it takes a long time before it mounts.
I've tried adding the drive to the /etc/fstab file, but I was having trouble with that, so I went to this startup alternative. I don't recall what the problem was with the fstab.
This procedure works for days and days, but then for some reason it just doesn't work anymore. Where can I find evidence for such a failure? Is there a log I can look at? Should I be rebooting my operating system more frequently? Sometimes I don't reboot for many days.
This thumb drive is used for Back-In-Time scheduled backups, which run daily in the middle of the night. Sometimes the backup runs and then at some point after gets "unmounted." Sometimes the backup doesn't run because the drive was already "unmounted."
What could be causing such behavior? Why does the drive all of a sudden get into a state where it will mount but only after a long time? The drive is fairly new.
1. create script and make it executable... save in /usr/bin
Code:
/usr/bin/mounter.sh:
#!/bin/bash
mount /dev/sdb1 /media/root/0cf08a6e-ba27-4c52-8681-4e5819c60f84
2. save the following in /etc/systemd/system/mounter.service
Code:
[Unit]
Description=Example systemd service.
[Service]
Type=simple
ExecStart=/bin/bash /usr/bin/mounter.sh
[Install]
WantedBy=multi-user.target
3. make number 2. executable...
Code:
sudo chmod 644 /etc/systemd/system/mounter.service
4. start the service..
Code:
sudo systemctl start mounter
5. check status of service...
Code:
sudo systemctl status mounter
6. enable service for startup...
Code:
sudo systemctl enable mounter