USB auto mount on reboot

This forum is for discussion about general software issues.

USB auto mount on reboot

Postby HydroDiOxide » Thu Mar 26, 2020 8:21 am

Hi,

I've got a Pi2 running headless with a usb thumbdrive attached for some extra storage. Every now and then I reboot the Pi, mainly after updating. I've created a systemd mount file for the USB drive, but somehow I always have to mount the drive manually on reboot. I think it wasn't like this a while back, but I'm not sure. The .mount file is as follows:

Code: Select all
[Unit]
Description=Mount USB at boot

[Mount]
What=/dev/sda1
Where=/mnt/LOCATION
Options=nofail
Type=ntfs-3g
TimeoutSec=45

[Install]
WantedBy=multi-user.target


Any clue on why the drive isn't mounting automatically on a reboot?
HydroDiOxide
 
Posts: 11
Joined: Mon Apr 23, 2018 1:29 pm

Re: USB auto mount on reboot

Postby ufo6000 » Thu Mar 26, 2020 3:34 pm

Why not fstab ?

to your xyz.mount:
after a reboot, and it has failed, check the status and post it here:

sudo systemctl status xyz.mount
and/or
sudo journalctl -u xyz.mount
ufo6000
 
Posts: 48
Joined: Fri Jan 22, 2016 7:54 pm

Re: USB auto mount on reboot

Postby HydroDiOxide » Sat Mar 28, 2020 11:20 am

Hey. Thanks.

I thought keeping things in one place would be good, so that's why I chose systemd and not fstab. Is fstab more stable?

The behaviour seems to be rather intermittent now. I tried rebooting under different circumstances (with and without other windows shares available) and the USB drives seems to come up fine. I'll report back when it goes sideways again.
HydroDiOxide
 
Posts: 11
Joined: Mon Apr 23, 2018 1:29 pm

Re: USB auto mount on reboot

Postby ufo6000 » Sat Mar 28, 2020 11:35 am

fstab is more common and well known, but if you are familiar with systemd a mount unit is fine too. Please use what you are feeling better with :-)

HydroDiOxide wrote: rather intermittent now


Could be a "dirty" volume, e.g. when windows or linux forget to perform a clean umount.
In case of the next issue please post the dmesg output too.
ufo6000
 
Posts: 48
Joined: Fri Jan 22, 2016 7:54 pm


Return to General

Who is online

Users browsing this forum: No registered users and 3 guests

cron