Add Comment

You are not currently logged in. If you do not have a user account then please consider creating one and logging in before you post your comment. This will allow you to track replies to your comment, and take part in the site much more freely.

To add your comment, fill in all the boxes below and then preview it to make sure you're happy with the way that it looks.

This is the comment you were replying to, attached to the article How Do I Make an initrd image?:


Re: How Do I Make an initrd for LVM2 Use
Posted by undefined (192.91.xx.xx) on Tue 29 Nov 2005 at 22:45
the problem you are experiencing sounds exactly like the problem i solved this last weekend (but with 2.4.27 kernel source from debian etch, built with make-kpkg, where i refused to enable devfs in the kernel because of past problems).

cat &lt;<eof>/etc/mkinitrd/scripts/include_hda.sh
#!/bin/sh
echo copying device files corresponding to lvm partitions
# actually copying all files associated with hard drive
cp -av /dev/hda* ${INITRDDIR}/dev/
echo done
EOF

chmod 755 /etc/mkinitrd/scripts/include_hda_devs.sh

my exact problem was that mkinitrd expects devfs to be used (and tries to mount devfs which fails), so no dev files are included in the initrd. but vgscan and vgchange need the dev files to "discover" your lvm physical volumes.

also, by default mkinitrd uses cramfs for the initrd, but historically the stock kernel (maybe just 2.4) didn't include cramfs. you can build an initrd of a specific filesystem type by setting MKIMAGE to the proper command within /etc/mkinitrd/mkinitrd.conf.

if that doesn't solve your problem, then you can do the following to enable further investigation:

apt-get install busybox

# set MODULES=ALL, DELAY=10, BUSYBOX=yes
editor /etc/mkinitrd/mkinitrd.conf

cat &lt;<eof>/etc/mkinitrd/scripts/include_lvm_utils.sh
#!/bin/bash -xv
rm -f ${INITRDDIR}/sbin/{vgscan,vgchange}
cp {,${INITRDDIR}}/sbin/lvmiopversion
for FILE in /lib/lvm-10/*; do
cp ${FILE} ${INITRDDIR}/${FILE}
ln -s lvmiopversion ${INITRDDIR}/sbin/$(basename ${FILE})
done
EOF

chmod 755 /etc/mkinitrd/scripts/include_lvm_utils.sh

mkinitrd -k -o /boot/initrd.img-<version> <version>

-k is useful because if you want to inspect the contents of the initrd it is much easier to peruse the build directory than loop-mounting the initrd image.

for me version = 2.4.27-11+1-686 as that was the version of the corresponding kernel-image package i built with make-kpkg. (i really recommend make-kpkg though i've only ever used it to compile kernel-source packages, not stock kernels.)

when booting the initrd it should print a message similar to "pausing to allow user to interrupt the boot process by pressing enter". press enter. now start probing around the system. if your initrd is cramfs, which is read-only, and you want/need to create files, then you'll need to "mount tmpfs tmpfs /blah" to give you a writable directory (and lvm needs a writable /etc).

that worked for me, maybe it'll help you.

Username:Anonymous
Title:
Your Comment:

Posting Format:

 

Inappropriate comments will be removed.

Some help on entry formatting is available

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search