PDA

View Full Version : I messed up my LVM layout; need to edit it but can't mount



LeFou
7th April 2007, 03:56 PM
What I'm using: dell laptop triple booting XP (/dev/hdc2), FC5 (/dev/hdc8, "VolGroup00") and FC6 (/dev/hdc10, "VolGroup01").

What I was going for: a separate partition for my htdocs/ directory, as I'm a webdev and want to try out new distros all the time and still be able to work on my local copy of the sites I build.

What I did right: create a separate partition (/dev/hdc11) and set mount point as /var/www/html (in my FC6 root) and /opt/lampp/htdocs (FC5 root -- I like both of these but use FC5 a lot more).

What I did wrong: in FC5 I used the LVM GUI and added physical volume /dev/hdc11 to VolGroup00.

Where I'm at: trying to boot FC5 kernelpanics, saying
"Couldn't find device with uuid 'LnpMvH-rAd9-GugV-3nGr-kWno-5FN8-XEYj2X"
Couldn't find all physical volumes for volume groupVolGroup00
Volume group "VolgRoup00" not found.

I'm still able to get FC6 going if I use rescue boot and then edit fstab so it doesn't try to mount VolGroup00. And I can get my sites off of /dev/hdc11 from in there.

But I also *really need some of the other stuff in the FC5 partition. Basically I need to undo the dumb thing I did in the LVM GUI, without being able to mount that group.

Found vgcreate, pvcreate and friends, but these gave locking errors. I see there are options to make it ignore such errors (etc/rc.d/sysinit calls these utilities with options like that) but I'm afraid to do that stuff in case of inadvertently initializing one of these volumes.

All help greatly appreciated

SlowJet
7th April 2007, 04:34 PM
Partitioins and PV's can not be changed with data on them.

VG's can not be mounted to use LVM on them.

Each OS (FC5, FC6, FC7 ) should have a /boot partition of ext3.


Normal partitions - LVM is used on hda, hdb is regular partitions
# fdisk -l

Disk /dev/hda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 64 514048+ 83 Linux
/dev/hda2 65 7244 57673350 8e Linux LVM
/dev/hda3 7245 7257 104422+ 83 Linux
/dev/hda4 7258 14593 58926420 5 Extended
/dev/hda5 7258 14593 58926388+ 8e Linux LVM

Disk /dev/hdb: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 * 1 25 200781 83 Linux
/dev/hdb2 26 547 4192965 83 Linux
/dev/hdb3 548 1200 5245222+ 83 Linux
/dev/hdb4 1201 4865 29439112+ 5 Extended
/dev/hdb5 1201 1722 4192933+ 82 Linux swap / Solaris
/dev/hdb6 1723 2766 8385898+ 83 Linux
/dev/hdb7 2767 3288 4192933+ 83 Linux
/dev/hdb8 3289 4865 12667221 83 Linux
[root@Averrial-16 ~]#


hda (sda) had FC5 and FC6 installed then FC5 was updated to F7test using the same names.
FC6 was later installed again adjusting the LVM partition, the PV, VG and the LV's for more space.
And I too got a name incorrect but there is no magic to change it.

# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroupFC06 1 3 0 wz--n- 56.19G 32.00M
VolGroupFC501 1 3 0 wz--n- 55.00G 32.00M
[root@Averrial-16 ~]# lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
LogVol00 VolGroupFC06 -wi-ao 38.16G
LogVolFC06root VolGroupFC06 -wi-ao 16.00G
LogVolFC06swap VolGroupFC06 -wi-ao 2.00G
LogVolFC501 VolGroupFC501 -wi-a- 18.00G
LogVolFC5home VolGroupFC501 -wi-a- 34.97G
LogVolFC5swap VolGroupFC501 -wi-ao 2.00G


For data PV-VG's it is much easier as you can umount and /or vgchange -a y to make the VG available for LVM tools.

"What I did right: create a separate partition (/dev/hdc11) and set mount point as /var/www/html (in my FC6 root) and /opt/lampp/htdocs" those are not valid mount points.

With modern disk dirves and a Pent IV you only need
/boot
/
swap
/home

and optionall the unix spread can be ued (but that was designed when disk drives < 4 GB and was used for a make shift security method. With SELinux the spread is not needed.
See hdb partitions above.
Mount Points are

/boot
/
/var
swap
/usr (not recommended for Linux.)
/tmp
/home


SJ

LeFou
7th April 2007, 05:09 PM
I was hoping the resident LVM expert would jump in, thanks. But you're going a little fast for me. Am 100% okay with following your recommendations when I clean up and reinstall, etc. But first I need to try to get things off of /dev/hdc8 (VolGroup00) which cannot boot or mount, saying "bad superblock" and so on, presumably (?) because I pushed /dev/hdc11 onto the front of that group...

pvscan output
Couldn't find device with uuid 'LnpMvH-rAd9-GugV-3nGr-kWno-5FN8-XEYj2X'
Couldn't find device with uuid 'LnpMvH-rAd9-GugV-3nGr-kWno-5FN8-XEYj2X'
PV /dev/hdc10 VG VolGroup01 lvm2 [12.28GB /32.00 MB free] //FC6
PV /dev/hdc8 VG VolGroup00 lvm2 [26.91GB /32.00 MB free] //FC5 yay! that's what I want to dig into
PV unknown device VG VolGroup00 lvm2 [2.12GB /2.12 GB free] // this is /dev/hdc11, my "work" partition

SlowJet
7th April 2007, 05:27 PM
Yes, I know but it is a long write. :)

Boot up with the FC6 LiveCD and then

vgs
vgchnage -a y VG VolGroup00 (see man vgchange)
and try to mount the lv's to work with

or


vgs
vgchange -a y VG VolGroup00
lvremove (my "work") lv (put it somewhere else or on a separate vg-lv?)
pvremove /dev/hdc11

SJ

LeFou
8th April 2007, 01:26 AM
Thanks. Last question before I roll with this:
LVM won't/can't wipe out any data without asking is it? I get really nervous typing any variation on "remove" ;)

LeFou
10th April 2007, 01:48 PM
ick

> /sbin/vgchange -a y VG VolGroup00
Volume group "VG" not found
Couldn't find device with uuid 'LnpMvH-rAd9-GugV-3nGr-kWno-5FN8-XEYj2X'.
Couldn't find all physical volumes for volume group VolGroup00.
Couldn't find device with uuid 'LnpMvH-rAd9-GugV-3nGr-kWno-5FN8-XEYj2X'.
Couldn't find all physical volumes for volume group VolGroup00.

man vgchange doesn't tell me what the ' VG' is for in this command?
possibly-useful: I don't think I created a logical volume corresponding to physical /dev/hdc11 ('work' partition). So will I be skipping
lvremove (my "work") lv (put it somewhere else or on a separate vg-lv?)
?

LeFou
10th April 2007, 02:50 PM
This i s fixt. Very helpful:

http://kbase.redhat.com/faq/FAQ_85_5843.shtm

Basically it shows you how to restore old LVM setup from a backup file.
vgdisplay --partial --verbose
shows you the problem ("unknown") device and you move it into a fresh volume with something like
pvcreate --restorefile /etc/lvm/backup/volGroup00 --uuid 9eWicl-1HSB-Fkcz-wrMf-DzMd-Dgx2-Kyc11j /dev/hda15

And thanks SJ too.