Auto mounting of a share fails on boot?

Hi All

My first post but I’ve haunted for a while. I now have x10 Pis doing various things around the place, some in different states of development, and all but two run DietPi. Time to donate, perhaps?

Anyways, my problem is that I have one RPi4 sharing a hard drive that is USB-attached for storing CCTV captures generated using MotionEye, and a second RPi4 on which I am also running MotionEye that should connect to the first using Samba so that all media files created by either Pi are on the same hard drive. The idea is that, with x5 IP cameras, I need to load-balance across Pis, so the first manages x2 cams, and runs Samba, and the second manages x3 cams.

I have successfully created a Samba share on the first and it is available and mountable after reboot from either the second Pi or my MacBook.

I can mount the share manually. However, I can’t seem to get the share to auto-mount after rebooting and can’t fathom why.

I have checked /etc/fstab and the entry for my Rpi server is there but on reboot it isn’t mounted. If I do ‘mount -a’ then it is mounted; I check using ‘df -h’. Just not after reboot.

Is there another config file I should edit? A log file I can inspect (I’m not sure where to look)

Any ideas welcome :slight_smile:

You definitely shouldn’t have to edit any other file except fstab. What type of drive is it? i.e. what is it formatted as? Are you sure that your fstab entry is correctly formatted?

I recently started having issues with mounting myself actually. Funny it was fine when using exfat but as soon as I formatted to ext4, I couldn’t get write access to the mounted partition in samba no matter what I did. I tried all manner of entries in samba and fstab. Nothing made the drive writeable so I reverted back to exfat.

journalctl -u mnt-point.mount
journalctl -u mnt-point.automount
Could be used to check mount logs for a drive with /mnt/point as mount point.
Otherwise journalctl itself going through boot messages and the parts where external drives should be mounted, might give a hint.

What is a bid strange is that even dietpi-boot calls mount -a after network wait loop (if enabled) :thinking:.

About ext4 + samba it should be definitely a permissions issue. The samba user requires R/W access while by default drives are mounted with root:root 755 permissions which means only root user has write permissions to the drives root dir. This could be adjusted by fstab entry or better you create a sub dir, run chmod -R 777 on it and share/mount this via Samba to rule out any permission issues. But all this is only relevant server-side. Samba does not transfer unix permission, so client-side it is only a question of the mount options.

I’m having troubles with Samba shares not mounting on boot with a new RPi4 also. The same setup was working perfectly on a RPi3.

I have three Samba shares setup, and on reboot they’re still listed in /etc/fstab, but the first Samba share listed doesn’t mount or appear in DietPi-Drive_Manager until running the refresh option.

Update: I’ve added x-systemd.automount to each Samba mount in /etc/fstab which appears to solve this issue, as noted here:

Note: If you’re on Buster, you’ll need to add the option x-systemd.automount to mount the share on startup.