[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

"btrsquash" images (dracut dmsquash-live + btrfs-in-squashfs runtime)

Hey all,

Here's a first attempt at the "compressed anaconda runtime" patch I've
been messing with for a while now. Consider it a Request For Comment, or
a simple Proof-of-Concept patch. 

 src/pylorax/__init__.py    |   11 +++-
 src/pylorax/constants.py   |    2 +
 src/pylorax/installtree.py |  133 ++++++++++++++++++++++++++++++++++++++++----
 3 files changed, 133 insertions(+), 13 deletions(-)

The problem I was trying to solve is this: our initrd.img is ~360MB
uncompressed in RAM. This means we can no longer boot and run on systems with
512MB RAM; see bug 682555 (and its various duplicates) for example reports.

Idea #1: Let's use squashfs!

The main problem with this is that squashfs is read-only, and anaconda
(specifically loader) will crash and burn if it can't write to various parts
of its root filesystem - /etc, /var, /tmp, and possibly others.

(We could probably fix this with some effort - especially once we've gotten
rid of anaconda-init and loader - but I needed a low-effort proof of concept

Idea #2: Our Live images are compressed with squashfs, and they use a
device-mapper overlay to make themselves read-write - so let's do that!

This is basically what the patch does: it builds the anaconda runtime image
into something very similar to the Live image, and uses the same dracut
startup scripts as the Live images to get itself set up and running.

Here's how the btrsquash initrd build process works:

- populate installtree as usual
- chroot into install tree and create dracut initramfs
- clean installtree as usual (note: this removes dracut)
- [other normal lorax steps...]
- create initrd
  - create empty btrfs image "LiveOS/rootfs.img" and mount it
  - copy installtree into rootfs
  - unmount rootfs
  - make squashfs.img with "LiveOS/rootfs.img" inside
  - place squashfs.img in a cpio archive with "/etc/cmdline"
    - /etc/cmdline tells dracut where to find squashfs.img
  - concatenate dracut initramfs and squashfs.cpio

As noted in the bug report, this does require some changes to anaconda and
dracut. The relevant changes are:

anaconda: dac6c6ec 6f4a1a3b (should be in anaconda-16.2 or 16.3)
dracut: up to fe17f4e8 (should be in dracut-009)

I've tested the resulting images in KVM - systems with 512MB RAM happily
boot, run and install. See the following screenshot, taken just after the
betanag screen in anaconda:

There are a couple of known problems: first, the dracut initramfs will only
contain the modules for one kernel - we need to run dracut once for each
kernel and merge all the images together. Second, the resulting image is
~132MB, which is still too big for PPC netboot. Finally, I'm not sure how this
will affect driver disks or updates images or other weird things that might
involve writing to the initramfs.

Keep in mind that the image is actually two parts again - initramfs and
squashfs. If we keep those parts separate, PPC users could use dracut's
networking stuff to fetch the runtime image. We can also save RAM on media
installs (and boot.iso and USB-based installs) by leaving the squashfs image
on the media. And for every other case, we can just use the concatenated Big
Image like are now.

So there we have it. Feedback welcomed. If we come up with a good plan for
how to handle compressed images in the future I'll try to port this to
lorax master. 

Oh, one last thing - I have some scripts to convert current, existing images
into working btrsquash-style images. I might put those somewhere public
if people are interested, but they're pretty hacky..


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]