Author: Andy Sy Date: To: Philippine Linux Users Group Mailing List Old-Topics: [plug] Re: LVM root partition Subject: [plug] Re: LVM root partition (making a successful initrd)
Rafael 'Dido' Sevilla wrote:
>>Otoh, I can't seem to get rid of the requirement to use an initrd.
>>Even though all the initrd really does is to run vgscan/vgchange -ay
>>(no pivot_root necessary), there still seems to be some black magic
>>involved in that.
> Exactly. That's why I don't think it's worth the trouble.
Finally figured out what was going wrong with the initrd
image that lvmcreate_initrd makes. Here are some
essential tips to getting a working lvm initrd in case
anyone out there is interested:
1) chroot-ing to the initrd tree helps to test it out
2) ldd the stuff in /bin, /sbin, etc... and make sure /lib
contains these dependencies. A missing .so file will trigger
a cryptic "/bin/xxx: not found" error.
- On my Slack 10.1 setup, lvmcreate_initrd did not include
/lib/ld-linux.so.2, which is why the initrd was failing
(with no error message pointing to this fact)
- the initrd that mkinitrd creates uses a statically-linked
busybox, hence no such problems
3) vgscan will need a fair amount of extra space (200K at
least) when it creates lvmtab and lvmtab.d, so your initrd
image must have extra space in it, otherwise you get yet
another cryptic error message. Instead of using mkinitrd
and lvmcreate_initrd to create the initrd image, do:
dd if=/dev/zero of=myinitrd.img bs=nnnK count=1
mke2fs -F myinitrd.img (add -m0 -b 1024 for a compact initrd)
mount -o loop myinitrd.img myinitrd-tree
cp -R original-mkinitrd-tree/* myinitrd-tree/
- your kernel must have loopback filesystem support enabled
- you can estimate nnn based by letting mkinird create initrd.gz,
gunzipping it, checking its filesize and then adding a few
hundred K (or more to be safe) to that.
- gzip -9 -c myinitrd.img > myinitrd.gz
- and point to that in LILO (or rename it to initrd.gz)
4) pivot_root does not seem to be needed at the end of linuxrc
but does no harm either if you know how to use it.
5) For a rescue disk, anything that has the lvm tools should
- For Slackware, I created a custom install CD by modifying the
initrd.img that came with it, enlarging it so I can stuff
the lvm tools in it plus addtl. space for vgscan to store its
lvmtab files in when run. I also increased ramdisk_size in
isolinux/isolinux.cfg just to be sure this new initrd.img