Operating System - Linux
1829147 Members
2661 Online
109986 Solutions
New Discussion

Re: fedora lvm root disk ....

 
K.C. Chan
Trusted Contributor

fedora lvm root disk ....

all,
I am running fedora3, I am trying to get lvm on root partition to work. However I need to add the lvm module to initrd. I tried including dm_mod in the initrd creation process, but could not locate it. Does any one know what module I should add to the initrd process in order to support lvm on root partition? Thanks.
Reputation of a thousand years can be determined by the conduct of an hour
21 REPLIES 21
Steven Chan_9
Frequent Advisor

Re: fedora lvm root disk ....

Hi~

Did you use mkinitrd to create ram disk?

If you used mkinitd, try:

mkinitrd -v --preload dm-mod image-name `uname -r`

regards,
Steven Chan
Stuart Browne
Honored Contributor

Re: fedora lvm root disk ....

Do you have your kernels on your /root filesystem, or on a separate (non-lvm) /boot filesysetm?
One long-haired git at your service...
K.C. Chan
Trusted Contributor

Re: fedora lvm root disk ....

Yeah, I have a separate boot, that works find. Kernel and initrd resides there. I added the dm_mod module, but still getting kernel panic.

error:
mkrootdev: label /root not found
mounting root filesystem
mount: error 2 mounting ext3
mount: error 2 mounting none
Switching to new root
switchroot: mount failed: 22
umount /initrd/dev failed: 2
Kernel panic - not syncing: Attempted to kill init!

this part with /root label is the the root partition underl lvm, I migrated it from the original root partition (/dev/hda2) which I did not wipe out. If I boot using /dev/hda2 I am back where I started. Is there anything I need to do to get mkrootdev to work with the new lvm root partition labeled: /root? Thanks.
Reputation of a thousand years can be determined by the conduct of an hour
Steven Chan_9
Frequent Advisor

Re: fedora lvm root disk ....

Hi~

What is your lvm root file system labeled?

If not, use tune2fs -L to change your lvm root file system's label.

And do not connect 2 partition with the same label one system together.

regards,
Steven Chan
K.C. Chan
Trusted Contributor

Re: fedora lvm root disk ....

the old label is "/" and the new label is "/root". I think the problem is that it is having issue with the new root file system because it is under lvm2. I thought loading the dm_mod module would help. But in retrospect, you would have to activate the volume by running vgscan first; hence mkroot dev can't find the new root filesystem (which is under lvm2). Any idea how to get around this?
Reputation of a thousand years can be determined by the conduct of an hour
Steven Chan_9
Frequent Advisor

Re: fedora lvm root disk ....

Hi~

I had tryed to mkinitrd with dm-mod preloaded under RHEL4, mkinitrd will include lvm2 into ram disk automatically. But I have not try this on FC3.

What is you mkinitrd version? maybe your mkinitrd is too old to support lvm2.

BTW, the module name on kernel tree of dm_mod is dm-mod.

regards
Steven Chan
K.C. Chan
Trusted Contributor

Re: fedora lvm root disk ....

the version on it is mkinitrd-4.1.18-2.
Reputation of a thousand years can be determined by the conduct of an hour
Ivan Ferreira
Honored Contributor

Re: fedora lvm root disk ....

What if you instead of using a label as a kernel option, use the device special. Like this:

kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
K.C. Chan
Trusted Contributor

Re: fedora lvm root disk ....

Ivan, thanks for the suggestion, I already tried that.
Reputation of a thousand years can be determined by the conduct of an hour
K.C. Chan
Trusted Contributor

Re: fedora lvm root disk ....

Does any one know if fedora3 support lvm for root filesystem?
Reputation of a thousand years can be determined by the conduct of an hour
Steven Chan_9
Frequent Advisor

Re: fedora lvm root disk ....

Hi~

You can boot you system via FC3 CD in rescue mode and with lvm root partition installed. If rescue mode can detect you root file system on lvm and mounted, chroot to the mounted root file system then mkinitrd again.

Maybe this will make mkinitrd to include lvm2 into ram disk.

regards,
Steven Chan
Steven Chan_9
Frequent Advisor

Re: fedora lvm root disk ....

Hi~

FC3 suppor root file system on LVM.

I did it long time ago, but I did it during the OS installation with Disk Druid.

regards
Steven Chan
K.C. Chan
Trusted Contributor

Re: fedora lvm root disk ....

