1

My idea was to simulate such situation on VirtualBox as: some crash happened with my hard disk drive, but I had had LVM and it was not a big deal to restore data using it. My steps were:

step1: initialization of disks:

pvcreate /dev/sdb
pvcreate /dev/sdc
pvcrete /dev/sdd

step2: Creation of physical volume group:

vgcreate vg1 /dev/sdb /dev/sdc /dev/sdd

step3: Creation of a logical volume with mirror:

lvcreate -L 1.5G -m2 -n mir vg1

step4: Creation of mount point for mir logical volume

sudo mkdir mnt/mir
sudo mkfs.ext4 /dev/vg1/mir

step5: Then I add entry about mir to the /etc/fstab

step6: Mounting of a mir:

mount -t ext4 /dev/vg1/mir /mnt/mir

step7: Then I shut down my VirtualBox and deleted /dev/sdd

step8: Found out which of these disks were missing

lvscan

step9: Looked for the last archive in lvm:

ls -l /etc/lvm/archive/vg1*

step10: Found out the missing ID:

less /etc/lvm/archive/vg1_00003-1776947519

The output was: BgR0KJ-JClh-T2gS-k6yK-9RGn-B8Ls-LYPQP0

step11: I tried to restore physical volume using this command:

pvcreate -ff --uuid "BgR0KJ-JClh-T2gS-k6yK-9RGn-B8Ls-LYPQP0" --restorefile /etc/lvm/archive/vg1_00003-1776947519.vg /dev/sdd

step12: Restoration of the group and sudden failure at the end:

vgcfgrestore -f /etc/lvm/archive/vg1_00003-1776947519.vg vg1

After pressing Enter key I got this:

Couldn't find device with uuid kgH6Qb-0Ao3-oZ1Q-HKrz-2FWk-GLez-meCjLU PV unknown device missing from cache Format-specific setup for unknown device failed Restore failed

So another one uuid disappeared. At this point I just stuck and have not known what to do till now. So the question is to find solution to restore physical group, logical group and data from disk which was deleted from VirtualBox. I would really appreciate for any proposes.

2 Answers 2

0

Devices UUIDs change after you (re)create them, or try to replicate a server on a new machine. You can force to set a uuid on hard disks.

tune2fs /dev/{device} -U {uuid}

Be aware is easier to do this to unmounted file systems.

0

May be I am missing something, but basically I see no way to restore data in this scenario, because there is no redundancy approach set at first place. I mean something like software RAID or so.

You see, when you add these PVs in the VG, the LVM abstraction algorithm divides the data among the three. When you delete one of these, basically its data share is being completely destroyed and the data pool is corrupted and incomplete.

It is possible to restore the VG, but IMO it's not possible to restore the data in it's original state.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .