Disk Image Resize
How to manually resize an APFS container or HFS volume
Quick navigation
Jump to: Image Resize for Intel-based VMs
Overview | Determine Filesystem Type | Resizing APFS Containers | Resizing HFS VolumesJump to: Image Resize for Apple ARM-based VMs
Note
Reducing the image size is not supported. An error should be displayed when attempting to do so.
Image Resize for Intel-based VMs
Overview
When resizing a disk image using the command orka image resize
, you have two options:
- Automatic Resize: Provide SSH credentials for the VM along with the new image size. In this scenario, the Orka API will resize the virtual disk image as well as growing the disk partition to fill the available space.
- Manual Resize: Provide only the new image size. If you choose not to provide SSH credentials (or SSH is not enabled in the VM) then you will need to manually resize the disk partition using the instructions below.
Determine Filesystem Type
In order to manually resize the disk partition, you must first determine the filesystem type used by macOS. Establish an SSH connection to the VM or connect via VNC and open Applications -> Utilities -> Terminal
. Run the command diskutil list
to determine the filesystem type.
For APFS filesystems (Mojave and later) you should see output similar to the following:
For HFS filesystems (High Sierra and earlier) you should see output similar to the following:
IMPORTANT
Note the identifier for the container (APFS) or volume (HFS) in the output seen from
diskutil list
. In the example above, the APFS container is located ondisk1
with identifierdisk1s2
and the HFS volume is located ondisk1
with identifierdisk1s2
. The disk and identifier will be needed in the next step.
Resizing APFS Containers
In order to resize an APFS container, run the following commands using the appropriate disk name and identifier from the previous step:
diskutil repairDisk disk1
diskutil apfs resizeContainer disk1s2 0
If the resize was successful, you should see the tail of the output similar to what is shown below:
Resizing HFS Volumes
In order to resize an HFS volume, run the following commands using the appropriate disk name and identifier from the previous step:
diskutil repairDisk disk1
diskutil resizeVolume disk1s2 R
If the resize was successful, you should see the tail of the output similar to what is shown below:
Image Resize for Apple ARM-based VMs
Overview
Resizing an Apple ARM-based VM's disk image is possible by using the command orka image resize
. Resizing happens automatically and SSH credentials are not required.
To automatically resize an Apple ARM-based VM's disk, you just need to provide the VM ID and the new image size. The SSH credentials will automatically populate to N/A
since they are not required. In this scenario, the Orka API will resize the virtual disk image as well as grow the disk partition to fill the available space.
If the resize was successful, once you SSH to the VM,diskutil list
should have output similar to what is shown below:
IMPORTANT
To use Image Resize with Apple ARM-based VMs you need to use the latest version of Orka VM Tools. It comes out of the box with the latest .orkasi images.
You can also install it manually. For more information, see the downloads page.
IMPORTANT
The image size has a direct effect on the cached images on a node. Read more about ARM Nodes Image Caching to see how image caching works on ARM-based nodes.
Compared to Intel-based VMs, manual disk resize is not supported. Apple ARM-based VMs' disk images have APFS filesystems (similar to Mojave and later), with an additional Apple_APFS_Recovery
partition. This recovery partition is the reason why you cannot manually resize the apfs container like you can for Intel disk images.
Updated over 1 year ago