Operating System - HP-UX
1752779 Members
6160 Online
108789 Solutions
New Discussion юеВ

To recover LVM volume group, even if pvremove was executed on PVs

 
Senthil Kumar .A_1
Honored Contributor

To recover LVM volume group, even if pvremove was executed on PVs

The procedure's outlined here is purely the result for some tests I performed on a test HPUX box in my organization. I'm not too sure whether the following procedures are already in place in HP. But, this is my earnest effort in sharing the knowledge I have gained: to my HPUX peers so as to make the HPUX admins more prepared incase of some unusual situations that might be encountered in LVM parlance.

As a point adder ├в I love LVM, Though it might be considered ,complex in implementation compared to whole disk methods and disk partition methods, that existed in so called Jurassic era ;) , I reckon its more easier to recover compared to VXVM├в . I'm in the no process of inflicting any harm to VXVM. I love VXVM for its flexibility that it provides in the enterprise environment. I love VXVM in its own right and am a big fan of its technological capacities in the Volume management environment.

So let me stop bugging you with the boring introduction and get ahead with what I attempted to do, so here on it will get more technical├в ┬ж Please go through the attached DOC.
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
9 REPLIES 9
Thayanidhi
Honored Contributor

Re: To recover LVM volume group, even if pvremove was executed on PVs

Hi,
The procedure looks fine. If you repeat same commands (which were used initially) you should get your data back.
E.g. when you create VG, ensure same PE size defined.

Best regards
TT
Attitude (not aptitude) determines altitude.
Steven E. Protter
Exalted Contributor

Re: To recover LVM volume group, even if pvremove was executed on PVs

Shalom senthil

Even if you run pvremove on a physical volume, its usually possible to run vgconfigrestore on the same physical volume and recover the configuration and probably not even necessary to restore the data.

Your outcome may vary.

Please take the time to publish your results and issues when the testing is complete.

Having read your document, I would expect the outcome that the document predicts. My suggestion above may be able to speed the recovery process, but I can see why you'd want to do it your way.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Thayanidhi
Honored Contributor

Re: To recover LVM volume group, even if pvremove was executed on PVs

Hi SEP,

I am not too sure LV to PE layout will be retained while doing "vgcfgrestore"?
In his example each LV's PE are not contiguous.

Regds
TT
Attitude (not aptitude) determines altitude.
Senthil Kumar .A_1
Honored Contributor

Re: To recover LVM volume group, even if pvremove was executed on PVs

Hi Guys,

Thanx for reading my thread. I hope it helps.

SEP : Just wondering one thing, though I haven't tried. I do agree you can use vgcfgrestore command because still the /etc/lvmconf/vg01.conf will be intact after removing the VG. But not too sure whether the sytem will accept the cammand for that VG, because it is no more in /etc/lvmtab right. But, any I will try steve's option.

PS: great guys, You are giving me different scenarios to work, I started liking LVM even more. ;)
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
Senthil Kumar .A_1
Honored Contributor

Re: To recover LVM volume group, even if pvremove was executed on PVs

Hi SEP,



This is the error message I got,

vgcfgrestore -f ./vg01.conf.old /dev/rdsk/c4t0d1
vgcfgrestore: Volume group "/dev/vg01" does not exist in the "/etc/lvmtab" file.
vgcfgrestore: Invalid LVMREC on Physical Volume /dev/rdsk/c4t0d1
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
Devender Khatana
Honored Contributor

Re: To recover LVM volume group, even if pvremove was executed on PVs

Hi Senthil,

The test is quite good and you are lucky to have some test servers with you. Allthough some more precautions should be taken in the commands used for recovery. The test scenario may not work with these commands if you recover the disk in some other system reason being -

The default PE size for different version of OS may not be same and if the vgcreate is not done having define the PE_Size, the contents might be lost. So a good choice in my opinion will be to specify the PE_Size as found in old vgdisplay output. Another option to verify the default PE_Size will be to use vgcreate on some other unused disk and see the PE_Size.

vgcfgrestore will not work as the VG does not exist in the system. Also vgcfgrestore will create LVM structure on the disk as per the properties of the VG where you are putting that disk in. Again if the PE_Size and offcourse the file system layout of the old disk differes the contents will be overwritten and will not be recoverable.

Do keep the results posted and the errors encountered?

HTH,
Devender
Impossible itself mentions "I m possible"
Mridul Shrivastava
Honored Contributor

Re: To recover LVM volume group, even if pvremove was executed on PVs

As per my understaing whole information should match with the old VG (ie PE_size as mentioned by Devendar, max PEs, max VGs, allocation policy) all these parameters must be same for both vgs only then u'll be able to recover the data if mapping is correct.
Time has a wonderful way of weeding out the trivial
Kent Ostby
Honored Contributor

Re: To recover LVM volume group, even if pvremove was executed on PVs

Senthil --

That is a good looking document. When LVM was first new to the world, there were multiple similar documents that were passed from email to email within the Response Center and within HP's internal database.

For the most part, the focus these days has been on vgcfgrestore and other more standard tools, but it never hurts to have the brute force documented someplace handy.
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Senthil Kumar .A_1
Honored Contributor

Re: To recover LVM volume group, even if pvremove was executed on PVs

I hope this document Helped,

I can see from the response that, It could help in some ways in unusual situations.

:)

Senthil Kumar .A
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)