Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Resize boot2docker VirtualBox image
# Steps we will take:
# 1. Change boot2docker image type (this will take long)
# 2. Resize image
# 3. Resize partion (using GParted)
#
# Also see: https://docs.docker.com/articles/b2d_volume_resize/
# Stop boot2docker
boot2docker stop
# First we need to change the size of the image.
# Convert the VMDK image to VDI (one that we can resize). This will take some time.
vboxmanage clonehd ~/VirtualBox\ VMs/boot2docker-vm/boot2docker-vm.vmdk ~/VirtualBox\ VMs/boot2docker-vm/boot2docker-vm.vdi --format VDI --variant Standard
# Resize (the size was ~20Gb) to 30Gb. This will be fast.
vboxmanage modifyhd ~/VirtualBox\ VMs/boot2docker-vm/boot2docker-vm.vdi --resize 40000
# Next we need to change the boot2docker partition size to use our resized image
# Install GParted on your boot2docker vm:
# - Download GParted ISO from http://gparted.sourceforge.net
# - Open VirtualBox
# - Go to: boot2docker-vm > Settings > Storage
# - Add an IDE controller
# - Add your downloaded GParted ISO as CD/DVD
# - (boot2docker itself also is an ISO, do NOT remove it)
# - Add your VDI to the SATA controller as Harddisk
# - Remove the VMDK partition
# Start GParted:
# - Boot your boot2docker vm (it should boot from the GParted ISO/CD)
# - Choose all defaults
# Resize the partition (in the GUI):
# - Right click > Resize on the boot2docker-data partition
# - Drag the slider to increase the partition/volume
# - Click Resize/Move
# - Click Apply > and one last time :) (this wont take long)
# - Quit and Shutdown
# Next remove GParted:
# - Go to: VirtualBox > boot2docker-vm > Settings > Storage
# - Remove the IDE controller (and thus the GParted ISO)
# Start the boot2docker vm using VirtualBox
# - Click Start :)
# Done!
# After this you can start boot2docker normally
boot2docker status # => poweroff
boot2docker start
# => Waiting for VM and Docker daemon to start...
@ipedrazas

This comment has been minimized.

Copy link

ipedrazas commented May 31, 2015

Last version of GParted (0.22.0-x) didn't work.

Tried 0.18.0-2 and it worked :)

@nikos

This comment has been minimized.

Copy link

nikos commented Jun 13, 2015

Experienced also the freeze when starting GParted (0.22.0-x) on OS X 10.10.3 with Virtualbox 4.3.28, seems like X cannot be started.

With the gparted-live-0.20.0-2-i486.iso the problems are gone.

@lukaso

This comment has been minimized.

Copy link

lukaso commented Jun 28, 2015

I thought I was going crazy, but 0.22.0-x not working for me at all, either. gparted-live-0.20.0-2-i486.iso worked for me as well.

@r4j4h

This comment has been minimized.

Copy link

r4j4h commented Jun 6, 2016

Had to utilize this in 2016 and wanted to let people know to look in .docker/machine/machines instead of VirtualBox VMs, assuming they used the now heavily pushed Docker Toolbox. Thanks for this! I also found the latest at this time .26 "froze" at starting X so one still needs to use gparted-live-0.20.0-2-i486.iso which works beautifully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.