docker-machine-driver-xhyve icon indicating copy to clipboard operation
docker-machine-driver-xhyve copied to clipboard

Resize existing machine

Open lcmen opened this issue 9 years ago • 5 comments
trafficstars

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 avatar May 06 '16 19:05 lcmen

Bumped.

@zchee @johanneswuerbach any ideas?

lcmen avatar Jun 06 '16 18:06 lcmen

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?

lcmen avatar Jun 27 '16 10:06 lcmen

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

johanneswuerbach avatar Jun 27 '16 11:06 johanneswuerbach

@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 avatar Jun 27 '16 14:06 lcmen

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

lcmen avatar Jun 27 '16 17:06 lcmen