8

i'm playing around w/ LVM on a centos domU in a xen-based vps. I'm in rescue mode and I've created one physical volume (pvcreate /dev/xvda1) for my entire drive, which is formatted as LVM. i'm now trying to create a volume group using vgcreate main /dev/xvda1, but it's returning "Command failed with status code 5.". I've been unable to find an explanation for this error code. does anyone know what it means?

for what it's worth, my goal is to create multiple logical volumes on my drive using lvm.

thanks

erik
  • 89
  • 1
  • 1
  • 2
  • You mean that the partition type is LVM, right? – Matt Simmons Jan 08 '10 at 07:10
  • What happens when you type "pvdisplay"? – Matt Simmons Jan 08 '10 at 07:11
  • thank for the help, Matt. yes, the partition type is lvm. running pvdisplay outputs (this displays badly, so I'm using | to denote an endline): "/dev/xvda1" is a new physical volume of "6.00 GB" | --- NEW Physical volume --- | PV Name /dev/xvda1 | VG Name | PV Size 6.00 GB | Allocatable NO | PE Size (KByte) 0 | Total PE 0 | Free PE 0 | Allocated PE 0 | PV UUID sMR01N-ZFqb-Us3J-IhMj-FI1V-WjdV-r70yhQ | – erik Jan 08 '10 at 07:41
  • found this: http://pwet.fr/man/linux/administration_systeme/lvm_10/vgcreate it says "5 (denotes) maximum number of volume groups exceeded", but vgscan shows nothing – erik Jan 08 '10 at 07:52
  • 1
    Poor formatting in comments is why you're supposed to edit your question to add information like that. – womble Jan 08 '10 at 08:15
  • `vgcreate -d main /dev/bla` -the -d flag will give you debugging into. – BuildTheRobots Jan 10 '10 at 20:30

4 Answers4

6

I was having this same problem with a CentOS recovery disc on a Xen system. Turns out the error code is due to a read-only file system, specifically /etc/lvm is read-only. Quick fix, as suggested by this blog entry, is to create a tmpfs over /etc/lvm to enable writing. This worked for me.

mgorven
  • 30,036
  • 7
  • 76
  • 121
Bryan
  • 61
  • 1
  • 2
2

from the comments it looks like your pv is already corrupt: Total PE 0. recreate your pv and try it again.

Christian
  • 4,645
  • 2
  • 23
  • 27
1

For future reference, try:

vgcreate -v main /dev/xvda1

To get more idea of what is going wrong. In my case, the error occurred because /etc/lvm wasn't writeable to create backups.

  • In my case the problem was read only partition with `/etc/lvm/`. `vgcreate` failed when it was trying to write `/etc/lvm/archive`. – pevik Nov 04 '16 at 11:15
0

Christion is certainly right. In addition, you can probably start playing with lvm using system-config-lvm, before going deeper with the command-line (of course, not in rescue mode).

Flo
  • 85
  • 4