moving a Physical Volume that to another volume group

June 3, 2006

I created a physical volume now I want to move that to another volume group but its not allowing me. How can I do this?


When initializing physical devices to be used with Logical Volume Manager (LVM) the pvcreate command writes meta data to the first 100K or so of the physical device that you want to activate. When removing this physical volume from a volume group and attempting to modify the existing partition structure, running the pvcreate command on those new partitions can cause errors. Some of these errors report back that the physical device belongs to an old volume group or that the device contains metadata.

To get around this the metadata on the physical device needs to be overwritten so the new metadata written by pvcreate can take effect. Doing this is in effect similar to a pvremove command.

Below are two example scenario's that you might have used the pvcreate command and how to wipe the metadata off those particular physical devices.

  1. Initializing an entire disk:
  2. pvcreate /dev/hda

    To delete the metadata created by initializing this physical volume use the following command:

    dd if=/dev/zero of=/dev/hda bs=512 count=1

  3. Initializing a partition with the pvcreate command:
  4. pvcreate /dev/hda2

    To delete the metadata created by initializing this physical volume use the following command:

    dd if=/dev/zero of=/dev/hda2 bs=512 count=1

This command writes zeros to the first sector of the physical volume you are trying to initialize. This does not wipe all the LVM metadata but wipes the entry point to the metadata therefore allowing you to run pvcreate on the physical device successfully.

LVM2 will contain a pvremove command voiding the need to run the dd command whenever you run into these sort of issues with LVM. Red Hat Enterprise Linux 4 will contain this version of LVM.

The information provided in this document is for your information only. The origin of this information may be internal or external to Red Hat. While Red Hat attempts to verify the validity of this information before it is posted, Red Hat makes no express or implied claims to its validity.

© 2003-2006 Red Hat, Inc. All rights reserved. This article is made available for copying and use under the Open Publication License, v1.0 which may be found at http://www.opencontent.org/openpub/.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: