Skip to content

resizing a Virtual Box hard disk

Here’s a “quick & dirty” way to resize that Virtual Box .vdi hard drive you made too small. (Yeah, I did too.)

1) Get a “rescue OS” iso, System Rescue CD is the one I used
2) Create a new hard disk in Virtual Box by going to File -> Virtual Disk Manager
3) Update your current Virtual Machine settings to use the new disk image as a slave hard disk
4) Mount the rescue OS iso file in the CD-ROM settings
5) Make sure the boot order will boot off the CD
6) Once booted, type startx
7) Once in X, type gparted in the terminal
8) In gparted, select the primary partition you wish to make bigger and choose copy
9) Use the drop down menu to select the new second hard disk
10) Right click on the representation of the disk and click paste
11) gparted will prompt you for the size of the disk, drag the slider to the new size, leave space for a swap partition if desired then click apply
12) Once complete, right click on the disk and choose Manage Flags, check Boot then Exit gparted
12.5) If you’re Guest OS is Linux, you’ll need to reinstall grub; if not, you can skip the next two steps
13) To reinstall grub type these setup commands in the terminal:

  • sudo mount -t proc none /mnt/root/proc
  • sudo mount -o bind /dev /mnt/root/dev
  • sudo chroot /mnt/root /bin/bash
  • sudo grub

14) In grub, type these commands:

  • find /boot/grub/stage1
  • root (hd0,0)
  • setup (hd0)
  • quit

15) Shutdown the rescue OS and update the Virtual Machine settings to use the new disk as the primary master
16) Make sure you Unmount CD iso
17) And now you’re done, go ahead and Boot the VM and you’re new size disk is ready to go

Supposedly you can use vditool to do something like this but I think the preceding is the method most people will find easiest.

Post a Comment

You must be logged in to post a comment.