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)
Best Answer
Whilst I have no beef with either of the existing answers, I'm not sure I see any reason to complicate this with LVM, given that you don't currently have it. If you're not planning on doing an extension like this again, it may not be worth the pain of introducing LVM now.
An alternative, which is fiddly but doesn't involve rebuilding the machine unless you stuff it up, is to:
/dev/sda3
swapoff
, then delete the/dev/sda[25]
partitions/dev/sda1
partition to span all the existing disc, less some swap space at the top. Do not change the start block of the partition./dev/sda2
at the top of the disc, tag it swap, make sure your/etc/fstab
reflects the change fromsda5
tosda2
.resize2fs
to grow the root file system in situ to fill the new, larger/dev/sda1
.