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.

Revisions

  1. claygriffiths revised this gist Feb 28, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion resize_local_machine.sh
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ UUID=$(vboxmanage clonehd ~/.docker/machine/machines/$VM_NAME/disk.vmdk \
    vboxmanage modifyhd ~/.docker/machine/machines/$VM_NAME/disk.vdi --resize $NEW_DISK_SIZE

    # Swap image
    VBoxManage storageattach local-by-flywheel --storagectl "SATA" --medium $UUID --port 1
    VBoxManage storageattach $VM_NAME --storagectl "SATA" --medium $UUID --port 1

    # Install GParted on your boot2docker vm:
    # - Download GParted ISO from http://gparted.sourceforge.net
  2. claygriffiths revised this gist Feb 28, 2017. 1 changed file with 23 additions and 1 deletion.
    24 changes: 23 additions & 1 deletion resize_local_machine.sh
    Original file line number Diff line number Diff line change
    @@ -25,4 +25,26 @@ vboxmanage modifyhd ~/.docker/machine/machines/$VM_NAME/disk.vdi --resize $NEW_D
    # Swap image
    VBoxManage storageattach local-by-flywheel --storagectl "SATA" --medium $UUID --port 1

    # Next we need to change the Docker Machine 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: 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
  3. claygriffiths revised this gist Feb 28, 2017. 1 changed file with 6 additions and 9 deletions.
    15 changes: 6 additions & 9 deletions resize_local_machine.sh
    Original file line number Diff line number Diff line change
    @@ -15,17 +15,14 @@ $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.
    vboxmanage clonehd ~/.docker/machine/machines/$VM_NAME/disk.vmdk \
    ~/.docker/machine/machines/$VM_NAME/disk.vdi --format VDI --variant Standard
    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

    # Next we need to change the boot2docker partition size to use our resized image
    # Swap image
    VBoxManage storageattach local-by-flywheel --storagectl "SATA" --medium $UUID --port 1



    # After this you can start boot2docker normally
    boot2docker status # => poweroff
    boot2docker start
    # => Waiting for VM and Docker daemon to start...
    # Next we need to change the Docker Machine partition size to use our resized image
  4. claygriffiths revised this gist Feb 28, 2017. 2 changed files with 31 additions and 47 deletions.
    47 changes: 0 additions & 47 deletions resize_boot2docker.sh
    Original file line number Diff line number Diff line change
    @@ -1,47 +0,0 @@
    # 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...
    31 changes: 31 additions & 0 deletions resize_local_machine.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    # 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.
    vboxmanage clonehd ~/.docker/machine/machines/$VM_NAME/disk.vmdk \
    ~/.docker/machine/machines/$VM_NAME/disk.vdi --format VDI --variant Standard

    # Resize the image
    vboxmanage modifyhd ~/.docker/machine/machines/$VM_NAME/disk.vdi --resize $NEW_DISK_SIZE

    # Next we need to change the boot2docker partition size to use our resized image



    # After this you can start boot2docker normally
    boot2docker status # => poweroff
    boot2docker start
    # => Waiting for VM and Docker daemon to start...
  5. Joost Hietbrink revised this gist Apr 30, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions resize_boot2docker.sh
    Original file line number Diff line number Diff line change
    @@ -22,6 +22,7 @@ vboxmanage modifyhd ~/VirtualBox\ VMs/boot2docker-vm/boot2docker-vm.vdi --resize
    # - 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:
  6. Joost Hietbrink revised this gist Apr 30, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions resize_boot2docker.sh
    Original file line number Diff line number Diff line change
    @@ -10,9 +10,9 @@ 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.vdi --format VDI --variant Standard
    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.vdi --resize 40000
    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

  7. Joost Hietbrink revised this gist Apr 30, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions resize_boot2docker.sh
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@
    #
    # Also see: https://docs.docker.com/articles/b2d_volume_resize/

    # Stop boot2docker
    boot2docker stop

    # First we need to change the size of the image.
  8. Joost Hietbrink revised this gist Apr 30, 2015. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions resize_boot2docker.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,10 @@
    # 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/

    boot2docker stop

    # First we need to change the size of the image.
  9. Joost Hietbrink created this gist Apr 30, 2015.
    38 changes: 38 additions & 0 deletions resize_boot2docker.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    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.vdi --format VDI --variant Standard
    # Resize (the size was ~20Gb) to 30Gb. This will be fast.
    vboxmanage modifyhd ~/VirtualBox\ VMs/boot2docker-vm/boot2docker.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
    # - 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...