Re: Cannot mount old drive with LVM partition - help!



On Wed, 04 Oct 2006 01:13:46 +0000, Ohmster wrote this:

"J.O. Aho" <user@xxxxxxxxxxx> wrote in
news:4oe6heFe14qbU1@xxxxxxxxxxxxxx:

deactivating the LVM won't in a magical way change the slice data


//Aho

Dam! :(
I was hoping knoppix would have read the hdb2.
Don't get hasty if you're unsure. If FC3 is really not a critical as in
home system vs work system you can take your time and carefully recover
your data.

Before Webmin this was a simple change ie,

$ vmchange -an # disables all lvm
$ vmrename volgroup00 volgroup01
$ vmchange -ay

Basically rename the volgroup00 (on hda) to volgroup01 or whatever so hdb
would be volgroup00. Then change the volgroup name as often as necessary.

Now it's unknown what you actually have but I think your hdb is still
under LVM. Some LVM prints might help etc.

$ vgscan
$ pvdisplay
$ pvscan
$ fdisk -l on hda and hdb

Found an article (snippet below) on recovering RAID and LVM volumes. It's
not for the faint hearted. Plz read the recovering Lvm2 volume part of article (and displays) entirely.
BTW /dev/md2 is raid drive so I'd think you'd substitute /dev/hdb.

----- http://www.linuxjournal.com/article/8874

Recovering and Renaming the LVM2 Volume

The next hurdle is that the system now will have two sets of lvm2 disks
with VolGroup00 in them. Typically, the vgchange -a -y command would allow
LVM2 to recognize a new volume group. That won't work if devices
containing identical volume group names are present, though. Issuing
vgchange -a y will report that VolGroup00 is inconsistent, and the
VolGroup00 on the RAID device will be invisible. To fix this, you need to
rename the volume group that you are about to mount on the system by
hand-editing its lvm configuration file.

If you made a backup of the files in /etc on raidbox, you can edit a copy
of the file /etc/lvm/backup/VolGroup00, so that it reads VolGroup01 or
RestoreVG or whatever you want it to be named on the system you are going
to restore under, making sure to edit the file itself to rename the volume
group in the file.

If you don't have a backup, you can re-create the equivalent of an LVM2
backup file by examining the LVM2 header on the disk and editing out the
binary stuff. LVM2 typically keeps copies of the metadata configuration at
the beginning of the disk, in the first 255 sectors following the
partition table in sector 1 of the disk. See /etc/lvm/lvm.conf and man
lvm.conf for more details. Because each disk sector is typically 512
bytes, reading this area will yield a 128KB file. LVM2 may have stored
several different text representations of the LVM2 configuration stored on
the partition itself in the first 128KB. Extract these to an ordinary file
as follows, then edit the file:

dd if=/dev/md2 bs=512 count=255 skip=1 of=/tmp/md2-raw-start

vi /tmp/md2-raw-start


You will see some binary gibberish, but look for the bits of plain text.
LVM treats this metadata area as a ring buffer, so there may be multiple
configuration entries on the disk. On my disk, the first entry had only
the details for the physical volume and volume group, and the next entry
had the logical volume information. Look for the block of text with the
most recent timestamp, and edit out everything except the block of plain
text that contains LVM declarations. This has the volume group
declarations that include logical volumes information. Fix up physical
device declarations if needed. If in doubt, look at the existing
/etc/lvm/backup/VolGroup00 file to see what is there. On disk, the text
entries are not as nicely formatted and are in a different order than in
the normal backup file, but they will do. Save the trimmed configuration
as VolGroup01. This file should then look like Listing 6.
.



Relevant Pages

  • Re: Cannot mount old drive with LVM partition - help!
    ... Basically rename the volgroup00 to volgroup01 or whatever so hdb ... Some LVM prints might help etc. ... Recovering and Renaming the LVM2 Volume ... backup file by examining the LVM2 header on the disk and editing out the ...
    (alt.os.linux)
  • Re: How to mount an LVM volume? (was lvm2 problem)
    ... How to mount an LVM volume? ... (was lvm2 problem) ... Found volume group "VolGroup00" using metadata ...
    (Fedora)
  • Re: How to mount an LVM volume? (was lvm2 problem)
    ... and I need to mount the old FC5 boot disk to copy some stuff off of it. ... I said "lvm vgscan" and got: ... Found volume group "VolGroup00" using metadata type lvm2 ...
    (Fedora)
  • Re: Dump/restore
    ... > I reinstall it back and perform a manually partiton and ok... ... > I wonder that the installer is forced all to use LVM2 even a single ... uses LVM by default because it's more flexible than standard partitions and is ... disk, the great advantage of LVM is that should you decide some time later to ...
    (Fedora)
  • Yet another post on disk copy methods
    ... Because I have experienced several disk failures over the past 20 years, I like to keep a duplicate hard disk around that duplicates all the software and setup on my work computer. ... Unfortunately, as I discovered, you cannot then mount this with the old disk and copy the partition contents, because the old and new disks have the same LVM names. ... I reinstalled a minimal system from scratch, but this time edited the LVM group name changing VolGroup00 -> VolGroup01. ... I altered those, repacked the initrd file according to those directions, and copied it to the boot partition of the new disk. ...
    (Fedora)