Storage: Resize Disk
How to increase the size of the disk of a running VM.
Known limitations
You cannot reduce the size of a disk.
You cannot manually resize the disk of an Apple silicon-based VM.
You cannot save a new image from the resized disk of an Apple silicon-based VM.
Quick navigation
Resize disk for Intel-based VMs: Automatically resize the disk of an Intel-based VM | Manually resize the partition of an Intel-based VM | Save the resized disk as a new image
Quick command summary
orka image resize OR (automatically resize the disk and the partition (the credentials are required only for Intel-based VMs)) orka image resize -v <VM_ID> -q <NEW_SIZE> --vm-username <VM_USERNAME> --vm-password <VM_PASSWORD> -y OR ((Intel-only) automatically resize the disk and the partition, and save a new base image from it) orka image resize -v <VM_ID> -q <NEW_SIZE> --vm-username <VM_USERNAME> --vm-password <VM_PASSWORD> -o <NEW_IMAGE_NAME> -y OR ((Intel-only) resize the disk, and manually resize the partition later) orka image resize -v <VM_ID> -q <NEW_SIZE> -y
POST /resources/image/resize
With the orka image resize
command or the /resources/image/resize
endpoint, you can increase the disk size of an existing VM.
Resize disk for Intel-based VMs
With Intel-based VMs, you can choose between:
- Automatic Resize: Orka resizes the virtual disk and the partition. You need to provide your admin credentials for the VM.
- Manual Resize: Orka resizes only the virtual disk. You need to log in to the VM and complete the partition resize yourself.
Automatically resize the disk of an Intel-based VM
Run the following command and provide the admin credentials for the VM.
orka image resize -v <VM_ID> -q <NEW_SIZE> --vm-username <VM_USERNAME> --vm-password <VM_PASSWORD> -y
curl --location 'http://<ORKA_API_IP>/resources/image/resize' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{
"orka_vm_name": "<VM_ID>",
"vm_username": "<VM_USERNAME>",
"vm_password": "<VM_PASSWORD>",
"new_image_size": "<NEW_SIZE>"
}'
Wait for the operation to complete and verify that the image was properly resized on the VM.
Manually resize the partition of an Intel-based VM
- Determine the type of file system.
-
Run the following command and provide the admin credentials for the VM.
orka image resize -v <VM_ID> -q <NEW_SIZE> -y
curl --location 'http://<ORKA_API_IP>/resources/image/resize' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <TOKEN>' \ --data '{ "orka_vm_name": "<VM_ID>", "new_image_size": "<NEW_SIZE>" }'
-
Connect to the VM via SSH or VNC and check the output of
diskutil list
again.
- Manually resize the partition.
diskutil repairDisk <INTERNAL_DISK_IDENTIFIER>
diskutil apfs resizeContainer <SYNTHESIZED_DISK_PATH> 0
In examples from Step 2, the `<INTERNAL_DISK_IDENTIFIER>` is `disk0` and the `<SYNTHESIZED_DISK_PATH>` is `/dev/disk1`.
diskutil repairDisk <DISK_NAME>
diskutil resizeVolume <IDENTIFIER> R
In examples from Step 2, the `<DISK_NAME>` is `disk1` and the `<IDENTIFIER>` is `disk1s2`.
If the resize operation completes successfully, you will see a similar output.
Save the resized disk as a new image
During the resize operation, you can choose to automatically save a new image from the resized disk. Note that you need to run a full, automatic resize of both the disk and the partition.
orka image resize -v <VM_ID> -q <NEW_SIZE> --vm-username <VM_USERNAME> --vm-password <VM_PASSWORD> -o <NEW_IMAGE_NAME> -y
curl --location 'http://<ORKA_API_IP>/resources/image/resize' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <TOKEN>' \
--data '{
"orka_vm_name": "<VM_ID>",
"vm_username": "<VM_USERNAME>",
"vm_password": "<VM_PASSWORD>",
"new_image_size": "<NEW_SIZE>",
"new_image_name": "<NEW_IMAGE_NAME>"
}'
Resize disk for Apple silicon-based VMs
IMPORTANT
The disk size has a direct effect on the cached images on a node. For more information, see Apple Silicon-Based Nodes Image Caching.
With Apple silicon-based VMs, you can automatically resize the disk and the partition. Note that you do not need to provide the VM credentials to complete the operation.
-
Verify that you are running the latest version of Orka VM Tools compatible with your environment on the VM.
-
Run the following command.
orka image resize -v <VM_ID> -q <NEW_SIZE> -y
curl --location 'http://<ORKA_API_IP>/resources/image/resize' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <TOKEN>' \ --data '{ "orka_vm_name": "<VM_ID>", "new_image_size": "<NEW_SIZE>" }'
If the resize operation completes successfully, you will see a similar output.
See also
Updated about 1 year ago