* [linux-lvm] initializing a PV, which was part of an old VG
@ 2011-10-05 15:20 Alexander Lyakas
2011-10-05 19:30 ` Zdenek Kabelac
2011-10-05 19:34 ` Stuart D. Gathman
0 siblings, 2 replies; 7+ messages in thread
From: Alexander Lyakas @ 2011-10-05 15:20 UTC (permalink / raw)
To: Zdenek Kabelac, LVM general discussion and development
Hello Zdenek,
I am frequently hitting issues when trying to create a new VG on a PV
that had existing VG. (This PV is usually an MD raid0 or raid1
device). I am wondering what is the correct procedure to completely
wipe out any remains of LVM signatures from a PV, and initialize the
PV afresh?
Here is what I do: for each new VG, I use a new GUID as part of its
name, to avoid VG name conflicts.
To try to handle the old VG, the VG creation code first calls
lvm_vg_name_from_device(pv_name). If it founds a VG there and succeeds
to open it, it goes over its LVs, and tries to deactivate them and
then removes them. Finally, the code removes the old VG itself. In
some cases, however, the code fails to open the old VG, so it
proceeds.
Next thing I call pvcreate (fork/exec) to initialize the PV (I always
use --force twice). After this is completed, I do lvm_scan(), because
pvcreate ran in a different context, and I want to refresh the LVM
cache of my process (makes sense?). Finally, I do lvm_vg_create,
lvm_vg_extend, lvm_vg_write.
Sometimes I hit problems like following:
- I want to create a VG named pool_9644BCB5D4704164976DBD85E471EAAA
with a single PV (/dev/md2)
- lvm_vg_name_from_device() returns the name of an old VG:
pool_6A5C57F39FFB4C609D5438D1FCCCDDF0
- lvm_vg_open() fails to open this old VG
- pvcreate(/dev/md2) output:
STDOUT:
Physical volume "/dev/md2" successfully created
STDERR:
Couldn't find device with uuid NCtRLE-1ffs-GLaH-MYNS-d1hk-ikAt-7dbhm0.
Writing physical volume data to disk "/dev/md2"
After lvm_scan(),lvm_vg_create(pool_9644BCB5D4704164976DBD85E471EAAA),
lvm_vg_extend(), lvm_vg_write(), the syslog shows:
Wiping cache of LVM-capable devices
get_pv_from_vg_by_id: vg_read_internal failed to read VG
pool_74C7247AE06F4B7DAC557D9A1842EEBD
Adding physical volume '/dev/md2' to volume group
'pool_9644BCB5D4704164976DBD85E471EAAA'
Creating directory "/etc/lvm/archive"
Archiving volume group "pool_9644BCB5D4704164976DBD85E471EAAA"
metadata (seqno 0).
While pool_74C7247AE06F4B7DAC557D9A1842EEBD is yet some other old VG.
At this point the VG seems to be created ok. But later, when I try to
create first LV, syslog shows:
Wiping cache of LVM-capable devices
Couldn't find device with uuid NCtRLE-1ffs-GLaH-MYNS-d1hk-ikAt-7dbhm0.
Couldn't find device with uuid NCtRLE-1ffs-GLaH-MYNS-d1hk-ikAt-7dbhm0.
There are 1 physical volumes missing.
Cannot change VG pool_9644BCB5D4704164976DBD85E471EAAA while PVs are missing.
Consider vgreduce --removemissing.
Why does LVM think that my new VG has PVs missing? Probably it thinks
that this PV belongs to another VG? But it looks like LVM agreed to
add the PV to the new VG.
Is there anything else I am missing?
Thanks,
Alex.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-lvm] initializing a PV, which was part of an old VG
2011-10-05 15:20 [linux-lvm] initializing a PV, which was part of an old VG Alexander Lyakas
@ 2011-10-05 19:30 ` Zdenek Kabelac
2011-10-06 8:47 ` Alexander Lyakas
2011-10-05 19:34 ` Stuart D. Gathman
1 sibling, 1 reply; 7+ messages in thread
From: Zdenek Kabelac @ 2011-10-05 19:30 UTC (permalink / raw)
To: Alexander Lyakas; +Cc: LVM general discussion and development
Dne 5.10.2011 17:20, Alexander Lyakas napsal(a):
> Hello Zdenek,
>
> I am frequently hitting issues when trying to create a new VG on a PV
> that had existing VG. (This PV is usually an MD raid0 or raid1
> device). I am wondering what is the correct procedure to completely
> wipe out any remains of LVM signatures from a PV, and initialize the
> PV afresh?
>
util-linux comes with wipefs - to wipe fs & raid signatures
pvremove should wipe label of LVM device - so it should not be recognized as PV.
You may try to use blkid to see how is the device recognized.
> Here is what I do: for each new VG, I use a new GUID as part of its
> name, to avoid VG name conflicts.
>
> To try to handle the old VG, the VG creation code first calls
> lvm_vg_name_from_device(pv_name). If it founds a VG there and succeeds
> to open it, it goes over its LVs, and tries to deactivate them and
> then removes them. Finally, the code removes the old VG itself. In
> some cases, however, the code fails to open the old VG, so it
> proceeds.
>
removal of VG doesn't wipe PV headers
> Next thing I call pvcreate (fork/exec) to initialize the PV (I always
> use --force twice). After this is completed, I do lvm_scan(), because
Using -ff is probably a problem here - it's supposed to only used in case you
really need it - it's not a 'nice' option.
So first vgremove the VG which occupies your PVs - then pvremove should work
without -ff.
> - pvcreate(/dev/md2) output:
> STDOUT:
> Physical volume "/dev/md2" successfully created
> STDERR:
> Couldn't find device with uuid NCtRLE-1ffs-GLaH-MYNS-d1hk-ikAt-7dbhm0.
> Writing physical volume data to disk "/dev/md2"
>
> After lvm_scan(),lvm_vg_create(pool_9644BCB5D4704164976DBD85E471EAAA),
> lvm_vg_extend(), lvm_vg_write(), the syslog shows:
>
> Wiping cache of LVM-capable devices
> get_pv_from_vg_by_id: vg_read_internal failed to read VG
> pool_74C7247AE06F4B7DAC557D9A1842EEBD
> Adding physical volume '/dev/md2' to volume group
> 'pool_9644BCB5D4704164976DBD85E471EAAA'
> Creating directory "/etc/lvm/archive"
> Archiving volume group "pool_9644BCB5D4704164976DBD85E471EAAA"
> metadata (seqno 0).
>
> While pool_74C7247AE06F4B7DAC557D9A1842EEBD is yet some other old VG.
> At this point the VG seems to be created ok. But later, when I try to
> create first LV, syslog shows:
>
> Wiping cache of LVM-capable devices
> Couldn't find device with uuid NCtRLE-1ffs-GLaH-MYNS-d1hk-ikAt-7dbhm0.
> Couldn't find device with uuid NCtRLE-1ffs-GLaH-MYNS-d1hk-ikAt-7dbhm0.
> There are 1 physical volumes missing.
> Cannot change VG pool_9644BCB5D4704164976DBD85E471EAAA while PVs are missing.
> Consider vgreduce --removemissing.
Have you pvremove-d all PV devices ?
Zdenek
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-lvm] initializing a PV, which was part of an old VG
2011-10-05 15:20 [linux-lvm] initializing a PV, which was part of an old VG Alexander Lyakas
2011-10-05 19:30 ` Zdenek Kabelac
@ 2011-10-05 19:34 ` Stuart D. Gathman
1 sibling, 0 replies; 7+ messages in thread
From: Stuart D. Gathman @ 2011-10-05 19:34 UTC (permalink / raw)
To: LVM general discussion and development; +Cc: Zdenek Kabelac
On Wed, 5 Oct 2011, Alexander Lyakas wrote:
> I am frequently hitting issues when trying to create a new VG on a PV
> that had existing VG. (This PV is usually an MD raid0 or raid1
> device). I am wondering what is the correct procedure to completely
> wipe out any remains of LVM signatures from a PV, and initialize the
> PV afresh?
pvremove /dev/xxxx
--
Stuart D. Gathman <stuart@bmsi.com>
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-lvm] initializing a PV, which was part of an old VG
2011-10-05 19:30 ` Zdenek Kabelac
@ 2011-10-06 8:47 ` Alexander Lyakas
2011-10-06 13:11 ` Stuart D. Gathman
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Lyakas @ 2011-10-06 8:47 UTC (permalink / raw)
To: Zdenek Kabelac; +Cc: LVM general discussion and development
Zdenek,
yes, I only had a single PV, and I did pvcreate on it, and then
lvm_scan() from my process.
So you suggest to use first pvremove and then pvcreate? Because
pvcreate I do in any case. So pvcreate alone is not similar to
pvremove followed by pvcreate?
If I use -ff, does it do things differently, than if I would call
pvremove/pvcreate without -ff? Should I do first without -ff and use
-ff only if the former fails?
Thanks,
Alex.
On Wed, Oct 5, 2011 at 9:30 PM, Zdenek Kabelac <zdenek.kabelac@gmail.com> wrote:
> Dne 5.10.2011 17:20, Alexander Lyakas napsal(a):
>>
>> Hello Zdenek,
>>
>> I am frequently hitting issues when trying to create a new VG on a PV
>> that had existing VG. (This PV is usually an MD raid0 or raid1
>> device). I am wondering what is the correct procedure to completely
>> wipe out any remains of LVM signatures from a PV, and initialize the
>> PV afresh?
>>
>
> util-linux comes with �wipefs �- to wipe fs & raid signatures
> pvremove should wipe label of LVM device - so it should not be recognized as
> PV.
>
> You may try to use blkid to see how is the device recognized.
>
>> Here is what I do: for each new VG, I use a new GUID as part of its
>> name, to avoid VG name conflicts.
>>
>> To try to handle the old VG, the VG creation code first calls
>> lvm_vg_name_from_device(pv_name). If it founds a VG there and succeeds
>> to open it, it goes over its LVs, and tries to deactivate them and
>> then removes them. Finally, the code removes the old VG itself. In
>> some cases, however, the code fails to open the old VG, so it
>> proceeds.
>>
>
> removal of VG doesn't wipe PV headers
>
>
>> Next thing I call pvcreate (fork/exec) to initialize the PV (I always
>> use --force twice). After this is completed, I do lvm_scan(), because
>
> Using -ff is probably a problem here - it's supposed to only used in case
> you really need it - it's not a 'nice' option.
>
> So first �vgremove �the VG which occupies your PVs - then pvremove should
> work
> without -ff.
>
>
>> - pvcreate(/dev/md2) output:
>> STDOUT:
>> � � � �Physical volume "/dev/md2" successfully created
>> STDERR:
>> � � � �Couldn't find device with uuid
>> NCtRLE-1ffs-GLaH-MYNS-d1hk-ikAt-7dbhm0.
>> � � � �Writing physical volume data to disk "/dev/md2"
>>
>> After lvm_scan(),lvm_vg_create(pool_9644BCB5D4704164976DBD85E471EAAA),
>> lvm_vg_extend(), lvm_vg_write(), the syslog shows:
>>
>> Wiping cache of LVM-capable devices
>> get_pv_from_vg_by_id: vg_read_internal failed to read VG
>> pool_74C7247AE06F4B7DAC557D9A1842EEBD
>> Adding physical volume '/dev/md2' to volume group
>> 'pool_9644BCB5D4704164976DBD85E471EAAA'
>> Creating directory "/etc/lvm/archive"
>> Archiving volume group "pool_9644BCB5D4704164976DBD85E471EAAA"
>> metadata (seqno 0).
>>
>> While pool_74C7247AE06F4B7DAC557D9A1842EEBD is yet some other old VG.
>> At this point the VG seems to be created ok. But later, when I try to
>> create first LV, syslog shows:
>>
>> Wiping cache of LVM-capable devices
>> Couldn't find device with uuid NCtRLE-1ffs-GLaH-MYNS-d1hk-ikAt-7dbhm0.
>> Couldn't find device with uuid NCtRLE-1ffs-GLaH-MYNS-d1hk-ikAt-7dbhm0.
>> There are 1 physical volumes missing.
>> Cannot change VG pool_9644BCB5D4704164976DBD85E471EAAA while PVs are
>> missing.
>> Consider vgreduce --removemissing.
>
> Have you pvremove-d all PV devices ?
>
> Zdenek
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-lvm] initializing a PV, which was part of an old VG
2011-10-06 8:47 ` Alexander Lyakas
@ 2011-10-06 13:11 ` Stuart D. Gathman
2011-10-09 19:47 ` Alexander Lyakas
0 siblings, 1 reply; 7+ messages in thread
From: Stuart D. Gathman @ 2011-10-06 13:11 UTC (permalink / raw)
To: LVM general discussion and development; +Cc: Zdenek Kabelac
On Thu, 6 Oct 2011, Alexander Lyakas wrote:
> yes, I only had a single PV, and I did pvcreate on it, and then
> lvm_scan() from my process.
>
> So you suggest to use first pvremove and then pvcreate? Because
> pvcreate I do in any case. So pvcreate alone is not similar to
> pvremove followed by pvcreate?
Yes, you need to pvremove first to start from scratch.
--
Stuart D. Gathman <stuart@bmsi.com>
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-lvm] initializing a PV, which was part of an old VG
2011-10-06 13:11 ` Stuart D. Gathman
@ 2011-10-09 19:47 ` Alexander Lyakas
2011-10-10 13:20 ` Stuart D. Gathman
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Lyakas @ 2011-10-09 19:47 UTC (permalink / raw)
To: LVM general discussion and development; +Cc: Zdenek Kabelac
Thank you Stuart,
I will add a call to pvremove -ff before pvcreate.
Alex.
On Thu, Oct 6, 2011 at 3:11 PM, Stuart D. Gathman <stuart@bmsi.com> wrote:
> On Thu, 6 Oct 2011, Alexander Lyakas wrote:
>
>> yes, I only had a single PV, and I did pvcreate on it, and then
>> lvm_scan() from my process.
>>
>> So you suggest to use first pvremove and then pvcreate? Because
>> pvcreate I do in any case. So pvcreate alone is not similar to
>> pvremove followed by pvcreate?
>
> Yes, you need to pvremove first to start from scratch.
>
> --
> � � � � � � �Stuart D. Gathman <stuart@bmsi.com>
> � �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.
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-lvm] initializing a PV, which was part of an old VG
2011-10-09 19:47 ` Alexander Lyakas
@ 2011-10-10 13:20 ` Stuart D. Gathman
0 siblings, 0 replies; 7+ messages in thread
From: Stuart D. Gathman @ 2011-10-10 13:20 UTC (permalink / raw)
To: LVM general discussion and development; +Cc: Zdenek Kabelac
On Sun, 9 Oct 2011, Alexander Lyakas wrote:
> I will add a call to pvremove -ff before pvcreate.
You shouldn't need the -ff with pvremove.
--
Stuart D. Gathman <stuart@bmsi.com>
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-10-10 13:21 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-05 15:20 [linux-lvm] initializing a PV, which was part of an old VG Alexander Lyakas
2011-10-05 19:30 ` Zdenek Kabelac
2011-10-06 8:47 ` Alexander Lyakas
2011-10-06 13:11 ` Stuart D. Gathman
2011-10-09 19:47 ` Alexander Lyakas
2011-10-10 13:20 ` Stuart D. Gathman
2011-10-05 19:34 ` Stuart D. Gathman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).