2

I try to recover from disk crash, and while doing so, I make a mistake -- now I have to recover from two things.

So the first is recovering previous LVM configuration file for volumne group -- I have the desired file, but I when I run:

vgcfgrestore my_vol_group

I get error:

Couldn't find device with uuid jJ7dXL-2m2j-d0OC-bczy-fQak-YOj7-OhRLlW. Cannot restore Volume Group my_vol_group with 1 PVs marked as missing. Restore failed.

Which is of course true, because this disk is one that crashed. So how to restore config despite the fact I am returning to the "corrupted" scenario anyway? Something like "force restore"?

Update: timeline what happened:

  1. three disks in one LVM group -- I am happy

  2. one of the disk crashes

  3. I removed the faulty disk from my computer

  4. I wanted to remove it from LVM and repair what was left

  5. by mistake I removed entire LV which contained faulty disk

  6. I want to go back to (4)

  • @rudimeier, thank you. Yes, I wanted to remove it from logical volume as well, instead entire LV was removed from the group too. So now I want to undo this removal. As for pvcreate I assume the filename is the one with the previous LVM config? All I get is error message: "Can only set uuid on one volume at once". – greenoldman Oct 5 '16 at 15:06
  • @rudimeier, I am sorry for not being clear, I updated the question. I don't have this faulty disk in computer, since it crashed (it does not work at all). I only have the disks which work. – greenoldman Oct 5 '16 at 15:24
3

I would try it like this

  1. Add a new disk at least as big as the missing one (say /dev/sdX).

  2. Create a PV with same uuid as the missing one.

    pvcreate --restorefile YOUR-FILE --uuid J7dXL-2m2j-d0OC-bczy-fQak-YOj7-OhRLlW /dev/sdX

  3. Try again your restore command:

    vgcfgrestore --restorefile YOUR-FILE my_vol_group

See also man vgcfgrestore:

REPLACING PHYSICAL VOLUMES vgdisplay --partial --verbose will show you the UUIDs and sizes of any PVs that are no longer present. If a PV in the VG is lost and you wish to substitute another of the same size, use pvcreate --restorefile filename --uuid uuid (plus additional arguments as appropriate) to initialise it with the same UUID as the missing PV. Repeat for all other missing PVs in the VG. Then use vgcfgrestore --file filename to restore the volume group's metadata.

  • Thank you again. I don't have any replacement (especially equal in size) and I will not be replacing the faulty disk. I just want repair and mount what is left. For now all I want to do is restore previous configuration file. Just to test something I tried smaller disk (pendrive), however I get error "Couldn't find device with uuid jJ7dXL-2m2j-d0OC-bczy-fQak-YOj7-OhRLlW" – greenoldman Oct 5 '16 at 15:52
  • 1
    You could manually edit the restore file with text editor, it's not that hard. Remove all LV definitions which would use the missing PV and remove the missing PV definition. Or you could use a sparse fake device: truncate -s 1024G /tmp/BIGFILE; losetup /dev/loop1 /tmp/BIGFILE – rudimeier Oct 5 '16 at 15:53
  • Thank you, thank you, thank you! :-) Finally. I removed the entries as you wrote, and recalculated the start_extent counts, to make the numbers go linear (without a gap caused by removed drive). – greenoldman Oct 5 '16 at 15:57
  • By "YOUR-FILE", rudimeier means a file one can find in /etc/lvm/archive/. So the pvcreate command would look something like pvcreate --restorefile /etc/lvm/archive/my_vol_group_00008.vg --uuid ... – mivk Apr 21 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.