Disk Image Resize

How to manually resize an APFS container or HFS volume

🚧

Quick navigation

Jump to: Overview | Determine Filesystem Type | Resizing APFS Containers | Resizing HFS Volumes

Overview

When resizing a disk image using the command orka image resize, you have two options:

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

Output of diskutil list on APFS filesystemOutput of diskutil list on APFS filesystem

Output of diskutil list on APFS filesystem

For HFS filesystems (High Sierra and earlier) you should see output similar to the following:

Output of diskutil list on HFS filesystemOutput of diskutil list on HFS filesystem

Output of diskutil list on HFS filesystem

📘

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 on disk1 with identifier disk1s2 and the HFS volume is located on disk1 with identifier disk1s2. 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:

Successful resize on APFS containerSuccessful resize on APFS container

Successful resize on APFS container

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:

Successful resize on HFS volumeSuccessful resize on HFS volume

Successful resize on HFS volume


Did this page help you?