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.
![Output of `diskutil list` on an APFS file system](https://files.readme.io/a5ecefa-Screenshot_2023-09-12_at_12.02.08.png)
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](https://files.readme.io/feaf3ac-Screen_Shot_2021-02-23_at_11.24.27_AM.png)
Output of diskutil list
on an HFS file system. The disk name is disk1
, the identifier is `disk1s2.
-
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.
![Output of `diskutil list` on an APFS file system. The internal disk is now resized but the synthesized disk still shows the original size.](https://files.readme.io/9c21c4c-Screenshot_2023-09-12_at_12.07.26.png)
Output of diskutil list
on an APFS file system. The internal disk is now resized but the synthesized disk still shows the original size.
- 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.
![Screen Shot 2021-02-23 at 11.38.19 AM.png 596](https://files.readme.io/41db520-Screen_Shot_2021-02-23_at_11.38.19_AM.png)
Successful resize of an APFS disk
![Screen Shot 2021-02-23 at 12.53.09 PM.png 567](https://files.readme.io/a043b7d-Screen_Shot_2021-02-23_at_12.53.09_PM.png)
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.
-
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 11 months ago