This page is READ-ONLY. It is generated from the old site.
All timestamps are relative to 2013 (when this page is generated).
If you are looking for TeX support, please go to

Virtualbox: Enlarge a disk

my steps, follow at your risk
Added by icy over 1 year ago  »  Votes: 2/2

Keywords: Virtualbox, disk, encrypt, luks

Problem: You want to enlarge a disk foobar.vmdk for a VirtualBox Linux client (named my_vbox). There is only ONE partition on the disk, and the partition may be encrypted (using LUKS).


  1. Shut down the VirtualBox guest
  2. Create a new disk with expected size by the command. For example, to create a disk of size 10GB:
    1 VBoxManage createhd --filename /path/to/new_disk.vdi --size 10000 --format VDI --variant Standard
  3. Copy all data from the old_disk to the new one
    1 VBoxManage clonehd --existing /path/to/old_disk.vmdk /path/to/new_disk.vdi
  4. (Attaching new_disk, step 1) Execute the command VBoxManage showvminfo my_vbox | grep Controller and locate a free port/device. For example, from the output
    1 $ VBoxManage showvminfo arch |grep Controller
    2 Storage Controller Name (0):            IDE Controller
    3 ....
    4 IDE Controller (0, 0): /mnt/virtualbox/vmdisks/old_disk.vdi (UUID: ...)
    5 IDE Controller (1, 0): /mnt/virtualbox/vmdisks/arch2.vdi (UUID: ...)

    you may use the free device "1". Now attach the new disk to that free device/port:
  5. (Attaching new_disk, step 2) Execute the command
    1 VBoxManage storageattach my_vbox --storagectl "IDE Controller" \
    2            --port 0 --device 1 --type hdd --medium /path/to/new_disk.vdi
  6. Now boot up the client my_vbox. After logging in to the client, you have to use standard linux tool such as: cfdisk, fdisk, resize2fs to resize the partition. If your partition is encrypted using LUKS, you must execute the command cryptsetup resize before invoking resize2fs. For example
    1 $ cryptsetup luksOpen /dev/sdb1 foobar
    2 $ cryptsetup resize foobar
    3 $ resize2fs /dev/mapper/foobar
  7. After you invoke resize2fs, please use the command mount to attach the device to some point on the system, and check if the new partition/disk has the expected size.
  8. Shutdown the VirtualBox client my_vbox
  9. Attach the new_disk to expected location: In old example, the old disk old_disk is attached to the port 0 / device 0 of the client, so you have to relocate the disk to that couple of port/device, by the command
    1 VBoxManage storageattach my_vbox --storagectl "IDE Controller" \
    2            --port 0 --device 0 --type hdd --medium /path/to/new_disk.vdi
  10. Start the client again :)