How to rescue data from an LVM disk
Recently my laptop broke down, but the hard drive was still functioning. I wanted to rescue as mucht data from it as possible as simple as possible. I had forgotten that the Fedora installation was using <a href="http://www.tldp.org/HOWTO/LVM-HOWTO/index.html">LVM</a> so when I went to get the data I had to learn a little about LVM.
From hard disk to mountable "partition" LVM is divided in physical volumes, volume groups and logical volumes. So I had to find the physical volume, activate the volume group and mount the logical volume.
I removed the harddisk from the laptop and mounted in an USB to 2.5" hard disk enclosure. I attached the USB connector to the Linux machine I used to rescue the data. When I connected the USB enclosure to the computer /var/log/messages showed me the name of the disk (in this case /dev/sdb). Using pvscan I found that Linux recognized there was a SCSI disk connected to the computer that contained an LVM volume. This matched the information from /var/log/messages, so I knew I was on the right track.
Oct 16 16:55:05 lusitania kernel: usb 1-1: new full speed USB device using uhci_hcd and address 3 Oct 16 16:55:05 lusitania crond(pam_unix)[4577]: session closed for user root Oct 16 16:55:11 lusitania kernel: Initializing USB Mass Storage driver... Oct 16 16:55:11 lusitania kernel: scsi2 : SCSI emulation for USB Mass Storage devices Oct 16 16:55:11 lusitania kernel: usbcore: registered new driver usb-storage Oct 16 16:55:11 lusitania kernel: USB Mass Storage support registered. Oct 16 16:55:16 lusitania kernel: Vendor: FUJITSU Model: MHT2060AH Rev: 006C Oct 16 16:55:16 lusitania kernel: Type: Direct-Access ANSI SCSI revision: 00 Oct 16 16:55:16 lusitania kernel: SCSI device sdb: 117210240 512-byte hdwr sectors (60012 MB) Oct 16 16:55:16 lusitania kernel: sdb: assuming drive cache: write through Oct 16 16:55:16 lusitania kernel: SCSI device sdb: 117210240 512-byte hdwr sectors (60012 MB) Oct 16 16:55:16 lusitania kernel: sdb: assuming drive cache: write through Oct 16 16:55:16 lusitania kernel: sdb: sdb1 sdb2 sdb3 sdb4 Oct 16 16:55:16 lusitania kernel: Attached scsi disk sdb at scsi2, channel 0, id 0, lun 0 Oct 16 16:55:20 lusitania scsi.agent[4681]: disk at /devices/pci0000:00/0000:00:02.2/usb1/1-1/1-1:1.0/host2/target2:0:0/2:0:0:0
[root@lusitania andreas]# pvscan PV /dev/sdb5 VG VolGroup00 lvm2 [31.31 GB / 32.00 MB free] PV /dev/hda3 VG System lvm2 [3.50 GB / 32.00 MB free] PV /dev/sda1 VG Data lvm2 [189.91 GB / 32.00 MB free] Total: 3 [224.72 GB] / in use: 3 [224.72 GB] / in no VG: 0 [0 ] [root@lusitania andreas]#
So there's something called VolGroup00 that should contain the data I'm after. Now I have to activate it so I can get to the data:
vgdisplay shows quite a lot of information about the volume groups it finds. Here's the most useful part of the information it generated:
--- Logical volume --- LV Name /dev/VolGroup00/LogVol00 VG Name VolGroup00 LV UUID 8W0wHB-f076-UaNj-93yx-p8O0-fbjH-YUHdu9 LV Write Access read/write LV Status available # open 0 LV Size 29.78 GB Current LE 953 Segments 1 Allocation inherit Read ahead sectors 0 Block device 253:4 --- Logical volume --- LV Name /dev/VolGroup00/LogVol01 VG Name VolGroup00 LV UUID q9u8Pg-eRFw-BAZO-GzEw-V8uG-qQTL-hLpP2A LV Write Access read/write LV Status available # open 0 LV Size 1.50 GB Current LE 48 Segments 1 Allocation inherit Read ahead sectors 0 Block device 253:5
One of the two logical volumes inside is the swap partition and the other shoulde then be the big / partition of my laptop and contain the data I'm after.
Mounting /dev/VolGroup00/LogVol00 as if it was a normal ext3 partition gave me the access to the data: