Skip to contentSkip to conversation

Can not use vgimportclone multiple times for the attached disk

linux-lvm Sarkar, Kaushik 3 participants 4 messages Apr 1, 2010 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi,

I successfully mounted the associated logical volume from the backup of the same machine.
Before SCSI scan I have only /dev/sda2
After SCSI bus scan (rescan-scsi-bus.sh) I can see the new disk attached to my RHEL machine.

# vgimportclone -n NEWVG /dev/sdc2

It successfully rename the VG.
#vgchange -ay NEWVG

I am able to mount the logical volumes associated with this VG to verify the backup.

After verifying I un-mounted logical volume and remove the volume group. Vgremove -f NEWVG

But the new disk /dev/sdc2 still attached
I tried to do vgimportclone again it fails

# vgimportclone -n NEWVG /dev/sdc2
Fatal: /dev/sdc2 is not a PV., error: 5

I tried to remove the physical volume labeling then tried from the fresh but still no luck.
#Pvremove -f /dev/sdc2

# rescan-scsi-bus.sh
# vgimportclone -n NEWVG /dev/sdc2
Fatal: /dev/sdc2 is not a PV., error: 5

What went wrong? What is the correct step to achieve it.

Thnx&Rgds,
KauShik SarKar

#2 lore raw
Quoted 7 lines · Kaushik

After verifying I un-mounted logical volume and remove the volume group. Vgremove -f NEWVG

But the new disk /dev/sdc2 still attached
I tried to do vgimportclone again it fails

# vgimportclone -n NEWVG /dev/sdc2
Fatal: /dev/sdc2 is not a PV., error: 5

This should be expected since you just removed the volume group.

Quoted 6 lines

I tried to remove the physical volume labeling then tried from the fresh but still no luck.
#Pvremove -f /dev/sdc2

# rescan-scsi-bus.sh
# vgimportclone -n NEWVG /dev/sdc2
Fatal: /dev/sdc2 is not a PV., error: 5

The PV was already removed - hence the "not a PV" error.

Quoted 1 line

What went wrong? What is the correct step to achieve it.

Nothing went wrong. What are you trying to do?

If you want to create a new VG from scratch, then start with pvcreate /dev/sdc2, then do vgcreate -n NEWVG /dev/sdc2.

If you wanted your old VG back, you've got problems - since you just deleted it. If you have a metadata backup, you can install it with pvcreate.

Signature · 4 lines
	      Stuart D. Gathman <[email protected]>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.
#3 lore raw
In reply to Sarkar, Kaushik
Quoted 8 lines

I successfully mounted the associated logical volume from the backup of

the same machine. Before SCSI scan I have only /dev/sda2 After SCSI bus scan (rescan-scsi-bus.sh) I can see the new disk attached to my RHEL machine.

# vgimportclone -n NEWVG /dev/sdc2
Quoted 8 lines

It successfully rename the VG.
#vgchange -ay NEWVG

I am able to mount the logical volumes associated with this VG to verify the backup.

After verifying I un-mounted logical volume and remove the volume group. Vgremove -f NEWVG

This doesn't do what you think it does!

vgremove removes the metadata from the physical volumes in the volume group, essentially destroying it. So now /dev/sdc2 is not part of a vg at all.

If you're just trying to unpresent /dev/sdc2 then you probably want to use vgexport to make the vg safe to export, then physically pull the disk. While it is possible to do, LVM does not provide a way to make the linux forget about the disk, just as you have to use a seperate script to get it to recognize it in the first place.

As Stuart says, if you tell us more about what you're trying to do maybe we can be a bit more helpful :)

As an aside vgimportclone is only necesary if the metadata is an exact clone of that from an existing pv/vg if you've run it once then you dont need to run it again on that vg because the metadata has been already altered and therefore its no longer an exact clone (the data's the same but the disk headers are different)

chris

#4 lore raw
In reply to Sarkar, Kaushik

Hi,

Sorry for my ignorance.
The culprit was "Vgremove -f NEWVG" in my step. :)

Thnx&Rgds,
KauShik SarKar
SMAI - WinQA (SMVI)
NetApp
+91-80-4184-3392 Direct
[email protected]

-----Original Message-----
From: Sarkar, Kaushik
Sent: Thursday, April 01, 2010 4:10 PM
To: '[email protected]'
Subject: Can not use vgimportclone multiple times for the attached disk

Hi,

I successfully mounted the associated logical volume from the backup of the same machine.
Before SCSI scan I have only /dev/sda2
After SCSI bus scan (rescan-scsi-bus.sh) I can see the new disk attached to my RHEL machine.

# vgimportclone -n NEWVG /dev/sdc2

It successfully rename the VG.
#vgchange -ay NEWVG

I am able to mount the logical volumes associated with this VG to verify the backup.

After verifying I un-mounted logical volume and remove the volume group. Vgremove -f NEWVG

But the new disk /dev/sdc2 still attached
I tried to do vgimportclone again it fails

# vgimportclone -n NEWVG /dev/sdc2
Fatal: /dev/sdc2 is not a PV., error: 5

I tried to remove the physical volume labeling then tried from the fresh but still no luck.
#Pvremove -f /dev/sdc2

# rescan-scsi-bus.sh
# vgimportclone -n NEWVG /dev/sdc2
Fatal: /dev/sdc2 is not a PV., error: 5

What went wrong? What is the correct step to achieve it.

Thnx&Rgds,
KauShik SarKar