Dont know how often this will be needed, but i needed to figure it out today.
So my laptop was toast but the hd was fine so i figured i would mount it in my desktop. went out bout an adaptor, no problems. But when i go to mount it, since they are both FC default installs, I find out that since both are named Volgroup00, the desktop install takes presidence in /dev, so vgrename is out so anyway here is what i did.
luckily lvm stores its metadata in plaintext so
dd if=/dev/mdb2 bs=512 count=255 skip=1 of=/tmp/logical_lap
vi /tmp/logical_lap
remove all but the plain text, should look something like this (dG comes in handy)
Quote:
# Generated by LVM2: Sat Dec 31 21:50:02 2005
contents = "Text Format Volume Group"
version = 1
description = "Created *after* executing 'vgdisplay'"
creation_host = "localhost.localdomain" # Linux localhost.localdomain 2.6.18-1.2849.fc6 #1 SMP Fri Nov 10 12:45:28 EST 2006 i686
creation_time = 1136083802 # Sat Dec 31 21:50:02 2005
VolGroup00 {
id = "rmfuJ4-nRSx-1qvM-OI4X-lD1E-AqJT-DiP0vE"
seqno = 3
status = ["RESIZEABLE", "READ", "WRITE"]
extent_size = 65536 # 32 Megabytes
max_lv = 0
max_pv = 0
physical_volumes {
pv0 {
id = "ty1bOm-1zhN-RaSe-tAPx-tZN4-6HM7-IbQzkW"
device = "/dev/hda2" # Hint only
status = ["ALLOCATABLE"]
pe_start = 384
pe_count = 2381 # 74.4062 Gigabytes
}
}
logical_volumes {
LogVol00 {
id = "sh0Xw8-W8XD-Ejnu-bMrb-s7be-39I8-93kKXs"
status = ["READ", "WRITE", "VISIBLE"]
segment_count = 1
segment1 {
start_extent = 0
extent_count = 2324 # 72.625 Gigabytes
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv0", 0
]
}
}
}
}
|
then vi /tmp/logical_lap
change all occurences of VolGroup00 to VolGroup01
and /dev/hda2 or whatever you have, to the correct drive on the new system, in my case hdb2
save and exit vi
# cp /tmp/logical_lap /etc/lvm/backup/VolGroup01
# vgcfgrestore VolGroup01
# vgscan
# pvscan
# vgchange VolGroup01 -a y
# lvscan
# mkdir /mnt/old_2_5
# mount /dev/VolGroup01/LogVol00 /mnt/old_2_5
whola it works, took me a while to figure that one out. At least i kinda understand lvm now