This is a note to myself. Hopefully good enough for me to reuse it one day. So the following instructions will probably only give you a rough idea if you found this page looking for help on Google.
Anyway, these steps worked fine for me. What a bliss not having the file systems 98% full when starting a project. Somehow, I always run out of disk space when I install SOA Suite. No matter how big I initially size it.
The challenge certainly is to get VBoxManage, fdisk and lvm right without completely messing up your system.
fdisk and to a lesser extend lvm are razor sharp tools that can easily cause bleeding wounds. So make sure you have a backup (<- repeat this last sentence after me).
On Host side (e.g. Windows 7 here)
VBox instance has to be shut down for the following steps.
Extend the VBox image
Run the from the command line on the host system:
C:\Users\frank>"\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd --resize 29696 "\01_work\30 vms\virt box\CentOS 6.4 64b STUDENT\CentOS 6.4 64b STUDENT.vdi"
On Guest side (e.g. CentOS 6.4 here)
Double check that you are on the guest side. Runing fdisk accidentially on the host side can destroy your whole computer, whereas running it on the guest side typically reduces the risk to destroy your virtual image only.
Use fdisk -l to list devices, then e.g. fdisk /dev/sda to add another primary partition (coomand n), next free number (e.g. 3), of type 8e (Linux LVM) (t), print part table (p), write table (w). Reboot…
Add new partition as physical volume (PV)
[root@ccloud12 ~]# lvm
lvm> pvcreate /dev/sda3 Physical volume "/dev/sda3" successfully created
Extend existing volume group (VG)
lvm> vgextend vg_ccloud12 /dev/sda3 Volume group "vg_ccloud12" successfully extended
Find out partition name
lvm> lvdisplay --- Logical volume --- LV Path /dev/vg_ccloud12/lv_root
Extend logical volume
lvm> lvextend -L+8.48G /dev/vg_ccloud12/lv_root Rounding size to boundary between physical extents: 8.48 GiB Extending logical volume lv_root to 25.56 GiB Logical volume lv_root successfully resized
Resize the File System (Guest System)
resize2fs -F /dev/vg_ccloud12/lv_root
Try df -h and enjoy your new diskpace.
Let me know if you had any success eg. using Oracle Enterprise Linux. Any super secret tips how to improve or shorten this are welcome.