diskutil

Created at
7 October 2025
Last modified
26 October 2025
Status
🌱 seed
Tagged

MacOS comes with a graphical Disk Utility tool, but sources suggest it's not particularly good once you have a non-trivial partition setup. Instead, it's recommended you use MacOS' diskutil command line tool.

In this case, by the time I was mucking about with my disk, I'd already installed Linux on a separate partition, which made the disk non-trivial. Given this, I figured I should use diskutil instead.

This is a little documentation of how you can use diskutil to add a new partition to your drive, which is what I ended up doing.

Proceed with caution
The following article deals with stuff whereby you muck around with your drive. Proceed with great caution! Always back up your hard drive before you do anything like this, and it's **highly** recommended that you seek a second opinion, or thoroughly read the source documentation, before continuing. I cannot be held accountable if you brick your drive.

(But hopefully the below gives you some more direction on this whole process.)

1. Check out your drive

This shows all your current partitions, and (for APFS partitions) any volumes they're split into.

diskutil list

This will show you something like the following:

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:             Apple_APFS_ISC Container disk2         524.3 MB   disk0s1
   2:                 Apple_APFS Container disk4         696.3 GB   disk0s2
   3:                 Apple_APFS Container disk3         2.5 GB     disk0s3
   4:                        EFI EFI - ASAHI             524.3 MB   disk0s4
   5:           Linux Filesystem                         1.1 GB     disk0s5
   6:           Linux Filesystem                         294.3 GB   disk0s6
   7:        Apple_APFS_Recovery Container disk1         5.4 GB     disk0s7

/dev/disk3 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +2.5 GB     disk3
                                 Physical Store disk0s3
   1:                APFS Volume Asahi Linux - Data      3.1 MB     disk3s1
   2:                APFS Volume Asahi Linux             1.1 MB     disk3s2
   3:                APFS Volume Preboot                 191.4 MB   disk3s3
   4:                APFS Volume Recovery                805.4 MB   disk3s4

/dev/disk4 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +696.3 GB   disk4
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            11.2 GB    disk4s1
   2:              APFS Snapshot com.apple.os.update-... 11.2 GB    disk4s1s1
   3:                APFS Volume Preboot                 8.1 GB     disk4s2
   4:                APFS Volume Recovery                2.1 GB     disk4s3
   5:                APFS Volume Data                    584.0 GB   disk4s5
   6:                APFS Volume VM                      24.6 KB    disk4s6

Of particular note, this comprises:

  • One physical disk, which is split into a bunch of partitions.
  • One or more synthesized disks, which are - to my understanding - kind of like "virtual" partition schemes created through the APFS scheme.

You'll notice that each Apple_APFS partition on your physical disk is also represented by a synthesised disk, and that the first partition of the synthesised disk links it up handily to where is sits on the actual physical partition.

If you want to make a new partition, the first thing you'll need to do is shrink an existing partition to make room. You'll likely want to find your OS X install (which will contain volumes like "Preboot", "Recovery", and "Data"), and shrink that. In my case above, this was disk0s2, which is shown as /dev/disk4.

2. Resize an existing device

This is where we start actively mucking about with your drive.

diskutil apfs resizeContainer <device> <newSize>
  • device is the identifier of the device you want to partition. It'll be something like disk0s2 or similar.
  • newSize is the size of the partition following the resize. Note that you'll want to check that you actually have the spare disk available, or diskutil might just smash some files to make it fit. You can use eg g to indicate gigabytes.

3. Adding a new partition

This is surprisingly easy!

diskutil addPartition <device> <format> <name> <size>

External references

diskutil man page

Web reference.

Partitioning cheatsheet - Asahi Linux

This is why I'm not using the graphical Disk Utility to do this.