LinuxQuestions.org

LinuxQuestions.org (http://www.linuxquestions.org/questions/index.php)
-   Linux - Hardware (http://www.linuxquestions.org/questions/forumdisplay.php?f=18)
-   -   LVM disappear (http://www.linuxquestions.org/questions/showthread.php?t=826318)

Nemesiz 08-15-2010 03:14 AM

LVM disappear
 
I had to move data from one HDD to another. So in existing LVM I extended it with new HDD. Moved from one to another hdd. Was fine but after restart LVM disappeared. I can see only partition LVM (pvdisplay, lvdisplay, vgdisplay show empty). No lucky recovering it. So can i use pvcreate (i don't have a backup data or uuid) and somehow get logical volumes with data?

I tried with testdisk and others with no good lucky.

rayfordj 08-15-2010 07:39 AM

Depending on the distro you may find LVM metadata backup(s) under /etc/lvm/, otherwise, you should be able to pull it off the disk(s) using dd. See Recovery PV Meta-Data for an example.

Nemesiz 08-15-2010 12:31 PM

The problem is that root partition is inside LVM. I am trying to recover using live cd.

Nemesiz 08-16-2010 04:16 PM

I found something

Code:

# This file is automatically maintained by lvm.

persistent_filter_cache {
        valid_devices=[
                "/dev/mapper/truecrypt1",
                "/dev/block/1:13",
                "/dev/block/1:14",
                "/dev/disk/by-uuid/ead135bb-d695-4c7d-97a9-5e90b54a32db",
                "/dev/ram11",
                "/dev/disk/by-path/pci-0000:00:1f.2-scsi-3:0:0:0-part1",
                "/dev/disk/by-path/pci-0000:02:00.0-scsi-0:0:0:0-part1",
                "/dev/block/8:17",
                "/dev/block/8:33",
                "/dev/block/8:34",
                "/dev/block/253:2",
                "/dev/disk/by-id/ata-SAMSUNG_SP0812C_S01UJ20Y298200-part1",
                "/dev/block/1:12",
                "/dev/disk/by-id/scsi-SATA_SAMSUNG_SP2004CS07GJ10Y302659-part1",
                "/dev/mapper/pve-root",
                "/dev/disk/by-id/dm-name-pve-root",
                "/dev/ram10",
                "/dev/disk/by-id/scsi-SATA_SAMSUNG_SP0812CS01UJ20Y298200-part1",
                "/dev/disk/by-id/dm-uuid-LVM-UL8spdRfXSwXJyOJNsiIUMhsFG3TnkU7KQF3zJQCQcBXehZob0zc2MfPgPLZRX7p",
                "/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0-part1",
                "/dev/block/8:49",
                "/dev/disk/by-id/ata-SAMSUNG_SP2004C_S07GJ10Y302659-part2",
                "/dev/block/253:3",
                "/dev/block/1:10",
                "/dev/disk/by-uuid/d402ef49-72c1-4be4-8def-0977c3406b15",
                "/dev/ram12",
                "/dev/disk/by-path/pci-0000:00:1f.2-scsi-3:0:0:0-part2",
                "/dev/block/1:6",
                "/dev/disk/by-path/pci-0000:00:1f.2-scsi-1:0:0:0-part1",
                "/dev/disk/by-id/dm-uuid-LVM-UL8spdRfXSwXJyOJNsiIUMhsFG3TnkU74EWZK7B3fSi9oeIRzkV9wJ6pmRO0scjr",
                "/dev/ram6",
                "/dev/disk/by-id/ata-SAMSUNG_SP0812C_S01UJ20Y298199-part1",
                "/dev/block/253:1",
                "/dev/mapper/pve-data",
                "/dev/disk/by-id/ata-SAMSUNG_SP0812C_S01UJ20Y298200-part2",
                "/dev/block/1:11",
                "/dev/disk/by-id/scsi-SATA_SAMSUNG_SP2004CS07GJ10Y302659-part2",
                "/dev/ram13",
                "/dev/ram14",
                "/dev/disk/by-id/scsi-SATA_SAMSUNG_SP0812CS01UJ20Y298200-part2",
                "/dev/block/1:5",
                "/dev/disk/by-id/scsi-SATA_SAMSUNG_SP0812CS01UJ20Y298199-part1",
                "/dev/mapper/pve-swap",
                "/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0-part2",
                "/dev/ram5",
                "/dev/disk/by-id/ata-SAMSUNG_SP2004C_S07GJ10Y302659-part1",
                "/dev/block/253:0",
                "/dev/disk/by-id/ata-SAMSUNG_SP1203N_0624J1FW319990-part1",
                "/dev/block/1:15",
                "/dev/disk/by-uuid/f600d75f-46bf-44bb-b162-1b2b707f59e2",
                "/dev/dm-2",
                "/dev/block/1:1",
                "/dev/block/8:1",
                "/dev/ram1",
                "/dev/sda1",
                "/dev/sdb1",
                "/dev/sdc1",
                "/dev/sdd1",
                "/dev/dm-3",
                "/dev/block/1:0",
                "/dev/disk/by-id/dm-name-truecrypt1",
                "/dev/ram0",
                "/dev/disk/by-uuid/296a669d-0ac3-4a74-940f-3b9a763dcf05",
                "/dev/root",
                "/dev/dm-1",
                "/dev/pve/data",
                "/dev/block/1:2",
                "/dev/block/8:2",
                "/dev/block/1:8",
                "/dev/block/1:9",
                "/dev/ram2",
                "/dev/sda2",
                "/dev/disk/by-id/dm-name-pve-data",
                "/dev/ram8",
                "/dev/ram9",
                "/dev/sdc2",
                "/dev/pve/root",
                "/dev/pve/swap",
                "/dev/disk/by-uuid/f98c8d8e-a932-4e55-ae9b-494f95f02102",
                "/dev/disk/by-uuid/3ef049b3-8572-490b-b3e4-1a0fd3f5fd1e",
                "/dev/dm-0",
                "/dev/ram15",
                "/dev/block/1:3",
                "/dev/block/1:4",
                "/dev/block/1:7",
                "/dev/disk/by-id/scsi-SATA_SAMSUNG_SP1203N0624J1FW319990-part1",
                "/dev/disk/by-id/dm-name-pve-swap",
                "/dev/disk/by-uuid/84c7f362-f9cc-4b88-bb93-cc7971735845",
                "/dev/ram3",
                "/dev/ram4",
                "/dev/ram7",
                "/dev/disk/by-id/dm-uuid-LVM-UL8spdRfXSwXJyOJNsiIUMhsFG3TnkU7BvFcKe5GC9A39YCYrbTN2qgfFQIN2Y1G"
        ]
}


So UUID are :
UL8spdRfXSwXJyOJNsiIUMhsFG3TnkU7KQF3zJQCQcBXehZob0zc2MfPgPLZRX7p
UL8spdRfXSwXJyOJNsiIUMhsFG3TnkU74EWZK7B3fSi9oeIRzkV9wJ6pmRO0scjr
UL8spdRfXSwXJyOJNsiIUMhsFG3TnkU7BvFcKe5GC9A39YCYrbTN2qgfFQIN2Y1G

3 logical volumes was inside LVM group

Can someone give more glue ?

rayfordj 08-16-2010 05:38 PM

If they are discovered and available in the LVM .cache, I would imagine they would be visible in the output of pvs; vgs; lvs, no?

If you need to manually pull the LVM2 metadata from the PV(s) in the VG(s) you should be able to use something along the lines of:
Code:

# dd if=/dev/myPVpart of=/tmp/LVM2.dd bs=512 count=48
Where /dev/myPVpart is the physical-volume of the volume-group. It could be /dev/sda2, sdb1, sdc, ..., ...

Then you could use less or strings (or similar) to grab the LVM2 metadata text from it and identify how the LVs were structured. If you are not able to bring the LV(s) up (activate) using the available LVM binaries, with the metadata you should be able to manually reassemble the LV(s) using device-mapper (dmsetup) directly to recover any data not yet overwritten as long as all the segments are available.

bjrnfrdnnd 03-24-2013 08:53 PM

lvm vg disappeared
 
Hello,

I have read this thread and saw that rayfordj had some interesting insight into lvm recovery.
I have a similar problem (http://ubuntuforums.org/showthread.php?t=2128504) and would like to know if anyone can tell me if and how I could use dmsetup in order to recover data?

haertig 03-24-2013 11:27 PM

Did you try running "vgchange -ay" ?

[edit] Oh, nevermind. I did not notice that this silly thread was TWO YEARS OLD before someone resurrected it with a necropost, and then I posted after that without checking. Sorry about that! [/edit]

rayfordj 03-25-2013 09:52 AM

@bjrnfrdnnd, see if these may not be useful to your particular situation...

Mount logical volume without a working volume group (<-- has a working dmsetup example, but you'll need to ensure your math is accurate for sector-size, extent-size, offset/starting-location, etc. for your particular configuration)

Disaster with LVM (includes reference to: http://ubuntuforums.org/showthread.php?t=1886343)


Hopefully, this'll get you on your way.


All times are GMT -5. The time now is 08:34 PM.