Operating System - HP-UX
1834019 Members
2970 Online
110063 Solutions
New Discussion

Need to restore logical volume - pvcreate error

 
SOLVED
Go to solution
Debbie Fleith
Regular Advisor

Need to restore logical volume - pvcreate error

Help! System Down
An HP tech had to restore disk array status to default. Now, disk from array is visible as unused in SAM, but I can't re-create the volume group, & re-add the logical volume because of this error:

"pvcreate: The physical vlume "/dev/dsk/c0t0d0" is already recorded in the /etc/lvmtab file. This is not a file I can edit. How can I remove the previous entry so I can re-add the same disk & restore?
15 REPLIES 15
Patrick Wallek
Honored Contributor

Re: Need to restore logical volume - pvcreate error

To recreate the /etc/lvmtab-

# mv /etc/lvmtab /etc/lvmtab.old

# vgscan -a
A. Clay Stephenson
Acclaimed Contributor

Re: Need to restore logical volume - pvcreate error

Hi:

You should be able to do a vgexport. e.g. vgexport /dev/vg99

Man vgexport for details.

If it ain't broke, I can fix that.
Carlos Fernandez Riera
Honored Contributor

Re: Need to restore logical volume - pvcreate error


I dont know whats your problem ( broken disk, lost of configuration...).


Begin with:

strings /etc/lvmtab # to see which vg is pointing that disk.


Then you can choose for vgexport -s -m, and try to vgimport again.

Maybe you should run vgcfgrestore....

Just ideas for a beginning...



unsupported
Helen French
Honored Contributor

Re: Need to restore logical volume - pvcreate error

Hi,

try this

# mv /etc/lvmtab /etc/lvmtab.org
# vgscan -a

Or try vgexporting the VG

# vgexport /dev/vgxx

HTH,
Shiju
Life is a promise, fulfill it!
James R. Ferguson
Acclaimed Contributor
Solution

Re: Need to restore logical volume - pvcreate error

Hi Debbie:

As SAM things the disk is unused, I presume that it was replaced. Therefore, you should be able to do:

# vgcfgrestore -n /dev/vgNN /dev/rdsk/cXtYdZ
# vgchange -a y /dev/vgNN

...to restore the LVM information and then reload your data from backup.

Regards!

...JRF...


Sanjay_6
Honored Contributor

Re: Need to restore logical volume - pvcreate error

Hi Debbie,

If you want to use the disk for the same vg and for the same lv as it was configure earlier, why do you want to do a "pvcreate". you can do a vgcfgrestore and this will restore the previous vg/lv info to the disk.

If you don't want to use the disk for the old vg/lv, then you have to do lvreduce and vgreduce to take the disk out of the info stored on the system.

Hope this helps.

regds
Debbie Fleith
Regular Advisor

Re: Need to restore logical volume - pvcreate error

An HP rep came out to replace the battery in the disk array and mistakenly took down the disk.

The disk array was re-initialized -- it is exactly the same physical hardware.

It was setup as /dev/vg01 before.

I'm getting lots of different suggestions here. I'll assign points to all once I get the right recommendation.
Helen French
Honored Contributor

Re: Need to restore logical volume - pvcreate error

Hi,

OK, the best option is to re-create your VG information with 'vgcfgrestore'

# vgcfgrestore -n /dev/vg01 /dev/rdsk/c0t0d0

This will recreate all your VG information on the disk. Then activate your VG

# vgchange -a y /dev/vg01
# vgdisplay -v /dev/vg01

Create file systems on the LVs

# newfs -F FS_type /dev/vg01/rlvol1 ( for all LV)

# mount -a ( assuming all mount options are defined in the /etc/fstab)

Then restore your data from backup.

HTH,
Shiju
Life is a promise, fulfill it!
Sanjay_6
Honored Contributor

Re: Need to restore logical volume - pvcreate error

Hi Debbie,

This is what we do,

Say we have 6 disk in one Vg, for eg: vg01

disk 4 (c4t4d0) goes bad. We get it replaced. Now to bring it back to the vg01, we just do a vgcfgrestore to this disk,

vgcfgrestore -n vg01 /dev/rdsk/c4t4d0

Then do a vgactivate the vg to activate the disk in the vg,

vgchange -a y /dev/vg01
Now do a vgsync to rebuild any mirrors, This may take some time, if the mirror is being rebuilt. depends on size

vgsync /dev/vg01

Then do a vgdisplay to check that the disk is indeed added and active,

vgdisplay -v /dev/vg01 |pg

This should show all the 6 disks in the list and all the lv's as available/syncd.

Hope this helps.

regds
Patrick Wallek
Honored Contributor

Re: Need to restore logical volume - pvcreate error

If the disk array was reinitialized, do your LUNs still exist on the array as you had them set up before? If not, you may need to recreate the LUNs on the array.
Sanjay_6
Honored Contributor

Re: Need to restore logical volume - pvcreate error

Hi Debbie,

Here is a link which might be useful to you. Now as well as in future,

http://us-support2.external.hp.com/cki/bin/doc.pl/sid=defa14690833a01079/screen=ckiDisplayDocument?docId=200000058036738

Hope this helps.

regds
Debbie Fleith
Regular Advisor

Re: Need to restore logical volume - pvcreate error

Do the vgrestore & vgchange commands need to be done in single user mode?

Any other precautions necessary?
Helen French
Honored Contributor

Re: Need to restore logical volume - pvcreate error

Hi,

No, you can use these commands in multiuser mode too. Make sure you are giving correct parameters ( vg_name, pv_name).

Good luck !

HTH,
Shiju
Life is a promise, fulfill it!
Patrick Wallek
Honored Contributor

Re: Need to restore logical volume - pvcreate error

vgchange and vgcfgrestore can be done while up in multi-user mode.
Sanjay_6
Honored Contributor

Re: Need to restore logical volume - pvcreate error

Hi,

you can run "vgcfgrestore" and "vgchange" commands in multi-user mode. You can run these commands even if the vg01 is active.

Hope this helps.

Regds