Skip to content

Instantly share code, notes, and snippets.

@claygriffiths
Forked from joost/resize_boot2docker.sh
Last active November 6, 2020 03:45
Show Gist options
  • Save claygriffiths/fd270f45d82da6feefd723c4fce5a4d7 to your computer and use it in GitHub Desktop.
Save claygriffiths/fd270f45d82da6feefd723c4fce5a4d7 to your computer and use it in GitHub Desktop.
Resize Local by Flywheel VirtualBox image
# Steps we will take:
# 1. Change Local (Docker Machine) image type (this will take a bit)
# 2. Resize image
# 3. Resize partion
#
# Also see: https://docs.docker.com/articles/b2d_volume_resize/
# IMPORTANT: Make sure Local is not running!
VM_NAME="local-by-flywheel"
NEW_DISK_SIZE=50000
LOCAL_DOCKER_MACHINE_PATH="/Applications/Local by Flywheel.app/Contents/Resources/extraResources/virtual-machine/vendor/docker/osx/docker-machine"
# Stop Docker Machine
$LOCAL_DOCKER_MACHINE_PATH stop $VM_NAME
# Change the size of the image.
# Convert the VMDK image to VDI (one that we can resize). This will take some time.
UUID=$(vboxmanage clonehd ~/.docker/machine/machines/$VM_NAME/disk.vmdk \
~/.docker/machine/machines/$VM_NAME/disk.vdi --format VDI --variant Standard \
| grep -o 'UUID.*' | cut -f2- -d: | xargs)
# Resize the image
vboxmanage modifyhd ~/.docker/machine/machines/$VM_NAME/disk.vdi --resize $NEW_DISK_SIZE
# Swap image
VBoxManage storageattach $VM_NAME --storagectl "SATA" --medium $UUID --port 1
# Install GParted on your boot2docker vm:
# - Download GParted ISO from http://gparted.sourceforge.net
# - Open VirtualBox
# - Go to: local-by-flywheel > 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)
# Open Local and you should be good to go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment