NEWFS_APFS(8) System Manager's Manual NEWFS_APFS(8)

newfs_apfsconstruct a new APFS volume

newfs_apfs [-o options] [-i] [-b block-size] [-s volume-size | -q volume-quota -r volume-reserve] [-v volume-name] [-E] [-R role] special

newfs_apfs -C [-o options] [-i] [-b block-size] special

newfs_apfs -A [-o options] [-i] [-s volume-size | -q volume-quota -r volume-reserve] [-v volume-name] [-E -W (empty password) | -E -S -passphrase] [-R role] special

newfs_apfs [-o options] [-i] [-s volume-size | -q volume-quota -r volume-reserve] [-v volume-name] [-E] [-R role] special

The newfs_apfs command creates a new APFS container on the device and/or adds a new APFS volume to a container.

The first, more traditional, form of newfs_apfs formats the given special as a container with a single volume inside it. The second form creates a container only, with no volumes. The third form is used to non-destructively add additional volumes inside an existing container. The fourth form reformats an existing volume by effectively deleting and re-creating it; in this usage (only) special indicates a volume inside the container.

The special parameter should be the path to a disk device node, such as /dev/disk1s2, although can be specified as simply disk1s2.

The options are as follows:

block-size
The block size of the container. All volumes within this container will use this block size. The default is 4096 bytes.
options
Additional volume formatting options. Currently only:
The volume will be UNIX conformant.
Creates a case-insensitive volume. This is the default on macOS.
Creates a case-sensitive volume.
uid
The UID of the root volume. Defaults to current UID.
uid
The GID of the root volume. Defaults to current GID.
volume-quota
Places a quota, or upper limit, on the size of the volume. If specified then no more than this much space will be used for its content, even if there is additional free space in the container; however it is not guaranteed that the entire quota will always be available. By default a volume has no assigned quota.
volume-reserve
Reserves an amount of space for this volume. If specified it is guaranteed that at least this much space will be available for its content; the volume may also grow beyond this size (up to its quota limit, if any) if additional free space in the container. By default a volume has no assigned reserve.
volume-size
The fixed size of the volume. If specified then the volume is guaranteed that exactly this much space will be available for its content. Setting -s is equivalant to setting both -q and -r to that same value. If not specified then the available space is dynamic and determined by the usage of other volumes within the same container (space-sharing).
volume-name
The name of the volume. The default is "untitled".
Add a volume to an existing container. There is a limit to the number of volumes that may reside inside a container.
Create a container only, with no volume. newfs_apfs -A may be used later to format volumes inside that container.
Enable volume encryption. The volume metadata is also encrypted.
Opt in of UUID from role. The volume UUID will be a based on volume's role, not a random one (the default behavior).
Empty password flag. Must be placed after -E
password
Key used for volume encryption. If the password option is omitted for an encrypted volume, a prompt will request a password for the new volume. This option is unsecure because other non-privileged users (on multi-user systems) have means to see command-line arguments, including passwords, and is therefore not recommended for use (use the prompt instead).
special
Format as a Fusion device (with the secondary device specified here).
Wait for the volume to be fully published in I/O Registry before returning.
role
Set the OS "role" of the volume within the container. The role may be one of the following characters:
Preboot - will contain information used to help boot System volumes
Recovery - will contain the RecoveryOS
VM - will contain swapfiles and hibernate image

The newfs_apfs utility exits 0 on success, and >0 if an error occurs.

The following formats a new container and a volume named "Macintosh" on the /dev/disk1s2 device:

newfs_apfs -v Macintosh disk1s2

And then this adds another volume, named "Data" with a fixed size of 100 GB, to that container:

newfs_apfs -v Data -s 100g -A disk1s2

mount_apfs(8)

The newfs_apfs utility first appeared in OS X 10.12.

September 15, 2015 Mac OS X