Ubuntu Transfer to Larger VirtualBox Image
April 24, 2015
Description
I find myself constantly running out of space. I was trying to fit all of my host system files, applications, and VirtualBox Images on my main SSD, and out of necessity had to keep my VirtualBox Images small. I finally ran out of space, and I’m moving the images over to a new drive. These are the steps to make the larger image and transfer everything over:
Add new image to VirtualBox
- Open VirtualBox
- Right Click on your target Virtual Machine, and click on “Settings”
- Click on “Storage”
- Within the Storage Tree, click on the “Add Hard Disk” button, next to “Controller: SATA”
- Click “Create new disk”
- Select your file options (VDI/Fixed size for me)
- Select your name and size for the new image
- Click “Create”
Clone and setup disk
- Boot up your Virtual Machine using the Ubuntu Install Disk
- Open the terminal and type in:
- Make sure both your old and new disks are mounted. Make note of old (sda, not sda1) and new (sdb, not sdb1)
- Use dd to copy all necessary files (sda->sdb):
- You may have to restart, make sure you boot into the installation media again
- Open GParted
- Resize allocation to accommodate full size
- Shutdown your Virtual Machine
- Detach the old image from within the VirtualBox Virtual Machine settings
- Boot up (with the install disk removed), and you’re good to go!
- As a sanity check, “df” in a terminal and check out all your new space.
Credits to How-To Geek for the dd info.