machine-drivers / docker-machine-driver-xhyve

docker-machine/minikube/minishift driver plugin for xhyve/hyperkit (native macOS hypervisor.framework)
https://godoc.org/github.com/machine-drivers/docker-machine-driver-xhyve
BSD 3-Clause "New" or "Revised" License
888 stars 74 forks source link

Resize existing machine #123

Open lcmen opened 8 years ago

lcmen commented 8 years ago

Is it possible to upgrade machine parameters after it has been created? I would like to increase memory (to 3GB) and cpu count (to 2) from the default ones.

lcmen commented 8 years ago

Bumped.

@zchee @johanneswuerbach any ideas?

lcmen commented 8 years ago

Ok, I've found I can just update the config.json however it does not work for increasing disk size - I've increased the .sparsebundle image using hdutil and updated disk size in the config.json but changes are not visible (df -ah still returns 20GB). I've also tried to create new docker-machine with updated size and copy the volume from previous machine but it does not work either - machine times out during start.

@johanneswuerbach do you have any idea how to increase the disk size without losing the data?

johanneswuerbach commented 8 years ago

Increasing should work using hdutil, ssh into the machine and then use resize2fs http://askubuntu.com/a/109360, but I haven't tested this.

lcmen commented 8 years ago

@johanneswuerbach thanks for the tip but unfortunately it does not work for me. When I ssh into the machine and run resize2fs nothing happens:

docker@boot2docker:~$ sudo resize2fs /dev/sda2
resize2fs 1.42.13 (17-May-2015)
The filesystem is already 4871711 (4k) blocks long.  Nothing to do!

And df -a still displays the old size.

lcmen commented 8 years ago

Ok I figured that out, here is instruction step by step:

  1. Go to ~/.docker/machine/machines/machine_name
  2. sudo hdiutil resize -size new_size root-volume.sparsebundle (i.e. new size can be 30g)
  3. Edit config.json and provide new size in Driver.DiskSize property
  4. SSH to the machine
  5. sudo fdisk /dev/sda then:
    1. d
    2. 2
    3. n
    4. p
    5. 2
    6. enter
    7. enter
    8. w
  6. Restart the machine
  7. SSH to the machine again
  8. tce-load -wi e2fsprogs.tcz (to download resize2fs)
  9. sudo resize2fs /dev/sda2