# vgcreate --> “Command failed with status code 5.” what does this mean?

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

-
You mean that the partition type is LVM, right? –  Matt Simmons Jan 8 '10 at 7:10
What happens when you type "pvdisplay"? –  Matt Simmons Jan 8 '10 at 7: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 8 '10 at 7:41
found this: 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 8 '10 at 7:52
Poor formatting in comments is why you're supposed to edit your question to add information like that. –  womble Jan 8 '10 at 8:15

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

-

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).

-

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.

-

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.

-