Resizing VirtualBox Disk

I ran out of disk space on my virtual machine and needed more space. I did not want to create a new disk and install from scratch but VirtualBox does not have any GUI tools which would resize a disk easily.

  1. Create a new disk which is larger than the original
  2. Attach it to the VM
  3. Download Gparted Live CD ISO file from http://gparted.sourceforge.net/livecd.php
  4. “Insert” the CD into the virtual machine by selecting the Gparted Live ISO file downloaded in the previous step
  5. Boot the VM and select to boot from CD
  6. Follow the onscreen prompt to boot Gparted Live in X (GUI) mode
  7. Gparted should start after it has booted. Note the disks path of the small (source) and larger (destination) drives
  8. Enter the following command to copy from one drive to the other:dd if=/dev/sda of=/dev/sdb where /dev/sda is the source and /dev/sdb is the destination. This will take a while to finish
  9. Refresh Gparted and the new drive will have partitions and data matching the old drive
  10. Move and resize the partitions
  11. Double click on the Exit button on the desktop and select Shutdown
  12. Go back to the Storage settings for the VM and re-arrange the disk SATA port in the Attributes section.
  13. Change the SATA port so that the new drive is on the port the old drive was on. This requires assigning the old drive to a third port, change the new drive to the old port and change the old drive port to the old new drive port
  14. Save the changes and boot the VM

If any of the partitions were deleted and re-created the UUID needs to be updated. See Replace /dev/xxx With UUID

Ensure the new disk boots before detaching the old drive.

increase size of virtual disk

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [http://code.google.com/p/energyathome/] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Linux, Software and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.