UP | HOME

Resize a VirtualBox Disk Image

VirtualBox V3.0.8 Host: Windows XP Guest: CentOS 5.4

  1. Create new virtal disk at desired size
  2. VBoxManage.exe clonehd –existing old.vdi new.vdi
  3. Use resize tool like GParted to create new partition for unused space as ext3 in the new.vdi
  4. use system-config-lvm to expand LogicVolumn with the new partition . (Command line is preferred)

   basic command in case the url is bad

   # lvm pvcreate /dev/sda5

   # lvm vgextend “MindbenderGroup” /dev/sda5

      Volume group “MindbenderGroup” successfully extended

   # lvm lvresize -l 2261 /dev/MindbenderGroup/MindbenderHome 

     ;;; 2261 is calculated according to Free PE / Current LE show by lvm vgdiaply & lvm lvdisplay

     Extending logical volume MindbenderHome to 70.66 GB

     Logical volume MindbenderHome successfully resized

   # resize2fs /dev/MindbenderGroup/MindbenderHome

Expend/resize Swap partition

   # swapoff -v /dev/VolGroup00/LogVol01 

   # lvm lvresize /dev/VolGroup00/LogVol01 -L +256M 

   # mkswap /dev/VolGroup00/LogVol01 

   # swapon -va 

   # cat /proc/swaps # free