Change CPUs, Memory and Disk

cubic modify changes the size of a VM instance after it was created.

Stop the VM Instance

CPUs, memory and disk apply when a VM instance starts, so stop it first:

$ cubic stop demo --wait

Change the Settings

$ cubic modify demo --cpus 2 --memory 2G --disk 200G

The command is quiet. Every flag is optional, so a single value can be changed on its own. Modifying a running VM instance works too and reminds you that the change needs a restart:

$ cubic modify demo --cpus 2
info: Note: changes may require a restart to take effect.

Check the Result

$ cubic show demo
Running:      no
Arch:         amd64
CPUs:         2
Memory:       2048 M
Disk Used:    448 M
Disk Total:   200 G
User:         alice
Isolated:     no
SSH Port:     33033
Monitor Port: 38283
Console Port: 42883

Start the VM instance again:

$ cubic start demo

The Disk Can Only Grow

The guest picks up a larger disk on the next boot, because the official images grow their root filesystem themselves:

$ cubic exec demo "df -h / | tail -1"
/dev/root       193G  724M  193G   1% /

Shrinking is refused, because it would cut into data that is already on the disk:

$ cubic modify demo --disk 10G
error: Cannot shrink the disk of the instance 'demo'