Convert an fstab entry to a systemd mount unit on CoreOS

hydrajump asked:

I want to convert the following fstab entry to a systemd mount unit on CoreOS,

/dev/xvdb /data ext4 defaults,auto,noatime,noexec 0 0

I created data.mount,

[Unit]
Description=MongoDB Data Directory

[Mount]
What=/dev/xvdb
Where=/data
Type=ext4
Options=defaults,auto,noatime,noexec 0 0

However, I had to remove 0 0 because the unit failed to start.

[Unit]
Description=MongoDB Data Directory

[Mount]
What=/dev/xvdb
Where=/data
Type=ext4
Options=defaults,auto,noatime,noexec

The unit above starts, but I’m not sure about the Options= string. Reading about the fstab options I wonder if some are redundant.

According to Ubuntu Fstab – Community Help Wiki

auto – The filesystem can be mounted automatically (at bootup, or when
mount is passed the -a option). This is really unnecessary as this is
the default action of mount -a anyway.

defaults – Use default settings. Equivalent to rw, suid, dev, exec,
auto, nouser, async.

This leads me to the following unit,

[Unit]
Description=MongoDB Data Directory

[Mount]
What=/dev/xvdb
Where=/data
Type=ext4
Options=defaults,noatime,noexec

Is this the proper way to create a mount unit using systemd on CoreOS?

My answer:


defaults is redundant. When any other options are in use, it can be omitted. It only exists to fill the relevant column in fstab.

And since auto is already a default, it too is redundant.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.