In preparation for the Amiga37 event held this October in Germany, I wanted to bring a few Raspberry Pi 4s to show off the Lightwave renderfarm project running. The guide I wrote on the subject (see previous posts in this blog) is still valid, however I noticed that autofs doesn’t quite work on the Manjaro Linux distro I wanted to use for the RPIs (it still works on the 32-bit RPI-OS). So I had to find another solution to do the automount of the samba shares, and fast.
The best solution I could find, was using systemd itself to do the job. This guaranteed that it would work on all distros, and it’s relatively simple to do also. Perhaps even simpler than my previous attempt!
The full documentation on how this is done (on Manjaro specifically) is here: [HowTo] Automount ANY device using systemd – Technical Issues and Assistance / Tutorials – Manjaro Linux Forum. The short version follows below.
The assumption here is that we have a samba server already configured (let’s call our server “pi400
” for now), and the share name is “public
“. The samba clients (or our rendernodes) will have to mount this share locally, in a directory. I used the path “/mnt/projects
” for this purpose, on each machine. Feel free to adjust names and paths accordingly, of course.
First off, we’ll need to create a new .mount
text file, named after the location the mount will happen. In my case, that filename should be: mnt-projects.mount
(dashes represent directories). We’ll have to place this file under /etc/systemd/system/
, so we can do something like:
sudo nano /etc/systemd/system/mnt-projects.mount
Here are the contents (I’ve taken out the username/password pieces of course, use your own accordingly):
[Unit]
Description=Pi400 SMB share
After=network.target[Mount]
What=//pi400/public
Where=/mnt/projects
Type=cifs
Options=_netdev,iocharset=utf8,rw,file_mode=0777,dir_mode=0777,user=<username>,password=<password>,workgroup=WORKGROUP
TimeoutSec=30[Install]
WantedBy=multi-user.target
Save this file and then create a new one (also in the same location). This one will be an .automount
file, also named the same way (so in my case, mnt-projects.automount
):
[Unit]
Description=Automount Pi400 share
ConditionPathExists=/mnt/projects[Automount]
Where=/mnt/projects
TimeoutIdleSec=10[Install]
WantedBy=multi-user.target
Again, adjust your paths as necessary!
After you’ve placed both of the above files in the same location (/etc/systemd/system/
), all that’s left if you want this to automount on startup, is to enable that:
sudo systemctl enable --now mnt-projects.automount
After you reboot, the share will be automatically mounted when you first access it. It may take a while the first time, so you’ll see a little delay. But it should work! And make sure you read on the documentation to better understand how this works, and how to tune it to your needs. Have fun!