PDA

View Full Version : Please help with LVM after using dd



daytonjones
24th January 2009, 06:26 PM
I have a laptop that was running FC8 - the motherboard died and I need to get my data off the drive. I temporarily moved the drive to a different system, booted with a KNOPPIX live CD and was able to use dd over ssh to copy my drive to another system.

I can mount sda1 (/boot) but can not mount sda2 which is/was an LVM. I'd like to be able to mount the dd image of sda2 on my server so I can access the files. How do I go about doing so?

daytonjones
24th January 2009, 06:40 PM
I have a laptop that was running FC8 - the motherboard died and I need to get my data off the drive. I temporarily moved the drive to a different system, booted with a KNOPPIX live CD and was able to use dd over ssh to copy my drive to another system.

I can mount sda1 (/boot) but can not mount sda2 which is/was an LVM. I'd like to be able to mount the dd image of sda2 on my server so I can access the files. How do I go about doing so?

sideways
24th January 2009, 07:23 PM
Try running kpartx on the image file first, then run vgscan to detect the volume group in the image file and use vgchange -ay to activate the volume group, and now you can mount the logvols in /dev/VolGroupxx manually.


kpartx -av <dd image of /dev/sda2>
vgscan
vgchange -ay

If that doesn't work then you need to use losetup to map the image file to a loop device first, see this thread for more info

http://forums.fedoraforum.org/showthread.php?t=211093&highlight=kpartx

daytonjones
24th January 2009, 11:37 PM
Thanks... but there's a problem... following the steps in the link you gave, I get all the way to reading the partition table (kpartx -a -v /dev/loop0)

but when I run pvdisplay, the "new" volume and the existing volume on my server both have the same VG Name (VolGroup00):


[root@fenris m90]# pvdisplay
--- Physical volume ---
PV Name /dev/dm-3
VG Name VolGroup00
PV Size 92.97 GB / not usable 29.68 MB
Allocatable yes
PE Size (KByte) 32768
Total PE 2974
Free PE 1
Allocated PE 2973
PV UUID ze2GpE-WNXQ-m3jo-GdUi-oW3w-ODVf-Odg8b0

--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup00
PV Size 232.69 GB / not usable 4.58 MB
Allocatable yes
PE Size (KByte) 32768
Total PE 7446
Free PE 2
Allocated PE 7444
PV UUID nug4Ep-9H0n-wmzc-idC1-Mcud-YKXO-Rygtgu


So when I go to activate it, I don't get the VG that I want (m90) but the one on my server... How can I rename the VG for the dd image?

Hlingler
25th January 2009, 01:17 AM
Identical threads merged. Please do not double-post: http://www.fedoraforum.org/?view=guide

Thanks in advance for your understanding and cooperation.

V

sideways
25th January 2009, 02:20 PM
sorry I didn't have the opportunity to reply yesterday.

EDIT

Deleted potentially dangerous advice.

sideways
25th January 2009, 03:47 PM
OK, Ignore last post, I had a better idea, use the UUID on the image VolGroup to rename it


vgrename ze2GpE-WNXQ-m3jo-GdUi-oW3w-ODVf-Odg8b0 VolGroup99

duh! :)

May need to run 'vgchange -an' first

daytonjones
26th January 2009, 01:24 PM
That looks so simple, but of course (for me) it can't be...

~]# vgrename ze2GpE-WNXQ-m3jo-GdUi-oW3w-ODVf-Odg8b0 VolGroup99
Volume group ze2GpE-WNXQ-m3jo-GdUi-oW3w-ODVf-Odg8b0 not found.


but:


~]# pvdisplay
--- Physical volume ---
PV Name /dev/dm-3
VG Name VolGroup00
PV Size 92.97 GB / not usable 29.68 MB
Allocatable yes
PE Size (KByte) 32768
Total PE 2974
Free PE 1
Allocated PE 2973
PV UUID ze2GpE-WNXQ-m3jo-GdUi-oW3w-ODVf-Odg8b0

and trying to deactivate the volumes gives:


~]# vgchange -an
Can't deactivate volume group "VolGroup00" with 2 open logical volume(s)
Can't deactivate volume group "VolGroup00" with 2 open logical volume(s)

sideways
26th January 2009, 08:02 PM
sorry, use the UUID from vgdisplay not pvdisplay.