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.
- Create a new disk which is larger than the original
- Attach it to the VM
- Download Gparted Live CD ISO file from http://gparted.sourceforge.net/livecd.php
- “Insert” the CD into the virtual machine by selecting the Gparted Live ISO file downloaded in the previous step
- Boot the VM and select to boot from CD
- Follow the onscreen prompt to boot Gparted Live in X (GUI) mode
- Gparted should start after it has booted. Note the disks path of the small (source) and larger (destination) drives
- 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
- Refresh Gparted and the new drive will have partitions and data matching the old drive
- Move and resize the partitions
- Double click on the Exit button on the desktop and select Shutdown
- Go back to the Storage settings for the VM and re-arrange the disk SATA port in the Attributes section.
- 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
- 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
disk space,
Gparted,
ISO,
SATA,
storage,
UUID,
virtual disk,
virtual machine,
virtualbox. Bookmark the
permalink.