Storage: Resize Disk

How to increase the size of the disk of a running VM.

📘

Orka 2.4.x content

This page has not been updated to reflect the changes introduced in Orka 3.0. Some of the information might be outdated or incorrect. Use 2.4.x to 3.0.0: API Mapping and 2.4.x to 3.0.0: CLI Mapping to figure out the correct endpoints and commands.

📘

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

Resize disk for Apple silicon-based VMs

🚧

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:

  1. Automatic Resize: Orka resizes the virtual disk and the partition. You need to provide your admin credentials for the VM.
  2. 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

  1. Determine the type of file system.
    1. Connect to the VM via SSH or VNC.
    2. Run diskutil list in the Terminal and look for the disk that you want to resize. Note the internal and the synthesized disks, their TYPE and IDENTIFIER.
Output of `diskutil list` on an APFS file system

Output of diskutil list on an APFS file system. You will need the IDENTIFIER of the internal disk (disk0) and the path of the synthesized disk (/dev/disk1)

Output of `diskutil list` on an HFS file system

Output of diskutil list on an HFS file system. The disk name is disk1, the identifier is `disk1s2.

  1. 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>"
    }'
    
  2. Connect to the VM via SSH or VNC and check the output of diskutil list again.

Output of `diskutil list` on an APFS file system. The internal disk is now resized but the synthesized disk still shows the original size.

Output of diskutil list on an APFS file system. The internal disk is now resized but the synthesized disk still shows the original size.

  1. 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.

596

Successful resize of an APFS disk

567

Successful resize of an HFS disk

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.

  1. Verify that you are running the latest version of Orka VM Tools compatible with your environment on the VM.

  2. 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


© 2019-2023 Copyright MacStadium, Inc. – Documentation built with readme.com. Orka is a registered trademark of MacStadium, Inc.