[systemd-devel] Mount files in systemd

Lennart Poettering lennart at poettering.net
Mon May 21 08:50:03 PDT 2012


On Thu, 17.05.12 19:54, g4hx (g4hx at gmx.de) wrote:

Heya,

> I have been using systemd for a while now, and I have to say that I am
> quite impressed by the noticeable speed up during boot. However, I have
> some question about systemd that are yet unanswered. I did not find the
> reuqired information elsewhere, so now I am asking directly:
> 
> How do I include lvm2 based partitions in a technically clean and
> correct way? Up to now I used the lvm.service file to call lvm2 and a
> .mount file for each mount:

Well, there isn't really a clean and technically correct way to activate
LVM, simply because it's not written the way modern OS technology should
work: i.e. listen to hotplug events and assemble storage as it
appears. 

The way we hooked this up in Fedora is via a script called fedora-storage.init:

http://git.fedorahosted.org/git/?p=initscripts.git;a=blob;f=systemd/fedora-storage-init

This is pulled in twice to work around the limitation that LVM can't
react on devices showing up. It's pulled in once via
http://git.fedorahosted.org/git/?p=initscripts.git;a=blob;f=systemd/system/fedora-storage-init.service
and once via
http://git.fedorahosted.org/git/?p=initscripts.git;a=blob;f=systemd/system/fedora-storage-init-late.service

To work somewhat reliable you also need to pull in udev-settle.service
and a brokeness called scsi-wait-scan:

http://git.fedorahosted.org/git/?p=initscripts.git;a=blob;f=systemd/system/fedora-wait-storage.service

Both of those substantially slow down your boot (without actually really
fixing the bug, just working around it sufficiently well for most cases,
by slowing things down and hoping).

As long as LVM isn't fixed to actually assemble devices as their
components appear I cannot really recommend anybody to use it. It's a
major source of slowness, and does not work how things should work these days.

> Another thing I noticed is that systemd parses "/etc/crypttab", but the
> expected syntax does not follow the syntax expected by my distribution:
> 
> https://wiki.archlinux.org/index.php/System_Encryption_with_LUKS#.2Fetc.2Fcrypttab

Ummm, it's a pity that your distribution's crypttab syntax deviates from
what everybody else is doing. But given that ArchLinux is the exception
here, and not the rule I guess you have to live with this.

> I looked over the source code of systemd-cryptsetup-generator to gain
> some idea about how the parsing is done and managed to adjust my
> "/etc/cryptsetup", but I would appreciate it if you could send me a link
> to the file type documentation.

We mostly implement what Fedora's and Debian's crypttab format support.

http://git.fedorahosted.org/git/?p=initscripts.git;a=blob;f=crypttab.5

There are some additions though, and there are a couple of options from
Debian missing. It has been on the TODO list for a while to fully
document our format in a man page.

> In general, if I have units depending on device files, should I include
> the dependency as one to a device file or to the service that creates
> it? Also, should I still use "/etc/fstab" or should I abandon it
> entirely in favor of .mount files?

For 99% of all people /etc/fstab is sufficient and what should be used.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list