Categories :

Network Drive mapping using systemd

Last Updated on 30/12/2023 by Kevin Agar

To configure systemd to automatically mount a network folder on boot, you need 2 files

mnt-pibackups.mount # The .mount file specifies how to mount a drive

mnt-pibackups.automount. #The .automount file specifies what to mount automatically on boot

For example, to mount in /home/user/myfolder the file names must be home-user-myfolder.(auto)mount.

The content of the .mount file is:

The content of the .automount file is:

Then, reload the units to ensure everything is to its latest version:

At this point, you should be able to manually mount and unmount the remote folder using systemctl:

This will not, however, automatically mount the system at startup. To do so, just enable the automount

Leave a Reply

Your email address will not be published. Required fields are marked *