Novell is now a part of Micro Focus

Overcoming LVM errors upon re-installation of SUSE Linux Enterprise Server

Novell Cool Solutions: Feature
By Kirk Coombs

Digg This - Slashdot This

Posted: 4 May 2005

Some users experience problems when reinstalling a SLES system that contains LVM volumes. When re-creating the partition table exactly as it was before, an error in YAST similar to the following appears:

LVM error
vgcreate -M2 -A n -s 4096k system /dev/sda3
   /dev/system: already exists in filesystem

The Cause

The problem manifests itself when deleting the existing partition table without using the YAST partitioner to individually delete each partition. Examples that would cause the problem include using a tool such as fdisk or parted, or selecting "expert -> Delete partition table and disk label" in the YAST expert partitioner.

When using LVM, the information about the volume groups and logical partitions is stored in the first couple kilobytes of the LVM partitions. When these partitions are simply deleted from the partition table, the old LVM configuration information is still contained at the sectors where the old partitions existed. When new LVM partitions are created at these same sectors, the old volumes are detected and cause the above error.

The Solution

*Note* - Remember to make a back-up of any important data. The following procedures will destroy any data stored on the old LVM volumes.

In order to avoid this situation, the first few kilobytes of the old partitions must be overwritten to remove the old LVM configuration. The YAST partitioner does this automatically. Simply start the SLES install as normal, and then enter the partitioning module. Select "Create custom partition setup" then "Custom partitioning - for experts" and delete all the LVM partitions. Remove any logical volumes and volume groups prior to removing the physical partitions. The LVM partitions, volume groups, and logical volumes can now be re-created without any problem.

If the partitions have already been deleted by using fdisk, parted, or another means, and YAST is giving the above error when re-creating them, do the following:

  1. YAST should have already re-created the partition table. Note which partitions are part of the LVM (/dev/sda3 and /dev/sda4, for this example).
  2. Reboot the system with SLES CD1 in the drive.
  3. Select "Rescue System" and log-in as root.
  4. Wipe out the first couple kilobytes of the LVM partitions, removing the old configuration:

  5. dd if=/dev/zero of=/dev/sda3 bs=2048 count=1
    dd if=/dev/zero of=/dev/sda4 bs=2048 count=1  

  6. Restart the system, and begin a new install. The new LVM set-up can now be created.
That should set things straight.

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.

© Copyright Micro Focus or one of its affiliates