2

I have a machine (guest VM running CentOS 6.5) with 2 disks. Main OS on sda and then a 2TB LVM on the second sdc.

I added 2 more 2TB disks to the machine and was going through the process of formatting then using fdisk to add to the LVM, but I fdisk'd the wrong disk, sdc. Two new disks came up as sdb and sdd. Like an idiot I didn't check fdisk -l properly before continuing.

I created a new primary partition on 1, and then over-wrote the system id again to 8e (LVM).

So sdc now has a new UUID and a new partition table.

Anyone know how I can recover this using the vgcfgrestore util? Can I just overwrite the new UUID over the old one in the vg1(volume-group-backup-file) and run the restore?

2

I did this same thing myself the other night while debugging gparted. I used dd if=/dev/zero count=1 of=/dev/sdc to wipe out the dos partition table, then pvcreate --uuid xxxx --norestorefile to reinitialize the lvm header, and finally vcfgrestore to restore from the backup in /etc/lvm/backup, which you can also look at to find what the uuid of the drive was before to give to pvcreate.

0

Thanks Psusi

This would have been far easier than what I did in the end. I used testdisk with a deep analysis to re-rediscover the underlying partition. This took a few hours as it was a 89% full 2TB drive.

Once I had found the drive and its dimension (automatically by testdisk), I wrote the changes.

One caveat though is to select intel as the partition type. if you select none, it cannot write the results that you find.

Thanks for the answer!

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.