[root tip] [How To] Use systemd to mount ANY device

Is it also able to mount smb Shares of a Synology NAS?

Systemd mounts anything - provided the right information and options.

I have several shares on Synology NAS - using mount and automount. Entering the mount point either by cli or gui mounts within seconds.

1 Like

getting this.:

● nas-home.mount - NAS SMB home share
     Loaded: bad-setting (Reason: Unit nas-home.mount has a bad unit file setting.)
     Active: inactive (dead)
      Where: /data/smb/home
       What: //<IP>/home/

Okt 13 19:52:00 Workstation systemd[1]: nas-home.mount: Where= setting doesn't match unit name. Refusing.
Okt 13 19:53:42 Workstation systemd[1]: nas-home.mount: Where= setting doesn't match unit name. Refusing.
Okt 13 19:53:45 Workstation systemd[1]: nas-home.mount: Where= setting doesn't match unit name. Refusing.
Okt 13 19:54:34 Workstation systemd[1]: nas-home.mount: Where= setting doesn't match unit name. Refusing.
Okt 13 19:54:36 Workstation systemd[1]: nas-home.mount: Where= setting doesn't match unit name. Refusing.
Okt 13 19:54:38 Workstation systemd[1]: nas-home.mount: Where= setting doesn't match unit name. Refusing.
Okt 13 19:55:06 Workstation systemd[1]: nas-home.mount: Where= setting doesn't match unit name. Refusing.
Okt 13 19:55:09 Workstation systemd[1]: nas-home.mount: Where= setting doesn't match unit name. Refusing.
Okt 13 19:55:11 Workstation systemd[1]: nas-home.mount: Where= setting doesn't match unit name. Refusing.
Okt 13 19:56:16 Workstation systemd[1]: nas-home.mount: Where= setting doesn't match unit name. Refusing.

Read the message - then read the rules on unit naming - also see the sample units

Even sshfs ? I am really looking forward to test this.

yup - also sshfs

2 Likes

wow this is great. :slightly_smiling_face:

Any idea if automount works under “–user” as well? Or it’s strictly privilege thing.

I’ve read something on fedora wiki that it might be set up under root which is sad as I can use Fuse to mount things without needing to modify the system.

I remember trying - but could not get it to work - probably my own fault - but not investigated further as my use is satisfied by the system mount.

You might add that you can generate the correct unit name using systemd-escape(1):

To generate the mount unit for a path:

$ systemd-escape -p --suffix=mount “/tmp/waldi/foobar/”
tmp-waldi-foobar.mount

Already mentioned

Ahh i didn’t notice, because it was hidden by this:

Maybe put the mentioning of it under the portion i quoted :arrow_heading_up: in the open :wink:

How about, once a device is set up (using gnome-disks or fstab) we simply

  1. copy the file from /run/systemd/generator to /etc/systemd/system/
  2. Hash # it from fstab, save/exit fstab
  3. systemd to enable?

I like easy shortcuts. Obviously the automatically generated file isn’t quite up to scratch… tidying up and editing now.

Initially, systemd didn’t like my file and politely declined. However, after a tidy up it seems to be fine - after a reboot, then deleting the hashed lines from fstab it’s automagic.

Thanks for the guide.

However, I did keep the /mnt/T3 and /mnt/T4 paths (as there’d be a few issues raised by changing the path) and I’m curious if there’s really any reason or benefit to create a new folder (/sata for example) to mount my whirly disks?

Well - it is not a problem - as long as you know what you are doing - and you appear to do so.

My recommendation on folder structure is what it is - a recommendation from a long time sysadmin - with autistic treats :slight_smile:.

You know the saying - only a genius can make reason out of chaos - just look at my desk - what a mess.

1 Like

Lolz but it’s a nice guide - no problems after setting up my systemd mounts, thanks for that :wink:

1 Like

2 posts were split to a new topic: Systemd mount unit error

6 posts were split to a new topic: Troubleshooting mount unit naming

A post was split to a new topic: Where do I start - it all seems difficult to learn

6 posts were split to a new topic: Mount unit failure after moving to ssd