[systemd-devel] macros in systemd unit files question

Colin Guthrie gmane at colin.guthr.ie
Thu Aug 1 04:15:21 PDT 2013


'Twas brillig, and lux-integ at 01/08/13 11:53 did gyre and gimble:
> On Wednesday 31 July 2013 14:36:25 Colin Guthrie wrote:
>> Mount units have to be named specially after their mount points, so be
>> careful there e.g. if the mount point is /mnt/mymountpoint then the unit
>> should be called mnt-mymountpoint.mount
> 
> thanks for your reply
> 
> Now I have an init script to  translate to systemd with this:-
> /bin/echo  "Remounting root file system in read-write mode..."
> /bin/mount -n -o remount,rw / >/dev/null
> 
> 
> which I translate to systemd-speak ( mount file ) as 
> #------------------------
> [Unit]
> Description=Remounting root file system in read-write mode...
> #After=dev.mount
> #Before=
> 
> 
> [Mount]
> What=/
> Where=/
> Options=remount,rw
> #-----------------

You generally wouldn't set the description in such a mount unit "Remount
root file...". Just use "Description=Root Filesystem" or similar. The
mount options themselves are an implementation detail.

> what do I call this file?
> rootfs.mount ?
> (and if so would it not contradict with the What and Where in [Mount] ?

The rootfs mount is called -.mount (i.e. a leading -)

To be honest with you tho', unless you are tailoring your system for a
very specific case and disabling support for /etc/fstab completely, I'd
just specify your mount options in /etc/fstab as before and systemd will
just interpret it and generate your mount units for you. You don't need
to do anything special to get your mount options applied as systemd will
do that for you.

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the systemd-devel mailing list