1833624 Members
3496 Online
110062 Solutions
New Discussion

lvm lvol rebuild advice

 
Steve Mills_1
Occasional Contributor

lvm lvol rebuild advice

Hello,

I'm trying to rebuild a volume group, that was accidently removed, all I have is an old bdf.
There is no backup of any kind - tape/vgexport mapfile etc.

For the majortity of the lvols it was a case of create the lvols in the logical numerical order. And then they mounted OK.
However, I am at a point where there has been some lvextends of existing lvols intermingled with lvcreates of new ones, and therefore I don't know to which logical volume the 'next' physical extent belongs.

Trial and and error, is an obvious unattractive solution.

So, is there another way I could read, for example, the superblock of a partially restructured lvol, to find out which data blocks it references, and link this to the order of extents on the physical volume?

Any ideas appreciated.

Cheers
Steve

5 REPLIES 5
Patrick Wallek
Honored Contributor

Re: lvm lvol rebuild advice

Do you know which disk or disks the VG was on? I assume you do since you are attempting to rebuild from scratch.

The easiest thing to try from the beginning would have been a vgimport.

You could run it like:

# vgimport -v /dev/vg?? /dev/dsk/c?t?d? /dev/dsk/c?t?d?

And just specify all disks that were part of that VG.

Since you have already started trying to recreate the VG and LVs, I don't know if this will work or not, but I guess you could give it a shot.

By the way, see why you always need to have some kind of backup? :)
S.K. Chan
Honored Contributor

Re: lvm lvol rebuild advice

This will depends on whether you use a different name for your LVs rather that stick with the default naming (eg :lvol1, lvol2, etc, etc). If you let the VG uses its default naimg convention for LVs and if you know which disks belongs to this VG (say vg03) - you should be able to "strings /etc/lvmtab" to find this out .. if you did not use vgexport to remove vg03 accidently, then this should work ..
# vgimport /dev/vg03 /dev/dsk/ /dev/dsk/ ...
Assuming the device files /dev/vg03/group is still there.
Mike_305
Super Advisor

Re: lvm lvol rebuild advice

Hi,

Try using vgcfgrestore.

Restore LVM configuration information stored for /dev/rdsk/c0t7d0 in default configuration file /etc/lvmconf/vg01.conf to physical volume /dev/rdsk/c0t6d0:

vgcfgrestore -n /dev/vg01 - o /dev/rdsk/c0t7d0 /dev/rdsk/c0t6d0

Also if this work then you might have to do vgchange and activate the volume group.

vgchange -a y /dev/vg01

Good Luck!

Thanks,

Mike
If there is problem then don't think as problem, think as opportunity.
Deshpande Prashant
Honored Contributor

Re: lvm lvol rebuild advice

Hi
You could use the information in /etc/lvmconf dir for the said VG to restore using vgcfgrestore.

Thanks.
Prashant.
Take it as it comes.
James R. Ferguson
Acclaimed Contributor

Re: lvm lvol rebuild advice

Hi Steve:

'vgcfgrestore' would have been my first choice. *However* from the description you have given, I suspect that you started by recreating not only the volume group ('vgcreate') but the logical volumes with 'lvcreate', too.

Unless you turned *off* the 'autobackup' option (the default is *on*), then you overwrote '/etc/lvmconf/vgXX.conf' (and subsequently '/etc/lvmconf/vgXX.conf.old') everytime you performed an LVM operation. See the man pages for any of the commands you used.

Unless you have an old alternate configuration backup file of "the way it was", 'vgcfgrestore' isn't a viable option.

Regards!

...JRF...