Has anyone succesfully set up an LVM2 based system with a 2.6 kernel?
I'm trying to and am having a few problems.
I have 2 drives I want to control with LVM. I created a 100M boot partition with ext2, a 500M / partition with reiserfs and then a type 8E partition filled the rest of one drive. On the other drive I created a tempory /var and /usr partition, then installed AL as normal.
Upgraded AL to a 2.6.2 system by hand (kernel26-scsi didn't work for me) and I'm pretty sure its working. After that I installed LVM2 via pacman and created a group for the LVM partition, vg1, with a 1G reiserfs filesystem which I will use for /opt. The idea is to get a system that works with /opt as its doesn't contain anything and then move /home /var /usr and /tmp over to LVM partitions, spread over both discs)
I can create the LVM stuff no problem, mount it by hand, but getting my system to mount it at boot is causing me the trouble. rc.sysinit contains the following:
if [ -f /etc/lvmtab ]; then # /proc is temporarily mounted to check for LVM support - it is # re-mounted later from /etc/fstab /bin/mount -n -t proc none /proc if [ -f /proc/lvm/global -a -x /sbin/vgchange ]; then stat_busy "Activating LVM groups" /sbin/vgchange -a y stat_done fi umount /proc fi
First thing I noticed, is that there is no /etc/lvmtab, or /proc/lvm on my system. This could be because LVM2 has changed quite a bit from LVM1, or is it?
So I tried commenting it out and added the following in place
/sbin/vgscan /sbin/vgchange -a y
Then added /dev/vg1/lvopt to my fstab file, rebooted and it won't mount, /dev/vg1/lvopt does not exist.
type the vg commands in by hand, followed by mount /opt and its fine.
So I tried adding them in further down the script, and eventually after lots of problems the vg1 group became corrupted. Any ideas on how to get this working?
Once I get this sorted out, I will write a howto for it.
I removed the lvm setup I had and used ls -l /dev/sdb5 to find the direct path after reading that suggestion on a mailing list.
Then ran vgscan (it was mentioned that this created /etc/lvmtab, but I still don't have that) and edited the mounting part of rc.sysinit to the following dirty hack:
stat_busy "Mounting Local Filesystems" /bin/mount -n -o remount,rw / /bin/rm -f /etc/mtab* /bin/mount /proc /sbin/vgscan /sbin/vgchange -a y /bin/mount -a -t nonfs,nosmbfs,noncpfs stat_done
I added /sbin/vgchange -a n to rc.shutdown, but I'm not 100% sure about that, I'm getting errors about a read only filesystem on shutdown. I need to investigate it further. If your interested, I added it just before the shutdown command, maybe it needs putting in a bit earlier?
anyway one reboot later and a quick df -H I get:
/dev/mapper/vg1-lvopt 1.1G 34M 1.1G 4% /opt
It's late, I've been drinking, I'll see how much I can add to this thread tomorrow. I'll work on those shutdown errors and then see how read/writing to the disc works; next I will try to move /var over to the LVM side.
I was playing around with lvm2 trying to create root-over-lvm2-over-soft-raid-0 on my new box, however I was having problems creating an initrd image with device-mapper support and I dumped it (lvm2 gone, raid0 stayed ).
If by any chance you figure it out pls let us (me) know about it so that the initscripts will get updated.
I don't know anything about raid, having never used it. I'm also uneasy about having stuff like /proc and /sbin on lvm, unless you have a good back up plan. But if I can help, I will.
I haven't been able to put anymore time into this, so no updates.
I have a working LVM system now, and the first draft of the how to is almost complete. There is now only one thing I'm not happy with.
Firstly I think the hack to the rc.sysinit script could be cleaner. That shouldn't be too hard.
Secondly that error on shutdown. LVM2 seems to use a lock file in /var/lock , obviously if you've umounted /var, then the lock file will be innacessable and give you lock initialisation errors. A quick read of the LVM man page and I saw something that I'd missed before. There is an option to ignore lock errors specifically for cases like this so we can edit rc.shutdown to something like this: (not at my AL box atm, can't remember the exact option, look in man lvm for it).
stat_busy "Unmounting Filesystems" /bin/umount -a /sbin/vgchange --ignorelockerrors -a n stat_done
I'll put the LVM howto in the doc section later tonight hopefully.