/dev/sda1 not in a volume group, and vgextend doesn't work

steffen asked:

I’ve got several virtual machines which I access through a VMWare vSphere client (v 5.1.0).
One ran out of space and I’m trying to give it some more space.

What I’ve done so far:
– Increased provisioned size using “Edit Settings” in the “Summary” tab.
– Created a new partition (/dev/sda3) with Linux LVM system.

The problem is that there’s no volume group on the machine earlier, so I can’t follow the normal tutorials that tells me to just

vgextend VolGroup00 /dev/sda1

when I do, I get the error:

No physical volume label read from /dev/sda1
Can't open /dev/sda1/ exclusively. Mounted filesystem?
Unable to add physical volume '/dev/sda1' to volume group 'VolGroup00'.

I’ve googled all day, but can’t find out how to add /dev/sda1 to my volume group.
It’s not in any volume group at all…

Anyone got any hints or pointers?

EDIT:
Some additional data:

# fdisk -l
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 822580 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optional): 512 bytes / 512 bytes
Disk identifier: 0x000d2064

Device    Boot Start   End    Blocks   Id  System
/dev/sda1   *      1  1998  16043008   83  Linux
/dev/sda2       1998  2089    731137    5  Extended
/dev/sda3       2089  5221  25161490+  8e  Linux LVM
/dev/sda5       1998  2089    731136   82  Linux swap / Solaris


# df -h
Filesystem  Size  Used  Avail  Use%  Mounted on
/dev/sda1    16G   14G   754M   95%  /
tmpfs       4.0G     0   4.0G    0%  /lib/init/rw
udev        4.0G  104K   4.0G    1%  /dev
tmpfs       4.0G     0   4.0G    0%  /dev/shm


# lbslk
-bash: lsblk: command not found


# pvs
PV         VG           Fmt  Attr   PSize   PFree
/dev/sda3  VolGroup00  lvm2  a-     23.99g  23.99g


# vgs
VG          #PV  #LV  #SN  Attr    VSize   VFree
VolGroup00    1    0    0  ws--n-  23.99g  23.99g


# lvs
#
(no output)

My answer:


You can only create or extend LVM volume groups onto physical volumes.

To resolve the issue, create an LVM physical volume on the desired partition.

pvcreate /dev/sda1

NOTE: This operation destroys all data on the named partition.

You can then extend the volume group onto the physical volume.


(And you probably don’t mean /dev/sda1 because that’s usually the /boot partition. Since this is destructive, be absolutely sure what you’re doing.)


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.