How to resize a VirtualBox VDI disk

From Ittichai Chammavanijakul's Wiki
Jump to navigation Jump to search

How to resize a VirtualBox VDI disk

1. Backup the current disk. (Optional but highly recommended).

$ cd ~/VirtualBox\ VMs/OL6
$ ls -al |grep OL6.vdi
-rw-------   1 ichamma1  1089479487  26034171904 May 16 09:18 OL6.vdi


$ VBoxManage clonehd OL6.vdi OL6_cloned.vdi

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: c0ee892e-add5-4c6f-8deb-1a7c04d2a2ae


# http://www.virtualbox.org/manual/ch08.html#vboxmanage-modifyvdi
# $ VBoxManage modifyhd <path to your vdi> --resize <new size in megabytes>

$ VBoxManage modifyhd OL6.vdi --resize 61440
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

After you’ve physically resized your drive, both VirtualBox and your OS should know about the changes.

[oracle@ol6 ~]$ df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/vg_ol6-lv_root
                      25907508  20923632   3667832  86% /

If your VM OS is Windows, you may have to run the Disk Management too to refresh the disk size.

References: