No space left is not a problem anymore
Today I was working with virtual machines and when I tried to install some packages the 2 GB hard disk I configured for this virtual machine reached its limit. By the way, it's pretty amazing a vanilla CentOS 5.4 installation needs almost 2 GB.
Anyway, this is what I did to increase the hard disk space without reinstalling the whole thing:
- Create a new hard disk with Virtual Machine Manager. I created it with another 2 GB and selected VirtIO as the disk type.
- Start the virtual machine and create a partition in the new disk. /dev/vdb1 is the new disk:
Device Boot Start End Blocks Id System /dev/vdb1 1 4063 2047720+ 83 Linux
- Initialize a physical volume on the new disk:
pvcreate /dev/vdb1
- Add this physical volume to the logical volume group:
vgextend VolGroup00 /dev/vdb1
- Extend the logical volume group:
lvextend /dev/VolGroup00/LogVol00 -L+1.9G Rounding up size to full physical extent 1.91 GB Extending logical volume LogVol00 to 3.84 GB Logical volume LogVol00 successfully resized
- Resize the filesystem:
resize2fs /dev/VolGroup00/LogVol00 resize2fs 1.39 (29-May-2006) Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required Performing an on-line resize of /dev/VolGroup00/LogVol00 to 1007616 (4k) blocks. The filesystem on /dev/VolGroup00/LogVol00 is now 1007616 blocks long.
Thanks to LVM now I have 2 more gigabytes on my virtual disk and no reinstallation was needed.