Gentoo Archives: gentoo-user

From: "Canek Peláez Valdés" <caneko@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] systemd and initramfs
Date: Wed, 21 Aug 2013 01:14:01
Message-Id: CADPrc82weH06Lm88w885j1F7sCNkQV9d5fvKiz45mHTgPx=bcA@mail.gmail.com
In Reply to: Re: [gentoo-user] systemd and initramfs by Walter Dnes
1 On Tue, Aug 20, 2013 at 7:32 PM, Walter Dnes <waltdnes@××××××××.org> wrote:
2 > On Tue, Aug 20, 2013 at 01:54:26AM -0500, Canek Peláez Valdés wrote
3 >>
4 >> No, the kernel has a mini filesystem (doesn't matter which directory
5 >> structure has inside), and it executes the init script (or binary
6 >> program) in the root of the initramfs. This init program/script is the
7 >> responsible for mounting the real root and other partitions, and
8 >> handling control over to systemd (or OpenRC, or whatever).
9 >>
10 >> Dracut is able to create an initramfs (with the systemd Dracut module)
11 >> that executes systemd inside the initramfs, which mounts /usr,
12 >> switches to the real root, and gives control to the "real" systemd
13 >> instance. At shutdown, the reverse happens: the "real" systemd
14 >> surrenders control to the initramfs systemd, it umounts everything,
15 >> and finish the shutdow process.
16 >
17 > A possibly stupid question from a non-user of initramfs... why not
18 > simply treat the initramfs as "the real system"? This would avoid the
19 > hand-off to a second fs at start-up, and the reverse process at
20 > shutdown.
21
22 If I understand correctly, because it's a ramfs, as its name implies
23 (it lives on your RAM). You don't want it to hold all your system,
24 only the necessary parts to mount the filesystems necessary to boot.
25
26 > There would be no need to worry about keeping files synced in
27 > 2 different locations, because there would only be one location.
28
29 The worry about falling out of sync, although justified, I think it's
30 a little overreacted; even for things like LVM2 and NFS, how many
31 times changes the metadata or format used by different versions?
32 Normal filesystems present no problems: almost all of them are
33 future-proof.
34
35 And (as Allan suggested) you can (easily and automagically) regenerate
36 the initramfs everytime sometimes inside it changes.
37
38 > If
39 > necessary, one could use UnionFS http://en.wikipedia.org/wiki/Unionfs to
40 > make the hard drive and userspace stuff all look like part of the
41 > initramfs.
42
43 No unionfs has been accepted in the mainline kernel, although several
44 have been proposed. It's a hard problem, and nothing has satisfied the
45 kernel devs until now.
46
47 The initramfs has several advantages: it's supported directly by the
48 kernel, it works the same from embedded systems to big iron servers,
49 and it just works.
50
51 I just installed two systems (a server and a desktop) to systemd
52 directly, and Dracut just worked. And I like that now my kernels have
53 *EVERYTHING* as a module (that can be compiled as module). Even the
54 filesystems!
55
56 Regards.
57 --
58 Canek Peláez Valdés
59 Posgrado en Ciencia e Ingeniería de la Computación
60 Universidad Nacional Autónoma de México

Replies

Subject Author
Re: [gentoo-user] systemd and initramfs thegeezer <thegeezer@×××××××××.net>