Sample mount units

Example mount units for systemd


Unit file names


Mount unit

  • Mount units must be named the mount point with the extension of .mount e.g. mountpoint /data/backup - unit file data-backup.mount

Automount unit

  • Automount units use the name of the mount unit but an extension of .automount e.g. data-backup.automount

Content of a mount unit


Depending on the Type, the What is different and so is the Options

  • What do you want to mount (disk, server, share)?

Where do you want it to mount (a path on your system)?

Which Type is your mount (filesystem, cifs, nfs)?

What Options should the mount use(rw, auto, netdev)?

Example

If you want to mount a Samba share named video provided by a local NAS named server

  • What is the name of server and the share e.g. //server/video
  • Where is the path where you can browse the data provided by the share e.g. /data/smb/video
  • Type will be cifs because that is what this type of connection is called
  • Options will instruct the system it is a net device _netdev, it should be possible to read and write rw, and connect using a specific workgroup, username and password.

AUTOMOUNT units


Same rule applies as for mount units. It must be the path to the mountpoint with the .automount extension e.g. data-backup.automount