All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zdenek.kabelac@gmail.com>
To: Alexander Lyakas <alex.bolshoy@gmail.com>
Cc: LVM general discussion and development <linux-lvm@redhat.com>
Subject: Re: [linux-lvm] initializing a PV, which was part of an old VG
Date: Wed, 05 Oct 2011 21:30:13 +0200	[thread overview]
Message-ID: <4E8CB045.7090103@gmail.com> (raw)
In-Reply-To: <CAGRgLy4AHJV9yFncX--aoSXbNg40LMJHtCqwMk=Y-L5RPe_dcQ@mail.gmail.com>

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

  reply	other threads:[~2011-10-05 19:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E8CB045.7090103@gmail.com \
    --to=zdenek.kabelac@gmail.com \
    --cc=alex.bolshoy@gmail.com \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.