Browse By

Resize Virtualbox disk

Resizing Linux guest disk running on a Windows host.

This guest OS has a second drive which I’m expanding. To expand the guests main OS drive you would need to boot a linux live CD or use a GParted live cd.

I’ll create another post later on how to do that.

  1. Shutdown the VM
  2. Locate the disk’s vdi Virtualbox Manager -> Right click on the machine -> Settings -> Storage -> Controller: SATA and select the diskOn the right under “Information”, “Location” will give you the vdi’s location on your computervirtualbox-manager-vdi-location
  3. Open the command prompt Start -> type “cmd” in the search box for Windows 7 or 8.
  4. Take a backup of your disk
  5. CD to the VirtualBox program directory so that we can use the VBoxmanage command
  6. Resize the disk to your required size, here i’m resizing to 300GB (format is in megabytes so 300000)
  7. Boot the virtual machine
  8. Delete the partition and recreate a new partition utilising the entire disk (Include the new space)

    You can see the partition is 200G we need to increase that;

    To do that using fdisk we would use the following commands.

    p (print partition table to make sure this is the only partition)
    d – Delete partition
    n – New partition
    p – primary partition
    enter – Select the first sector as default
    enter – Select the last sector as default
    p – Check everything is right
    w – Write changes to disk

    See example below;


    Using the following steps to delete recreate and then write. Note that because this is the only partition on the disk the partition as standard starts at sector 2048 so all I need to do is delete the existing and create a new parition (which will start at 2048) and extend it to the end of the drive. If there are other paritions before this one you will have to remember where the partition starts. You can get this information by typing p for print.
  9. Once the partition is resized using fdisk we need to resize the file system on the partition which is easy.

     
  10.  Done!

Leave a Reply

Your email address will not be published. Required fields are marked *