initramfs support

Bryan Kadzban bryan at
Thu Jul 5 08:07:25 PDT 2007

Hash: RIPEMD160

Alexander E. Patrakov wrote:
> Create filesystems on /dev/hda1, /dev/myvg/{root,home}, mount them,
> transfer LFS there. Swap on LVM should also work out of the box.

I created LVM on /dev/mapper/hpt*2, leaving /dev/mapper/hpt*1 as /boot.
I then created root and swap LVs on the VG.

> Install GRUB as you would normally do.

I had some issues with the grub shell's "setup" -- it got stuck in some
kind of long (or infinite) loop.  Ctrl+C interrupted grub inside the VM,
though, so I don't think it was an issue with qemu.  OTOH, restarting
qemu with kqemu loaded fixed it.  I don't know if just restarting the
qemu process was the ultimate fix, or if kqemu was.

Anyway, whatever.  It got installed successfully, and required changes
to the initramfs have been checked in.

> In initramfs and bootscripts, do (just after dmraid, or, if there is
> no dmraid, just after udev):
> vgchange -ay --ignorelockingfailure # in both places, just in case 
> vgmknodes                           # only in bootscripts

I also needed an --ignorelockingfailures on the vgmknodes in the bootscript.

> Some distributions attempt to deactivate LVM and dmraid in their
> shutdown sequence with the following commands:
> vgchange -an --ignorelockingfailure
> dmraid -an -i

Is there any downside that you know of if they don't get deactivated?
If not, it's simpler to leave them up.

> Things become a bit more complicated if there is no /boot partition.

I'd be happy with requiring a /boot partition, but I'm not sure about
the users.  For the first version, anyway (or until grub supports LVM,
if it ever will).

> BTW, "LVM on /dev/mapper/hpt*" is also a valid setup - please make
> sure that it works with your initramfs.

Yep, that works.  :-)

I assume dmraid-on-LVM won't work (and therefore shouldn't need to be
supported), right?  I doubt any onboard RAID controller has a clue about
LVM, so I don't think they'll put their signatures in the right place.

> Once we have this working, the next task is hibernation.

I *think* there's some support in the initramfs for this already, since
its /init was copied from the livecd.  (At least, I left the do_resume
part in, and the code that calls it.)  But I don't know how good that
support is.

I assume I'll need some kind of userspace tools to actually suspend a
qemu virtual machine, to test it?  And I assume I'll need some kind of
swap space to suspend to?  LVM swap over dmraid is probably the most
complicated setup, but I bet the initramfs will handle this already.

Well, wait, no it won't -- it'll need stat from the host to get the
major and minor number out of the device file (or symlink).  That's a
fairly easy change to though.  Let me know how you'd want
to test it.
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla -


More information about the lfs-dev mailing list