This is what I got when creatig initrd with mkinitrd:
Creating initramfs
Looking for deps of module dm-mod
Looking for deps of module ide-disk
Looking for deps of module dm-mod
Looking for deps of module ext3 jbd
Looking for deps of module jbd
Looking for deps of module xfs
Using modules: ./kernel/drivers/md/dm-mod.ko ./kernel/fs/jbd/jbd.ko ./kernel/fs/ext3/ext3.ko ./kernel/fs/xfs/xfs.ko
/sbin/nash -> /tmp/initrd.FQ5577/bin/nash
/sbin/insmod.static -> /tmp/initrd.FQ5577/bin/insmod
/sbin/udev.static -> /tmp/initrd.FQ5577/sbin/udev
/etc/udev/udev.conf -> /tmp/initrd.FQ5577/etc/udev/udev.conf
copy from /lib/modules/2.6.10-1.770_FC3smp/./kernel/drivers/md/dm-mod.ko(elf32-i386) to /tmp/initrd.FQ5577/lib/dm-mod.ko(elf32-i386)
copy from /lib/modules/2.6.10-1.770_FC3smp/./kernel/fs/jbd/jbd.ko(elf32-i386) to /tmp/initrd.FQ5577/lib/jbd.ko(elf32-i386)
copy from /lib/modules/2.6.10-1.770_FC3smp/./kernel/fs/ext3/ext3.ko(elf32-i386) to /tmp/initrd.FQ5577/lib/ext3.ko(elf32-i386)
copy from /lib/modules/2.6.10-1.770_FC3smp/./kernel/fs/xfs/xfs.ko(elf32-i386) to /tmp/initrd.FQ5577/lib/xfs.ko(elf32-i386)
Loading module dm-mod
Loading module jbd
Loading module ext3
Loading module xfs

I do not see lvm? am I missing something?
Reputation of a thousand years can be determined by the conduct of an hour
K.C. Chan
Trusted Contributor

Re: fedora lvm root disk ....

Steven,
chrooting still not working. Same error? does any one know else should be included in initrd inorder to support lvm on root?
Reputation of a thousand years can be determined by the conduct of an hour
Steven Chan_9
Frequent Advisor

Re: fedora lvm root disk ....

Hi KC,

I think you have to create initrd manunally.

The following modules have to be inculded:

dm-mirror.ko
dm-mod.ko
dm-snapshot.ko
dm-zero.ko
ext3.ko
jbd.ko

/usr/sbin/lvm.static has to be copied to initrd's /bin/lvm, and /etc/lvm/lvm.conf should be included also.

And here is a sample of init script on initrd:

#!/bin/nash

mount -t proc /proc /proc
setquiet
echo Mounted /proc filesystem
echo Mounting sysfs
mount -t sysfs none /sys
echo Creating /dev
mount -o mode=0755 -t tmpfs none /dev
mknod /dev/console c 5 1
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mkdir /dev/pts
mkdir /dev/shm
echo Starting udev
/sbin/udevstart
echo -n "/sbin/hotplug" > /proc/sys/kernel/hotplug
echo "Loading dm-mod.ko module"
insmod /lib/dm-mod.ko
echo "Loading jbd.ko module"
insmod /lib/jbd.ko
echo "Loading ext3.ko module"
insmod /lib/ext3.ko
echo "Loading dm-mirror.ko module"
insmod /lib/dm-mirror.ko
echo "Loading dm-zero.ko module"
insmod /lib/dm-zero.ko
echo "Loading dm-snapshot.ko module"
insmod /lib/dm-snapshot.ko
/sbin/udevstart
echo Making device-mapper control node
mkdmnod
echo Scanning logical volumes
lvm vgscan
echo Activating logical volumes
lvm vgchange -ay
echo Making device nodes
lvm vgmknodes
echo Creating root device
mkrootdev /dev/root
umount /sys
echo Mounting root filesystem
mount -o defaults --ro -t ext3 /dev/root /sysroot
mount -t tmpfs --bind /dev /sysroot/dev
echo Switching to new root
switchroot /sysroot
umount /initrd/dev

regards,
Steven Chan
K.C. Chan
Trusted Contributor

Re: fedora lvm root disk ....

So, is there an expert install option for fc3 or fc4 installations in which you can part your partition with lvm, carve out logical extend and create xfs file system for /boot and root file system?
Reputation of a thousand years can be determined by the conduct of an hour
Steven Chan_9
Frequent Advisor

Re: fedora lvm root disk ....

Hi KC,

Yes, you can setup LVM during the installation with Disk Druid in FC3 or FC4.

Actually, if you let Disk Druid part you hard drive automatically, the default setting is use LVM on your root. Of cause you can do this manually.

regards,
Steven Chan
K.C. Chan
Trusted Contributor

Re: fedora lvm root disk ....

Will it create volume group and logical volume? What option do I use when booting off the cdrom to get full lvm support? Thanks.
Reputation of a thousand years can be determined by the conduct of an hour
Steven Chan_9
Frequent Advisor

Re: fedora lvm root disk ....

Hi KC,

When you install from the FCs' CD. During Disk Partition Setup, you will be asked for choosing Automatically Partition or Manually partition with Disk Druid.

Choose Automatically Partition and it will setup your hard drive with 1 partition for /boot and rest of part to a VG, then create a LV for / and another LV for swap.

regards,
Steven Chan
K.C. Chan
Trusted Contributor

Re: fedora lvm root disk ....

Do you how you can choose this option under Kickstart?
Reputation of a thousand years can be determined by the conduct of an hour
K.C. Chan
Trusted Contributor

Re: fedora lvm root disk ....

thanks all for your help.
Reputation of a thousand years can be determined by the conduct of an hour