pvcreate recovery?

 
Doug O'Leary
Honored Contributor

pvcreate recovery?

Hey;

I have a client that accidentally pvcreate -f a bunch of disks that he was hoping to use as a warm backup during a data migration.

Each disk was pvcreated. I have a list of which disks were in which volume group. Is there a way to convince these disks that they all have the same vgid again so I can import them?

Even some adb hacking would help. I'm really hoping that he's not going to need this data, but in case he does, I'd like to be ready with a procedure for getting at the things.

I told him earlier in the day: a good script will make an admin's day... A bad one will ruin it.

Thanks for any hints/tips/suggestions.

Doug O'Leary

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
7 REPLIES 7
Matti_Kurkela
Honored Contributor

Re: pvcreate recovery?

How about vgcfgrestore?

Of course, if you have an on-going data migration, finding the correct /etc/lvmconf/*.conf backup files that describe the configuration of these disks might take some doing...

MK
MK
James R. Ferguson
Acclaimed Contributor

Re: pvcreate recovery?

Hi Doug:

I agree with Matti - 'vgcfgrestore' might be a viable option [ and I agree with you too regarding scripts :-) ].

A 'pvcreate' is going to write a skeletal LVM header including a new PVID and a zero-value VGID. Worse, the logical volume information is gone, too.

Regards!

...JRF...
Doug O'Leary
Honored Contributor

Re: pvcreate recovery?

Hey;

vgcfgrestore isn't going to work; there were so many lvm commands flying about that there's no way to recover the right one...

I have the original sizes of the lvs; if push comes to shove, I can regenerate them and they can restore from tape. It's just not the near-line backup, or quick backout plan they were hoping to have.

It is what it is, though. Thanks.

Doug O'Leary


------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Johnson Punniyalingam
Honored Contributor

Re: pvcreate recovery?

Hi Doug,

This was my experience too, Just wanna share ..:)

once we have done " pvcreate -f " we are in the unsecured "Territory" .. :(

this was Once my best collogues "SYSADMIN" GREATEST BLENDOURS" using "pvcreate -f " Oracle Clustered Server" oops .. oops

Thanks,
Johnson
Problems are common to all, but attitude makes the difference
Suraj K Sankari
Honored Contributor

Re: pvcreate recovery?

Hi,

Once you give pvcreate -f everything will wash out from disk, to get back data from this type of case may some 3rd party tools will work.

If itâ s an important data and you donâ t have backup copy of its, then better contact those persons who are expert to get data from damage disks and all.


Suraj
Wim Rombauts
Honored Contributor

Re: pvcreate recovery?

And still, if you have done a pvcreate -f over an existing volume, but you have NOT done any vg commands on the volume group that was overwritten : use vgcfgrestore.

If no volumegroup has been created on these disks yet, you can start to vgcfgrestore immediatley. Otherwise, you better first vgreduce the accidental VG from those disks.

vgcfgrestore will bring back the original LVM configuration to that disk. Not the data dthat was on it. So I hope for you that you hve bckups at hand, or that your LV's were mirrored and that the other half of the mirror is still there.
Doug O'Leary
Honored Contributor

Re: pvcreate recovery?

Hey;

thanks all; the vgcfgrestore wouldn't work because there were numerous lvm commands since then on vgs of the same name - not on those disks, mind you, but on other disks that were being used as the same vg name. There was a backup too, so restoring the data was always a possibility. That's why I wasn't overly concerned. The fallback for the whole migration, though, was mount the old disks and start up... Once the errant pvcreate happened, that wouldn't have been possible.

All's well; the migration worked, so no failback.

Thanks again;

Doug O'Leary

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html