Cannot recreate LVM volume group after crash

(Last modified: 27Aug2005)

This document (10098710) is provided subject to the disclaimer at the end of this document.

fact

SUSE Linux Enterprise Server 9

LVM

symptom

Cannot recreate LVM volume group after crash

YaST ERROR: "LVM error: File descriptor 5 left open"

YaST ERROR: "LVM error: vgcreate -M2 -s 4096k lvmgroup /dev/sda1"

vgcreate lvmgroup /dev/sda1 /dev/sdb1 /dev/sdc1' returns ERROR: "/dev/lvmgroup: already exists in filesystem"

cause

The volume group and the /dev/lvmgroup symlink were not cleaned up properly

fix

Remove all references to invalid logical volumes, volume groups, physical volumes and /dev symlinks.

In the following example, there is an invalid volume, volume group and symlinks.

Invalid Logical Volumes: badvol, lvmvol
Invalid Volume Groups: badgroup, lvmgroup
Valid Logical Volume: oraclelogvol
Valid Volume Group: oraclevolgroup

lvscan
  ACTIVE            '/dev/badgroup/badvol' [66.40 GB] inherit
  ACTIVE            '/dev/oraclevolgroup/oraclelogvol' [4.50 GB] inherit

vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "badgroup" using metadata type lvm2
  Found volume group "oraclevolgroup" using metadata type lvm2

pvscan
  PV /dev/sdd1     VG badgroup         lvm2 [33.20 GB / 0    free]
  PV /dev/sde1     VG badgroup         lvm2 [33.20 GB / 0    free]
  PV /dev/dasdi1   VG oraclevolgroup   lvm2 [2.29 GB / 0    free]
  PV /dev/dasdj1   VG oraclevolgroup   lvm2 [2.29 GB / 80.00 MB free]
  PV /dev/sdc1                         lvm2 [33.20 GB]
  --snip--

lvremove /dev/badgroup/badvol
  Do you really want to remove active logical volume "badvol"? [y/n]: y
  Logical volume "badvol" successfully removed

vgremove badgroup
  Volume group "badgroup" successfully removed

pvscan
  PV /dev/sdd1                         lvm2 [33.20 GB]
  PV /dev/sde1                         lvm2 [33.20 GB]
  PV /dev/dasdi1   VG oraclevolgroup   lvm2 [2.29 GB / 0    free]
  PV /dev/dasdj1   VG oraclevolgroup   lvm2 [2.29 GB / 80.00 MB free]
  PV /dev/sdc1                         lvm2 [33.20 GB]
  --snip--

pvremove /dev/sdc1
  Labels on physical volume "/dev/sdc1" successfully wiped

pvremove /dev/sdd1
  Labels on physical volume "/dev/sdd1" successfully wiped

pvremove /dev/sde1
  Labels on physical volume "/dev/sde1" successfully wiped

NOTE: In this case three new LUNs were created and partitioned with type 0x8e (Linux LVM).

pvcreate /dev/sda1
  Physical volume "/dev/sda1" successfully created

pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created

pvcreate /dev/sdc1
  Physical volume "/dev/sdc1" successfully created

vgcreate lvmgroup /dev/sda1 /dev/sdb1 /dev/sdc1
  /dev/lvmgroup: already exists in filesystem

ls -l /dev/lvmgroup
lrwxrwxrwx   1 root root    33 Aug 23 18:49 lvmvol -> /dev/mapper/lvmgroup-lvmvol

rm -rf /dev/lvmgroup

NOTE: At this point, YaST and the commandline tools can successfully create any volume group and logical volumes needed.

.

document

Document Title: Cannot recreate LVM volume group after crash
Document ID: 10098710
Solution ID: NOVL103205
Creation Date: 25Aug2005
Modified Date: 27Aug2005
Novell Product Class:Linux

disclaimer

The Origin of this information may be internal or external to Novell. Novell makes all reasonable efforts to verify this information. However, the information provided in this document is for your information only. Novell makes no explicit or implied claims to the validity of this information.
Any trademarks referenced in this document are the property of their respective owners. Consult your product manuals for complete trademark information.