Systemd on vivid beta

Tom H tomh0665 at gmail.com
Sun Mar 15 01:28:26 UTC 2015


On Sat, Mar 14, 2015 at 6:06 PM, Colin Law <clanlaw at gmail.com> wrote:
> On 14 March 2015 at 21:32, Tom H <tomh0665 at gmail.com> wrote:
>> On Sat, Mar 14, 2015 at 4:58 PM, Colin Law <clanlaw at gmail.com> wrote:
>>> On 14 March 2015 at 20:08, Tom H <tomh0665 at gmail.com> wrote:
>>>> ...
>>>> Should you want to switch to a .mount unit, I've set up the following
>>>> in a VM (192.168.1.11 is my laptop) and rebooted.
>>>>
>>>> <begin>
>>>> # systemctl cat home-th-srvtom.mount
>>>> # /etc/systemd/system/home-th-srvtom.mount
>>>> [Unit]
>>>> Before=remote-fs.target
>>>>
>>>> [Mount]
>>>> What=//192.168.1.11/srvtom
>>>> Where=/home/th/srvtom
>>>> Type=cifs
>>>> Options=credentials=/home/th/.cifscreds
>>>>
>>>> [Install]
>>>> WantedBy=multi-user.target
>>>>
>>>> # systemctl status home-th-srvtom.mount
>>>> ● home-th-srvtom.mount - /home/th/srvtom
>>>>    Loaded: loaded (/etc/systemd/system/home-th-srvtom.mount; enabled;
>>>> vendor preset: enabled)
>>>>    Active: active (mounted) since Sat 2015-03-14 15:56:47 EDT; 1min 47s ago
>>>>     Where: /home/th/srvtom
>>>>      What: //192.168.1.11/srvtom
>>>>   Process: 554 ExecMount=/bin/mount //192.168.1.11/srvtom
>>>> /home/th/srvtom -n -t cifs -o credentials=/home/th/.cifscreds
>>>> (code=exited, status=0/SUCCESS)
>>>>
>>>> Mar 14 15:56:47 localhost systemd[1]: Mounting /home/th/srvtom...
>>>> Mar 14 15:56:47 localhost systemd[1]: Mounted /home/th/srvtom.
>>>> </end>
>>>
>>> Thanks Tom.
>>> Will that automatically mount/unmount if the server comes and goes?
>>
>> Yes. With ifupdown and NM. I haven't tested it with networkd but I
>> assume that it'll be ordered properly with it too.
>
> I will have to give that a go. Though my script is now working fine
> as I don't generally use wifi on this machine. Simpler for the future
> than messing about with scripts though.
>
> Thanks

You're welcome.

It's simpler with .mount units. The example above is my first cifs one
but we've got many nfs mounts running in our RHEL 7 dev environment. I
haven't been involved in the testing but the guys who are runnning the
tests are happy. I've used them at home and in a few moonlighting jobs
and I'm happy.

systemd isn't as simple as it was originally meant to be (witness your
dependency problems in this thread) but it does provide new and
interesting interfaces to get things done, no matter what people
think, rightly or wrongly, of the project overall.




More information about the ubuntu-users mailing list