Disk Utility Tool (Mac OS X )

Command line Utility to manage local disks and volumes.

Options which make changes require ownership or root and most are DESTRUCTIVE!

Manipulates the volume-level structure of local disks.

Provides information about, and allows the administration of, the partitioning scheme of disks, optical discs, and RAID sets.

There exists a GUI open '/System/Applications/Utilities/Disk Utility.app' which is easier to use and less error prone.

diskutil <verb> <options>

diskutil verb provides help

volreference

Disk Identifier

Device unit, session on that device, or a partition (slice) .

Form : diskU, diskUsS, diskUsQ, or diskUsQsS, where U, S, and Q are decimal integers .

The forms for optical session and partition are the same and are distinguished by context.

Some units (e.g. floppy disks, RAID sets) contain filesystem data upon their "whole" device instead of containing a partitioning scheme with partitions.

The top-to-botom appearance of partitions shows the on-disk ordering.
Disk identifiers need not appear in slice-numerical order.

list [-plist ]g diskU
[internal | external]
[physical | virtual] [UUID]
diskutil list   # mojave 10.14.3 Beta(18D32a) 1/23/19
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0
   1:                        EFI EFI                        209.7 MB disk0s1
   2:                 Apple_APFS Container disk2         75.0 GB    disk0s2
   3:                 Apple_APFS Container disk3         42.0 GB    disk0s3
   4:                 Apple_APFS Container disk1          4.1 GB    disk0s4 (unused)

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +4.1 GB     disk1
                                 Physical Store disk0s4
   1:                APFS Volume Untitled                692.2 KB   disk1s1  free

/dev/disk2 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +75.0 GB    disk2
                                 Physical Store disk0s2
                                                 notice there is no disk2s0 
   1:                APFS Volume Macintosh HD            28.7 GB    disk2s1
   2:                APFS Volume DATA                    28.0 GB    disk2s2
   3:                APFS Volume Preboot                    46.1 MB disk2s3
   4:                APFS Volume Recovery                  516.8 MB disk2s4
   5:                APFS Volume VM                      1.1 GB     disk2s5

/dev/disk3 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +42.0 GB    disk3
                                 Physical Store disk0s3
                                                 notice there is no disk3s0 
   1:                APFS Volume Untitled                 5.2 GB    disk3s1
   2:                APFS Volume Photos                  28.1 GB    disk3s2


diskutil list physical |grep FD # see SD card 0: FDisk_partition_scheme *31.9 GB disk2
diskutil list 703B7F66-7880-43F2-8074-37C0157889BD /dev/disk3 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +494.4 GB disk3 Physical Store disk0s2 1: APFS Volume Macintosh HD 9.1 GB disk3s1 2: APFS Snapshot com.apple.os.update-... 9.1 GB disk3s1s1 3: APFS Volume Preboot 4.6 GB disk3s2 4: APFS Volume Recovery 794.6 MB disk3s3 5: APFS Volume Data 95.6 GB disk3s5 6: APFS Volume VM 20.5 KB disk3s6 7: APFS Volume DATA 53.7 GB disk3s7
info [-plist]   vol |  -all
 sudo diskutil info -all   
   Device Identifier:         disk0 Device Node: /dev/disk0
   Whole:                     Yes
   Part of Whole:             disk0
   Device / Media Name:       APPLE SSD SM0128G 
   Volume Name:               Not applicable (no file system) Mounted: Not applicable (no file system) File System: None 
   Content (IOContent):       GUID_partition_scheme
   OS Can Be Installed:       No
   Media Type:                Generic Protocol: PCI SMART Status: Verified 
   Disk Size:                 121.3 GB (121332826112 Bytes) (exactly 236978176 512-Byte-Units) Device Block Size: 512 Bytes 
   Read-Only Media:           No             Read-Only Volume:          Not applicable (no file system) 
   Device Location:           Internal       Removable Media:           Fixed 
   Solid State:               Yes            Virtual:No                  Hardware AES Support:      No 
********** 
          notice there ins no disk0s0 
   Device Identifier:         disk0s1 Device Node: /dev/disk0s1 Whole: No Part of Whole: disk0 
   Volume Name:               EFI Mounted: No 
   Partition Type:            EFI File System Personality:   MS-DOS FAT32 
                           Type (Bundle):msdos Name (User Visible): MS-DOS (FAT32) 
   OS Can Be Installed:       No
   Volume UUID:      0E239BC6-F960-3107-89CF-1C97F78BB46B
   Disk / Partition UUID:AC5B425C-8B83-4D99-85DA-F671ED24C69B
   Partition Offset:          20480 Bytes (40 512-Byte-Device-Blocks) 
   Disk Size:                 209.7 MB (209715200 Bytes) (exactly 409600 512-Byte-Units) 
   Volume Total Space:        0 B           Volume Free Space:         0 B 
********** 
   Device Identifier:         disk0s2 Device Node: /dev/disk0s2 Whole:No Part of Whole:disk0 
   File System:               None 
   Partition Type:            Apple_APFS
   Disk / Partition UUID:780BB21F-50E3-4055-ACB6-819615DAA3C9
   Partition Offset:          209735680 Bytes (409640 512-Byte-Device-Blocks) 
   Disk Size:                 75.0 GB (74999996416 Bytes) (exactly 146484368 512-Byte-Units) 
********** 
   Device Identifier:         disk0s3 Device Node: /dev/disk0s3 
   File System:               None
   SMART Status:              Verified
   Disk / Partition UUID:E32591C5-D2C5-497A-AE3B-FD29B314A5E8
   Partition Offset:          75209732096 Bytes (146894008 512-Byte-Device-Blocks) 
   Disk Size:                 42.0 GB (42014871552 Bytes) (exactly 82060296 512-Byte-Units)
**********
   Device Identifier:         disk0s4 Device Node: /dev/disk0s4
   File System:               None
   Disk / Partition UUID:10790A23-1FD1-4F17-8C61-B741A9E4EC7A
   Partition Offset:          117224603648 Bytes (228954304 512-Byte-Device-Blocks)
   Disk Size:                 4.1 GB (4108201984 Bytes) (exactly 8023832 512-Byte-Units)
********** 

   Device Identifier:         disk1 Device Node:               /dev/disk1 Whole:                     Yes
   Device / Media Name:       APPLE SSD SM0128G
   File System:               None
   Content (IOContent):       EF57347C-0000-11AA-AA11-00306543ECAC
   Disk / Partition UUID:C7D4F5C5-06F7-4583-983A-0B7859237AB5
   Disk Size:                 4.1 GB (4108201984 Bytes) (exactly 8023832 512-Byte-Units) Device Block Size: 4096 Bytes
   Virtual:                   Yes 
********** 
   Device Identifier:         disk1s1 Device Node:               /dev/disk1s1
   Volume Name:               Untitled Mounted:                   Yes Mount Point:               /Volumes/Untitled 
   Partition Type:            41504653-0000-11AA-AA11-00306543ECAC
   File System Personality:   Case-sensitive APFS
   Type (Bundle):             apfs                   Name (User Visible):       APFS (Case-sensitive)
   Owners:                    Enabled 
   OS Can Be Installed:       Yes
   Media Type:                Generic
   Volume UUID:      170A8371-1B3B-44CE-B9DA-85AE83B14FDA
   Disk / Partition UUID:170A8371-1B3B-44CE-B9DA-85AE83B14FDA
   Disk Size:                 4.1 GB (4108201984 Bytes) (exactly 8023832 512-Byte-Units) Device Block Size: 4096 Bytes 
   Volume Total Space:        4.1 GB (4108201984 Bytes) (exactly 8023832 512-Byte-Units)
   Volume Used Space:            17.0 MB (17043456 Bytes) (exactly 33288 512-Byte-Units) (0.4%)
   Volume Free Space:         4.1 GB (4091158528 Bytes) (exactly 7990544 512-Byte-Units) (99.6%)
   Allocation Block Size: 4096 Bytes 
   Read-Only Volume:          No
**********

   Device Identifier:         disk2 Device Node:               /dev/disk2
   File System:               None 
   Content (IOContent):       EF57347C-0000-11AA-AA11-00306543ECAC
   OS Can Be Installed:       No
   Disk / Partition UUID:39006797-0013-4FEB-8193-80E5EC146449
   Disk Size:                 75.0 GB (74999996416 Bytes) (exactly 146484368 512-Byte-Units) Device Block Size: 4096 Bytes 
   Virtual:                   Yes 
********** 
   Device Identifier:         disk2s1 Device Node:               /dev/disk2s1
   Volume Name:               Macintosh HD               Mount Point: / 
   Partition Type:            41504653-0000-11AA-AA11-00306543ECAC
   File System Personality:   Case-sensitive APFS
   Type (Bundle):             apfs                   Name (User Visible):       APFS (Case-sensitive)
   Owners:                    Enabled 
   OS Can Be Installed:       Yes
   Booter Disk:               disk2s3 Recovery Disk: disk2s4
   Volume UUID:      3D80E1A2-9E5D-4551-B0FA-86BB56F7D45C Disk / Partition UUID: 3D80E1A2-9E5D-4551-B0FA-86BB56F7D45C 
   Volume Total Space:        75.0 GB (74999996416 Bytes) (exactly 146484368 512-Byte-Units)
   Volume Used Space:         58.5 GB (58476572672 Bytes) (exactly 114212056 512-Byte-Units) (78.0%)
   Volume Free Space:         16.5 GB (16523423744 Bytes) (exactly 32272312 512-Byte-Units) (22.0%) 
                                                            Allocation Block Size: 4096 Bytes
**********
   Device Identifier:         disk2s2 Device Node:               /dev/disk2s2
   Volume Name:               DATA                   Mount Point:  /Volumes/DATA 
   Partition Type:            415…
   File System Personality:   APFS Type (Bundle):             apfs                   Name (User Visible):       APFS
   Owners:                    Enabled 
   OS Can Be Installed:       Yes
   Booter Disk:               disk2s3 Recovery Disk: disk2s4
   Volume UUID:      209066D7-AAD7-46FB-AC09-7FDADA96A54C Disk / Partition UUID: 209066D7-AAD7-46FB-AC09-7FDADA96A54C 
**********
   Device Identifier:         disk2s3 Device Node:               /dev/disk2s3
   Volume Name:               Preboot
   Partition Type:            415…
   File System Personality:   APFS …
   Owners:                    Disabled 
   Volume UUID:      EFB6D4D4-B18A-4EF6-998B-B7CC3F78840E Disk / Partition UUID: EFB6D4D4-B18A-4EF6-998B-B7CC3F78840E 
   Volume Total Space:        0 B 
********** 
   Device Identifier:         disk2s4 Device Node:               /dev/disk2s4
   Volume Name:               Recovery 
   Partition Type:            415…
   File System Personality:   APFS …
   Owners:                    Disabled 
   Volume UUID:      D20E8594-9FBC-4A31-B3F8-2AA1D5BE4BAC Disk / Partition UUID: D20E8594-9FBC-4A31-B3F8-2AA1D5BE4BAC 
   Volume Total Space:        0 B
**********
   Device Identifier:         disk2s5 Device Node:               /dev/disk2s5
   Volume Name:               VM Mount Point:               /private/var/vm 
   Partition Type:            415…
   File System Personality:   APFS…
   Owners:                    Enabled 
   Volume UUID:      32455EB5-06F0-4ABB-8C68-D5B2065BCFDB Disk / Partition UUID: 32455EB5-06F0-4ABB-8C68-D5B2065BCFDB 
   Volume Used Space:         58.5 GB (58476572672 Bytes) (exactly 114212056 512-Byte-Units) (78.0%)
   Volume Free Space:         16.5 GB (16523423744 Bytes) (exactly 32272312 512-Byte-Units) (22.0%) 
                                                                Allocation Block Size: 4096 Bytes
**********

   Device Identifier:         disk3 Device Node:               /dev/disk3
   File System:               None 
   Content (IOContent):       EF57347C-0000-11AA-AA11-00306543ECAC
   Disk / Partition UUID:0188CCBD-2008-4DD8-A45D-85874CE5DDFB
   Disk Size:                 42.0 GB (42014871552 Bytes) (exactly 82060296 512-Byte-Units) Device Block Size: 4096 Bytes 
   Virtual:                   Yes
**********
   Device Identifier:         disk3s1 Device Node:               /dev/disk3s1
   Volume Name:               Untitled Mount Point:               /Volumes/Untitled 1 
   Partition Type:            415…
   File System Personality:   Case-sensitive APFS
   Owners:                    Enabled 
   OS Can Be Installed:       Yes
   Volume UUID:      E45F0503-5B3B-4EE7-85E3-D3609B3AF1EB Disk / Partition UUID: E45F0503-5B3B-4EE7-85E3-D3609B3AF1EB 
   Volume Total Space:        42.0 GB (42014871552 Bytes) (exactly 82060296 512-Byte-Units)
   Volume Used Space:         33.4 GB (33418911744 Bytes) (exactly 65271312 512-Byte-Units) (79.5%)
   Volume Free Space:         8.6 GB (8595959808 Bytes) (exactly 16788984 512-Byte-Units) (20.5%) Allocation Block Size: 4096 Bytes
**********
   Device Identifier:         disk3s2 Device Node:               /dev/disk3s2
   Volume Name:               Photos Mount Point:               /Volumes/Photos 
   Partition Type:            415…
   File System Personality:   Case-sensitive APFS
   Owners:                    Enabled 
   OS Can Be Installed:       Yes
   Volume UUID:      9C3465C9-5EB7-485F-A39D-352A6E7E6EA2 Disk / Partition UUID: 9C3465C9-5EB7-485F-A39D-352A6E7E6EA2 
   Volume Total Space:        42.0 GB (42014871552 Bytes) (exactly 82060296 512-Byte-Units)
   Volume Used Space:         33.4 GB (33418911744 Bytes) (exactly 65271312 512-Byte-Units) (79.5%)
   Volume Free Space:         8.6 GB (8595959808 Bytes) (exactly 16788984 512-Byte-Units) (20.5%) Allocation Block Size: 4096 Bytes
********** 






activity Continuously display system-wide disk manipulation activity as reported by the Disk Arbitration framework, Coming on-line, being ejected, volumes being mounted or unmounted, volumes being renamed, etc.
until interrupted with a intsignal (^C).
For debugging such as the monitoring of applications dissenting (attempting to deny) activities for disks for which they have registered an interest, use the logging features of the diskarbitrationd

Example of requesting dismount of external drive.
edited
DiskUnmountApproval ('disk3s2', DAVolumePath='file:///Volumes/dgerman23/', 
                                              DAVolumeKind='apfs', DAVolumeName='dgerman23') 
                            Comment=Approving                                               -18:17:47.6661 
DiskDescriptionChanged ('disk3s2', DAVolumePath='')                                         -18:17:47.8036
DAIdle            (no DADiskRef)                                                            -18:17:47.8039
DiskEjectApproval ('disk3') Comment=Approving                                               -18:17:47.8297
DiskEjectApproval ('disk2') Comment=Approving                                               -18:17:48.1868
DiskDisappeared   ('disk2',   DAVolumePath='', DAVolumeKind='',     DAVolumeName='')        -18:17:50.3899
DiskDisappeared   ('disk3s2', DAVolumePath='', DAVolumeKind='apfs', DAVolumeName='dgerman23') -18:17:50.3901
DiskDisappeared   ('disk3',   DAVolumePath='', DAVolumeKind='',     DAVolumeName='')        -18:17:50.3902
DiskDisappeared   ('disk2s2', DAVolumePath='', DAVolumeKind='',     DAVolumeName='')        -18:17:50.3902
DiskDisappeared   ('disk2s1', DAVolumePath='', DAVolumeKind='msdos', DAVolumeName='EFI')    -18:17:50.3903
DAIdle (no DADiskRef)                                                                       -18:17:50.3903
DiskDisappeared ((no BSD name), 
                              DAVolumePath='file:///Volumes/.timemachine/7AC0447D-A50C-48B1-A119-84DE5057CA35/2023-04-12-212154.backup/',
                                               DAVolumeKind='apfs', DAVolumeName='dgerman23@snap-195')  -18:17:50.4071

DAIdle (no DADiskRef)                                                                       -18:17:50.4072
INsertion of extrernal drive:
DiskPeek ('disk2s1')                                                        -18:33:38.6558
DiskPeek        ('disk2s2')                                                                 -18:33:38.6559
DiskAppeared    ('disk2s1',   DAVolumePath='', DAVolumeKind='msdos', DAVolumeName='EFI')    -18:33:38.6579
DiskMountApproval ('disk2s1', DAVolumePath='', DAVolumeKind='msdos', DAVolumeName='EFI') 
                                                                          Comment=Approving -18:33:38.6628
DiskAppeared    ('disk2s2',   DAVolumePath='', DAVolumeKind='', DAVolumeName='')            -18:33:38.6682
DiskPeek        ('disk2')                                                                   -18:33:38.6685
DiskAppeared    ('disk2',     DAVolumePath='', DAVolumeKind='', DAVolumeName='')            -18:33:38.6735
DiskPeek        ('disk3s2')                                                                 -18:33:39.0235
DiskAppeared    ('disk3s2',   DAVolumePath='', DAVolumeKind='apfs', DAVolumeName='dgerman23') -18:33:39.0289
DiskMountApproval ('disk3s2', DAVolumePath='', DAVolumeKind='apfs', DAVolumeName='dgerman23') 
                                                                           Comment=Approving -18:33:39.0295
DiskPeek        ('disk3')                                                                   -18:33:39.0311
DiskAppeared    ('disk3',     DAVolumePath='', DAVolumeKind='', DAVolumeName='')            -18:33:39.0366
DiskDescriptionChanged ('disk3s2', DAVolumePath='file:///Volumes/dgerman23/')               -18:33:39.5515
DAIdle (no DADiskRef)                                                                       -18:33:39.5516
DiskAppeared ((no BSD name), 
                            DAVolumePath='file:///Volumes/.timemachine/7AC0447D-A50C-48B1-A119-84DE5057CA35/2023-04-12-212154.backup/',                                              DAVolumeKind='apfs', DAVolumeName='dgerman23@snap-195') -18:33:40.3731

DAIdle (no DADiskRef) -18:33:40.3732
mount [readOnly]
      [-mountPoint vol_mt_pt]
      disknsm
Mount a single volume.
vol_mt_ptrather than the standard path of /Volumes/VolumeName,
directory at that path must already exist.
mountDisk disku Mount all mountable volumes.
umount [force]vol forcemay break open files; see umount.
umountDisk [force] disku
eject disku Media becomes offline .
Removable media will eject or become eligible for safe manual removal.
verifyDisk disku Partition Table, EFI integriey, Core Storage Physical Volumes and space for boot loaders.
/usr/sbin/Diskutil verifydisk disk0   sudo not required
Started partition map verification on disk0
Checking prerequisites
Checking the partition list
Checking the partition map size
Checking for an EFI system partition
Checking the EFI system partition's size
Checking the EFI system partition's file system
Checking the EFI system partition's folder content
Checking all HFS data partition loader spaces
Volume Photos on disk0s5 has 0 bytes of trailing loader space and it needs 134,217,728 bytes
Problems were found with the partition map which might prevent booting
Error: -69765: (- 0x1185 )Partition map needs repair because a data partition needs loader space


Unable to verify this whole disk: A GUID Partition Table (GPT) partitioning scheme is required (-69773) -0x118D
repairDisk disku
sudo /usr/sbin/Diskutil repairdisk disk1
 Repairing the partition map might erase disk1s1 (the EFI ), proceed? (y/N) n
Repair canceled


sudo diskutil repairDisk /dev/disk1         # an SD card with FAT partition.
Unable to repair this whole disk: A GUID Partition Table (GPT) partitioning scheme is required (-69773)

 
verifyVolume vol file System of a volume (e.g. fsck).
repairVolume vol Repair the data structure of a volume (e.g. fsck). Example:
sudo diskutil repairVolume  /Volumes/DGERMAN_2GB
Password:
Started file system repair on disk2s1 DGERMAN_2GB
Checking file system
** disk2s1
** Phase 1 - Preparing FAT
** Phase 2 - Checking Directories
** Phase 3 - Checking for Orphan Clusters
106 files, 1783744 KiB free (55742 clusters)
Volume repair complete
Updating boot support partitions for the volume as required
Finished file system repair on disk2s1 DGERMAN_2GB 

Started file system repair on disk0s9 Recovery_Mavericks
Repairing file system
Checking non-journaled HFS Plus Volume
Invalid B-tree node size
The volume   could not be verified completely
File system check exit code is 8
Updating boot support partitions for the volume as required
Error: -69845: File system verify or repair failed
Underlying error: 8: POSIX reports: Exec format error
renameVolume vol new_name Volume names are subject to file system-specific alphabet and length restrictions. Must be mounted

 > sudo diskutil mount disk0s11
 > sudo diskutil renameVolume untitled email+cache
Volume on disk0s10 renamed to email+cachei

 > sudo diskutil mount disk0s3
 > sudo /usr/sbin/Diskutil renameVolume disk0s3 'RECOVERY HD AB'
enableJournal vol on an HFS+ volume.
disableJournal [force]vol On an HFS+ volume, Volume need not be mounted
Force: journaling is disabled directly on disk, the volume must not be mounted.
moveJournal external|internal
      [journalDevicevol
externalcauses the creation of a 512MB Apple_Journal partition out of journalDevice and an HFS+ partition will be created out of the remaining space if available; journalDevice must be a partition. The journal for device will then be moved externally onto the newly created Apple_Journal partition.

internalwill move the journal for device back locally.

enableOwnership vol The Database at /var/db/volinfo.databaseis modified as per User and Group ID settings of files, directories, and links (file system objects, or "FSOs")
> sudo diskutil enableOwnership /Volumes/untitled
File system user/group ownership enabled

For some locations of devices (e.g. internal hard disks), consideration of ownership settings on FSOs is the default.
For others (e.g. plug-in USB disks), it is not.


When ownership is enabled, the Owner and Group ID settings that exist on the disk are taken into account for determining access, and exact settings are written to the disk as FSOs are created.
When ownership is disabled, Owner and Group ID settings on FSOs appear to the user and programs as the current user and group instead of their actual on-disk settings.

Enable ownership where a disk contains FSOs whose User and Group, and permissions, is critically important, such as when the plug-in disk contains system files to be changed or added .

 > cat /var/db/volinfo.database
F1D7320CDC506E87: 00000001
A073446E9FC5B85D: 00000001
3D5B432DF5D25BA5: 00000001
CE5F4638B7C48818: 00000001
D156FA5D2FFD2DE8: 00000001
156A2EAF1753895A: 00000001
05924632A81B72DC: 00000001
E0C32DAAF5C0E0AB: 00000001

previously:
05924632A81B72DC: 00000001
A073446E9FC5B85D: 00000001
22984819A1006E1A: 00000001
CE5F4638B7C48818: 00000001
E08C36730A0B5D7C: 00000001
C5E0CD235635726E: 00000001
4500BAFE67D39774: 00000001

Settings are persistent See vsdbutil .
disableOwnership device
verifyPermissions [-plist]vol Verify the permissions of boot volume, written during the installation .
Deprecated as of El Captian
listFilesystems [-plist] Show personalities available for formating when using the eraseVolume and partitioning verbs.
This is a subset of personalities exported by the various filesystem bundles installed.
Also shown are some shortcut aliases for common personalities.
-plistoutput is in xml.

File Systems formats
These (case insensative) personalities can be used for erasing and partitioning.

PERSONALITY                     USER VISIBLE NAME                               
-----------------------------------------------------------
Free Space | free               Free Space  
HFS+                            Mac OS Extended 
hfsx | Case-sensitive HFS+          Mac OS Extended (Case-sensitive)                
jhfsx| Case-sensitive Journaled HFS+ Mac OS Extended (Case-sensitive, Journaled)     
jhfs+| Journaled HFS+             Mac OS Extended (Journaled)                     

ExFAT                           ExFAT                                           
MS-DOS                          MS-DOS (FAT)                                    
MS-DOS FAT12                    MS-DOS (FAT12)                                  
MS-DOS FAT16                    MS-DOS (FAT16)                                  
MS-DOS FAT32                    MS-DOS (FAT32) (or) fat32 
eraseVolume format name  vol and write out an empty filesystem. See Format.
Use %noformat%to skip initialization (to skip newfs).
A format of Free Space will cause removal of the partition from the partition table.
The boot volume cannot be erased.
If eraseVolume is preformed from the GUI the volume will contain:
small>TM28 % ls -ltraR
drwx------  4 dgerman  staff  128 Apr 28 11:45 .Spotlight-V100/
drwx------  3 dgerman  staff   96 Apr 28 11:45 .fseventsd/

./.Spotlight-V100:
drwx------  3 dgerman  staff    96 Apr 28 11:45 Store-V2/
-rw-------  1 dgerman  staff  4510 Apr 28 11:45 VolumeConfiguration.plist

./.Spotlight-V100/Store-V2:
drwx------  87 dgerman  staff  2784 Apr 28 11:45 8244D61B-B847-4650-B827-F4FBCD9B5B54/

./.Spotlight-V100/Store-V2/8244D61B-B847-4650-B827-F4FBCD9B5B54:
total 984
-rw-------   1 dgerman  staff      0 Apr 28 11:45 tmp.Lion
-rw-------   1 dgerman  staff      0 Apr 28 11:45 Lion.created
-rw-------   1 dgerman  staff      0 Apr 28 11:45 tmp.Cab
-rw-------   1 dgerman  staff      0 Apr 28 11:45 Cab.created
-rw-------   1 dgerman  staff      0 Apr 28 11:45 tmp.Star
-rw-------   1 dgerman  staff   4096 Apr 28 11:45 0.indexPositions
-rw-------   1 dgerman  staff  65536 Apr 28 11:45 0.directoryStoreFile.shadow
-rw-------   1 dgerman  staff  65536 Apr 28 11:45 0.directoryStoreFile

-rw-------   1 dgerman  staff  32768 Apr 28 11:45 live.0.indexIds
-rw-------   1 dgerman  staff  16384 Apr 28 11:45 live.0.indexBigDates
-rw-------   1 dgerman  staff   3277 Apr 28 11:45 live.0.indexGroups
-rw-------   1 dgerman  staff   4096 Apr 28 11:45 live.0.indexPostings
-rw-------   1 dgerman  staff   8192 Apr 28 11:45 live.0.indexTermIds
-rw-------   1 dgerman  staff   4096 Apr 28 11:45 live.0.indexPositions
-rw-------   1 dgerman  staff   8192 Apr 28 11:45 live.0.indexPositionTable
-rw-------   1 dgerman  staff  65536 Apr 28 11:45 live.0.shadowIndexArrays
-rw-------   1 dgerman  staff  65536 Apr 28 11:45 live.0.indexArrays
-rw-------   1 dgerman  staff  65536 Apr 28 11:45 live.0.directoryStoreFile.shadow
-rw-------   1 dgerman  staff  65536 Apr 28 11:45 live.0.directoryStoreFile

-rw-------   1 dgerman  staff  16384 Apr 28 11:45 dbStr-3.map.data
-rw-------   1 dgerman  staff  16384 Apr 28 11:45 dbStr-3.map.offsets
-rw-------   1 dgerman  staff  16384 Apr 28 11:45 dbStr-3.map.buckets
-rw-------   1 dgerman  staff     56 Apr 28 11:45 dbStr-3.map.header

-rw-r--r--   1 dgerman  staff      4 Apr 28 11:45 store_generation

drwx------   2 dgerman  staff     64 Apr 28 11:45 journals.corespotlight/
drwx------   2 dgerman  staff     64 Apr 28 11:45 journals.live/
drwx------   2 dgerman  staff     64 Apr 28 11:45 journals.live_system/
drwx------   2 dgerman  staff     64 Apr 28 11:45 journals.live_user/
drwx------   2 dgerman  staff     64 Apr 28 11:45 journals.live_priority/
drwx------   2 dgerman  staff     64 Apr 28 11:45 journals.assisted_import_pre/
drwx------   2 dgerman  staff     64 Apr 28 11:45 journals.assisted_import_post/
drwx------   2 dgerman  staff     64 Apr 28 11:45 journals.health_check/
drwx------   2 dgerman  staff     64 Apr 28 11:45 journals.migration/
drwx------   2 dgerman  staff     64 Apr 28 11:45 journals.migration_secondchance/
-rw-------   1 dgerman  staff      0 Apr 28 11:45 journalExclusion

-rw-------   1 dgerman  staff  65536 Apr 28 11:45 reverseDirectoryStore.shadow

-rw-------   1 dgerman  staff      0 Apr 28 11:45 live.0.shadowIndexTermIds
-rw-------   1 dgerman  staff      0 Apr 28 11:45 live.0.shadowIndexPositionTable

-rw-------   1 dgerman  staff   4096 Apr 28 11:45 0.indexPostings
-rw-------   1 dgerman  staff     13 Apr 28 11:45 0.indexUpdates

-rw-------   1 dgerman  staff  16384 Apr 28 11:45 dbStr-1.map.data
-rw-------   1 dgerman  staff  16384 Apr 28 11:45 dbStr-1.map.offsets
-rw-------   1 dgerman  staff  16384 Apr 28 11:45 dbStr-1.map.buckets
-rw-------   1 dgerman  staff  16384 Apr 28 11:45 dbStr-2.map.data
-rw-------   1 dgerman  staff  16384 Apr 28 11:45 dbStr-2.map.offsets
-rw-------   1 dgerman  staff  16384 Apr 28 11:45 dbStr-2.map.buckets
-rw-------   1 dgerman  staff  16384 Apr 28 11:45 dbStr-4.map.data
-rw-------   1 dgerman  staff  16384 Apr 28 11:45 dbStr-4.map.offsets
-rw-------   1 dgerman  staff  16384 Apr 28 11:45 dbStr-4.map.buckets
-rw-------   1 dgerman  staff  16384 Apr 28 11:45 dbStr-5.map.data
-rw-------   1 dgerman  staff  16384 Apr 28 11:45 dbStr-5.map.offsets
-rw-------   1 dgerman  staff  16384 Apr 28 11:45 dbStr-5.map.buckets
-rw-------   1 dgerman  staff   2081 Apr 28 11:45 tmp.spotlight.loc
-rw-------   1 dgerman  staff   3277 Apr 28 11:45 0.indexGroups
-rw-------   1 dgerman  staff   8224 Apr 28 11:45 live.0.shadowIndexDirectory
-rw-------   1 dgerman  staff   8224 Apr 28 11:45 live.0.indexDirectory
-rw-------   1 dgerman  staff   1024 Apr 28 11:45 live.0.shadowIndexCompactDirectory
-rw-------   1 dgerman  staff   1024 Apr 28 11:45 live.0.indexCompactDirectory
drwx------   2 dgerman  staff     64 Apr 28 11:45 journals.scan/
-rw-------   1 dgerman  staff      2 Apr 28 11:45 0.shadowIndexGroups
-rw-------   1 dgerman  staff   4096 Apr 28 11:45 0.shadowIndexHead
-rw-------   1 dgerman  staff    536 Apr 28 11:45 0.indexTermIds
-rw-------   1 dgerman  staff    536 Apr 28 11:45 0.indexPositionTable
-rw-------   1 dgerman  staff   1024 Apr 28 11:45 0.indexArrays
-rw-------   1 dgerman  staff      8 Apr 28 11:45 0.indexCompactDirectory
-rw-------   1 dgerman  staff   2056 Apr 28 11:45 0.indexDirectory
-rw-------   1 dgerman  staff     16 Apr 28 11:45 0.indexIds
-rw-------   1 dgerman  staff      8 Apr 28 11:45 0.indexBigDates
-rw-------   1 dgerman  staff      1 Apr 28 11:45 live.0.shadowIndexGroups
-rw-------   1 dgerman  staff   4096 Apr 28 11:45 live.0.shadowIndexHead
-rw-------   1 dgerman  staff  36864 Apr 28 11:45 store.db
-rw-------   1 dgerman  staff     56 Apr 28 11:45 dbStr-1.map.header
-rw-------   1 dgerman  staff     56 Apr 28 11:45 dbStr-2.map.header
-rw-------   1 dgerman  staff     56 Apr 28 11:45 dbStr-4.map.header
-rw-------   1 dgerman  staff     56 Apr 28 11:45 dbStr-5.map.header
-rw-------   1 dgerman  staff      3 Apr 28 11:45 store.updates
-rw-------   1 dgerman  staff  65536 Apr 28 11:45 reverseDirectoryStore
-rw-------   1 dgerman  staff      2 Apr 28 11:45 reverseStore.updates
-rw-------   1 dgerman  staff   4096 Apr 28 11:45 live.0.indexHead
-rw-------   1 dgerman  staff      0 Apr 28 11:45 live.0.indexUpdates
drwx------  87 dgerman  staff   2784 Apr 28 11:45 ./
-rw-------   1 dgerman  staff     28 Apr 28 11:45 indexState
-rw-r--r--   1 dgerman  staff      4 Apr 28 11:45 shutdown_time
-rw-------   1 dgerman  staff   4096 Apr 28 11:45 0.indexHead
-rw-------   1 dgerman  staff   4096 Apr 28 11:45 tmp.spotlight.state
-rw-------   1 dgerman  staff  36864 Apr 28 11:45 .store.db
Empty directoeied
./.Spotlight-V100/Store-V2/8244D61B-B847-4650-B827-F4FBCD9B5B54/journals.corespotlight: 
./.Spotlight-V100/Store-V2/8244D61B-B847-4650-B827-F4FBCD9B5B54/journals.live: 
./.Spotlight-V100/Store-V2/8244D61B-B847-4650-B827-F4FBCD9B5B54/journals.live_system: 
./.Spotlight-V100/Store-V2/8244D61B-B847-4650-B827-F4FBCD9B5B54/journals.live_user: 
./.Spotlight-V100/Store-V2/8244D61B-B847-4650-B827-F4FBCD9B5B54/journals.live_priority: 
./.Spotlight-V100/Store-V2/8244D61B-B847-4650-B827-F4FBCD9B5B54/journals.assisted_import_pre: 
./.Spotlight-V100/Store-V2/8244D61B-B847-4650-B827-F4FBCD9B5B54/journals.assisted_import_post: 
./.Spotlight-V100/Store-V2/8244D61B-B847-4650-B827-F4FBCD9B5B54/journals.health_check: 
./.Spotlight-V100/Store-V2/8244D61B-B847-4650-B827-F4FBCD9B5B54/journals.migration: 
./.Spotlight-V100/Store-V2/8244D61B-B847-4650-B827-F4FBCD9B5B54/journals.migration_secondchance: 
./.Spotlight-V100/Store-V2/8244D61B-B847-4650-B827-F4FBCD9B5B54/journals.scan:

./.fseventsd:
-rw-------  1 dgerman  staff   36 Apr 28 11:45 fseventsd-uuid
                            3685C886-A795-4196-BC87-36105F9FC892
Operations modifying the entire disk (which may result in disaster).

Did you back up the partition table? See gdisk

partitionDisk diskU [numberOfPartitions]
[APM[fmt]]|MBR[Fmt]| GPT[Fmt]
  [PTFormat]
 [FSFormat1 vName1 pSize1
   FSFormat2 vName2 pSize2
   FSFormat2 vName3 pSize3
…]
Re-partition a disk. All volumes on this disk will be destroyed.
The device parameter specifies that a whole disk is to be partitioned.
The optional PTformatforces a particular Partitioning Table Format
  • APM Apple Partition Map , for a start up disk on PowerPC-based, a non-startup disk with any Mac, or a multiplatform compatible startup disk.
  • MBR Master Boot Record . DOS/Windows-compatible
  • GPTGUID Partitioning Table. for start up disk on Intel-based Mac.

For each partition, a triplet of the desired File System format, volume name, and size must be specified.
  • FSFormatare shown at listFilesystems and are created with the appropriate newfs_* (example newfs_hfs).
    The partition type is set according to the filesystem.
  • vName: volume names must conform to file system specific restrictions.
    %noformat%: the partition is left uninitalized.
    Names are ignored but dummy names must be present.
  • pSizeare floating point numbers followed by a letter or percent sign
    (example: 16G, 55.3T, 678M, 75%, R). Rwill use the Remainder of space on disk

    The last partition will be lengthened to the end of the disk.
    To create a partition of a specific size, include an additional partition with size of R

File System blocksize will be 4,096.
To change block size after creating a partition use: newfs
newfs_hfs -v VolumeName -b 8192 /dev/disk0s2

This will cause the average unused space per file to be 4,096 (i.e. 1/2 block).

When determing size:
( 3/18/16 DATA vol has 189,624 files
df reports 21,014,072 1k blocks used of 44,384,728 This is a space accounting only. However   ( 21,014,072 1k blocks / 189,624 files total = 110 blk/file average aka ) means 2048*nfiles = unused space, (4096-2048)*nfiles will require ADDITIONAL unused space)

resizeVolume vol
 [ size|limits|mapsize|R
 [numberOfPartitions]
 [p1Format p1Name p1Size
  p2Format p2Name p2Size
  p3Format p3Name p3Size …
]
Only supported on GPT partition tables with a Journaled HFS+ volume filesystem .

A size of limits displays the range of valid values for the current filesystem.

> sudo diskutil resizeVolume disk0s7 limits
For device disk0s7 HDIMAGES_2:
        Current size:  56.4 GB (56443121664 Bytes)
        Minimum size:  28.6 GB (28597399552 Bytes)
        Maximum size:  56.4 GB (56443121664 Bytes)
A size of mapsize displays:
> sudo diskutil resizeVolume disk0s7 mapsize
For whole device disk0:
        Whole disk size:         320.1 GB (320072933376 Bytes)
        Partition map size:      320.1 GB (320072933376 Bytes)
A size of R will ATTEMPT to resize the partition to the maximun available. (DGG: didn't work )

Valid pnSizeare in the format of n.f units
Valid unitsare B(ytes), K(ilobytes), M(egabytes), G(igabytes), T(erabytes)
Example: 10G(10 gigabytes), 4.23T(4.23 terabytes), 5M(5 megabytes)

When decreasing size, optionally supply a list of new partitions to create.

Example:

/Volumes/HDIMAGES_2/var > sudo diskutil resizevolume disk0s7 40G                        
Resizing to 40000000000 bytes
Started partitioning on disk0s7 HDIMAGES_2
Verifying the disk
Verifying file system
Using live mode
Performing live verification
Checking Journaled HFS Plus volume
Checking extents overflow file
Checking catalog file
Checking multi-linked files
Checking volume bitmap
Checking volume information
The volume HDIMAGES_2 appears to be OK
File system check exit code is 0
Resizing
Finished partitioning on disk0s7 HDIMAGES_2
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *320.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            50.0 GB    disk0s2
   3:                  Apple_HFS Recovery HD             650.0 MB   disk0s3
   4:                  Apple_HFS Photos                  92.9 GB    disk0s4
   5:                  Apple_HFS HDIMAGES                64.0 GB    disk0s5
   6:                  Apple_HFS DATA                    45.4 GB    disk0s6
   7:                  Apple_HFS HDIMAGES_2              40.0 GB    disk0s7 

When decreasing the size, new partitions may optionally be created to fill the newly-freed space.
To do this, specify the numberOfPartitions, format, name, and size as with partitionDisk

 /Volumes/HDIMAGES_2/var > sudo diskutil resizevolume disk0s7 40G  1 jhfs+  caches+mail R
You cannot specify the remainder size option in the triples section with this verb

Resizing a volume that is currently set as the computer's startup disk will invalidate that setting; use the Startup Disk System Preferences panel or bless to reset the resized volume as the startup disk.

blocksize

splitPartition vol
 [numberOfPartitions]
 [p1Format…
Destructively split a volume into multiple partitions.
mergePartitions [force]format name fromDevice toDevice Merge two or more partitions on a disk.
All data on merged partitions other than the first will be lost. The first will be erased if it doesn't have a resizable type (e.g. JHFS+) or if forceis given.
Format and name apply only when the first partition is being erased.
Merged partitions are required to be ordered sequentially on disk (see diskutil list for the actual on-disk ordering).
reformat volwrite an empty file system using the same type and name
eraseDisk
    [[APM]Format |
    [MBR]Format |
    [GPT]Format]disknsm
Removes all volumes and writes a new partitioning scheme containing one new empty filesystem volume.
See Format .
> sudo diskutil eraseDisk fat32 2301 /dev/disk2  # use /bin/df to be sure that you specify the correct device.
Started erase on disk2
Unmounting disk
Creating the partition map
Waiting for partitions to activate
Formatting disk2s2 as MS-DOS (FAT32) with name 2301
512 bytes per physical sector
/dev/rdisk2s2: 62593120 sectors in 1956035 FAT32 clusters (16384 bytes/cluster)
bps=512 spc=32 res=32 nft=2 mid=0xf8 spt=32 hds=255 hid=411648 drv=0x80 bsec=62623744 
                                                bspf=15282 rdcl=2 infs=1 bkbs=6
Mounting disk
Finished erase on disk2
Unable to begin erase operation: A writable disk is required (-69772) (Is disk write protected ??)
zeroDisk diskU Erase a device, writing zeros to the media. The device can be a whole-disk or a partition. In either case, in order to be useful again, zero'd whole-disks will need to be partitioned, or zero'd partitions will need to be erased (newfs'd), e.g. by using the partitionDisk or eraseDisk verbs. If you desire a more sophisticated erase algorithm or if you need to erase only free space not in use for files, use the secureErase verb.
randomDisk [times]diskU Erase a whole disk, writing random data to the media. Times is the optional (defaults to 1) number of times to write random information. device can be a whole-disk or a partition. In either case, in order to be useful again, randomized wholedisks will need to be partitioned, or randomized partitions will need to be erased (newfs'd), e.g. by using the partitionDisk or eraseDisk verbs. If you desire a more sophisticated erase algorithm or if you need to erase only free space not in use for files, use the secureErase verb.
secureErase [freespace]level diskU Erase, using a secure method, either a whole-disk (including any and all partitions), or, only the free space (not in use for files) on a currently-mounted volume. Erasing a whole-disk will leave it useless until it is partitioned again. Erasing freespace on a volume will leave it exactly as it was from an end-user perspective, with the exception that it will not be possible to recover deleted files or data using utility software. If you need to erase all contents of a partition but not its hosting whole-disk, use the zeroDisk or randomDisk verbs.
Level :
  1. Single-pass zero-fill erase.
  2. Single-pass random-fill erase.
  3. US DoD 7-pass secure erase.
  4. Gutmann algorithm 35-pass secure erase.
  5. US DoE algorithm 3-pass secure erase.
eraseOptical [quick]diskU

APFS

APFS | ap apfsVerb [...]
Container imports one or more APFS Physical Store disks and exports APFS Volume disks.

While attached, the "handle" by which a Container is identified is its Reference disk (device).

Reference disk is a synthesized whole-disk which is exported by APFS for identification purposes only; it has no storage. It is associated with the AppleAPFSContainerScheme node in the IO Registry.
An APFS Volume device identifiers appear to be of a related form, do not use the Container Reference as a basis to create device identifiers ; use the listing verbs with plist options

Physical Store a disk which is imported into an APFS Container. An APFS Container can import more than one Physical Store, e.g. for Fusion-style Containers.

An APFS Physical Store disk is not necessarily a disk from a partition map; it could be e.g. an AppleRAID Set disk. Do not assume that an APFS Physical Store's disk identifier is a 2-part form such as disk0s2.

Volume an [un]mountable file system volume which is exported from an APFS Container.
APFS Volumes have no specified "size" (capacity), they consume capacity out of the remaining free space of their parent Container, consuming or returning such capacity as user file data is added or deleted.
This means that all Volumes within a Container compete for the Container's remaining capacity. Manage Volume allocation with reserve and quota.

reserve size requests an assured minimum capacity for an APFS Volume.
If successfully created, the Volume is guaranteed to be able to store at least this many bytes of user file data. beyond this, the Volume might be able to store even more until constrained by reaching zero free space in its parent Container or by reaching a quota, if any.
Use a reserve to prevent running out of capacity due to competition from other Volumes or from a Container shrink attempt.

Quota size applies a maximum capacity to a Volume, limiting the number of bytes of user file data which can be stored on the Volume.
It may not be able to reach this limit if its parent Container becomes full first.
Quota enforces accounting or to manage against "unfair" premature filling-up of the parent Container due solely to this Volume at the expense of sibling Volumes.

Efficient file copy cloning (copy-on-write) is supported (see copyfile (3)'s COPYFILE_CLONE).

File-level encryption is supported.

Snapshot represents a read-only copy of its parent APFS Volume, frozen at the moment of its creation.

Snapshots are neither listed nor discoverable when their Volume is not mounted.
Snapshots are uniquely identified within their parent Volume's namespace by either a numeric identifier (preferred) or by their name; Snapshots can be renamed.

Snapshots are mountable; provide a read-only historic version of the Volume

You can revert the present state of an APFS Volume back to equality with a Snapshot in its history.
This is a destructive reset/restore operation: Once a Volume is reverted, it cannot be brought forward.
Any Snaphots between the revert point and the present are lost as well.

Deleting a Snapshot; removes the possibility of ever reverting to that Snapshot's state,

Snapshot mount point's "source device" is the Snapshot name followed by '@' and the "parent" Volume's device node,
e.g. SnapName123@/dev/disk2s1 ". See mount_apfs -s (8) and fs_snapshot_create (2).

list [-plist][containerReferenceDevice] Display APFS objects as a tree. AFPS Container(s) are shown with their imported Physical Store(s) and exported Volume(s).

All currently-attached APFS Containers in the system are listed unless you specify a containerReferenceDevice, which limits the output to that specific APFS Container family.

If -plist is specified, then a property list will be emitted

 sudo diskutil apfs  list disk1   # mojave 10.14.3 Beta(18D32a) 1/23/19 
|
+-- Container disk1 C7D4F5C5-06F7-4583-983A-0B7859237AB5
    ====================================================
    APFS Container Reference:     disk1
    Size (Capacity Ceiling):      4108201984 B (4.1 GB)
    Capacity In Use By Volumes:   17043456 B (17.0 MB) (0.4% used)
    Capacity Not Allocated:       4091158528 B (4.1 GB) (99.6% free)
    |
    +-< Physical Store disk0s4 10790A23-1FD1-4F17-8C61-B741A9E4EC7A
    |   -----------------------------------------------------------
    |   APFS Physical Store Disk:   disk0s4
    |   Size:                       4108201984 B (4.1 GB)
    |
    +-> Volume disk1s1 170A8371-1B3B-44CE-B9DA-85AE83B14FDA
        ---------------------------------------------------
        APFS Volume Disk (Role):   disk1s1 (No specific role)
        Name:                      Untitled (Case-sensitive)
        Mount Point:               /Volumes/Untitled
        Capacity Consumed:         692224 B (692.2 KB)
        FileVault: No


> sudo diskutil apfs  list disk2  
|
+-- Container disk2 39006797-0013-4FEB-8193-80E5EC146449
    ====================================================
    APFS Container Reference:     disk2
    Size (Capacity Ceiling):      74999996416 B (75.0 GB)
    Capacity In Use By Volumes:   58608070656 B (58.6 GB) (78.1% used)
    Capacity Not Allocated:       16391925760 B (16.4 GB) (21.9% free)
    |
    +-< Physical Store disk0s2 780BB21F-50E3-4055-ACB6-819615DAA3C9
    |   -----------------------------------------------------------
    |   APFS Physical Store Disk:   disk0s2
    |   Size:                       74999996416 B (75.0 GB)
    |
    +-> Volume disk2s1 3D80E1A2-9E5D-4551-B0FA-86BB56F7D45C
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk2s1 (No specific role)
    |   Name:                      Macintosh HD (Case-sensitive)
    |   Mount Point:               /
    |   Capacity Consumed:         28788011008 B (28.8 GB) |   FileVault: No
    |
    +-> Volume disk2s2 209066D7-AAD7-46FB-AC09-7FDADA96A54C
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk2s2 (No specific role)
    |   Name:                      DATA (Case-insensitive)
    |   Mount Point:               /Volumes/DATA
    |   Capacity Consumed:         28061200384 B (28.1 GB) |   FileVault: No
    |
    +-> Volume disk2s3 EFB6D4D4-B18A-4EF6-998B-B7CC3F78840E
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk2s3 (Preboot)
    |   Name:                      Preboot (Case-insensitive)
    |   Mount Point:               Not Mounted
    |   Capacity Consumed:         46075904 B (46.1 MB) |   FileVault: No
    |
    +-> Volume disk2s4 D20E8594-9FBC-4A31-B3F8-2AA1D5BE4BAC
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk2s4 (Recovery)
    |   Name:                      Recovery (Case-insensitive)
    |   Mount Point:               Not Mounted
    |   Capacity Consumed:         516849664 B (516.8 MB) |   FileVault: No
    |
    +-> Volume disk2s5 32455EB5-06F0-4ABB-8C68-D5B2065BCFDB
        ---------------------------------------------------
        APFS Volume Disk (Role):   disk2s5 (VM)
        Name:                      VM (Case-insensitive)
        Mount Point:               /private/var/vm
        Capacity Consumed:         1073762304 B (1.1 GB) FileVault: No           


/Volumes/DATA/dgerman > sudo diskutil apfs  list disk3
|
+-- Container disk3 0188CCBD-2008-4DD8-A45D-85874CE5DDFB
    ====================================================
    APFS Container Reference:     disk3
    Size (Capacity Ceiling):      42014871552 B (42.0 GB)
    Capacity In Use By Volumes:   33418809344 B (33.4 GB) (79.5% used)
    Capacity Not Allocated:       8596062208 B (8.6 GB) (20.5% free)
    |
    +-< Physical Store disk0s3 E32591C5-D2C5-497A-AE3B-FD29B314A5E8
    |   -----------------------------------------------------------
    |   APFS Physical Store Disk:   disk0s3
    |   Size:                       42014871552 B (42.0 GB)
    |
    +-> Volume disk3s1 E45F0503-5B3B-4EE7-85E3-D3609B3AF1EB
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk3s1 (No specific role)
    |   Name:                      Untitled (Case-sensitive)
    |   Mount Point:               /Volumes/Untitled 1
    |   Capacity Consumed:         5249179648 B (5.2 GB) |   FileVault: No
    |
    +-> Volume disk3s2 9C3465C9-5EB7-485F-A39D-352A6E7E6EA2
        ---------------------------------------------------
        APFS Volume Disk (Role):   disk3s2 (No specific role)
        Name:                      Photos (Case-sensitive)
        Mount Point:               /Volumes/Photos
        Capacity Consumed:         28073394176 B (28.1 GB) FileVault: No





convert device [-dryrun] Non-destructively convert an HFS volume to an APFS Container with a single APFS Volume.
The APFS Container can then be manipulated (e.g. adding and deleting APFS Volumes) as usual.
The source HFS volume can be located on a partition or on a CoreStorage logical volume (LV); in the latter case, the CoreStorage logical volume group (LVG) is dismantled.
create device [device]name creates an empty APFS Container and then adds one APFS Volume with the given name.
The Volume will have default attributes i.e. no encryption, no capacity reserve nor quota, etc.
This is a combination of createContainer and addVolume .
createContainer [-main]device [-secondary][device] Create an empty APFS Container. The device(s) specified become APFS Physical Stores. Specifing more than one device creates a Fusion Container -main and -secondary performance algorithms to be on "slower" hardware.
usually not solid solid state, is usually larger, and is used to store associated "auxiliary" data such as any Windows partition(s) for Boot Camp Assistant.
deleteContainer [-force]containerReferenceDevice | physicalStoreDevice [name] Destroy a Container including all of its Volumes.

Volumes are unmounted first. If one or more is busy the operation is aborted.

Container's former Physical Store disks will be reformatted as HFS.

New name, default :Untitled .

If there were multiple Physical Stores, a space and a number suffix is added for each.

If Container is damaged, a Container Reference for it might not exist or it might not be functional. reclaim former APFS Physical Store disk(s) by specifying -force ;
this activates an alternate last-resort mode.
In this mode, if you had more than one Physical Store (e.g. the Fusion case) and the Container is sufficiently damaged, you might have to delete each Physical Store manually. avoid

sudo diskutil apfs deleteCOntainer disk1
Started APFS operation on disk1
Deleting APFS Container with all of its APFS Volumes
Unmounting Volumes
Unmounting Volume "Untitled" on disk1s1
Deleting Volumes
Deleting Container
Wiping former APFS disks
Switching content types
Reformatting former APFS disks
Initialized /dev/rdisk0s4 as a 4 GB case-insensitive HFS Plus volume with a 8192k journal
Mounting disk
1 new disk created or changed due to APFS operation !!
Disk from APFS operation: disk0s4
Finished APFS operation on disk1
resizeContainer containerReferenceDevice | physicalStoreDevice limits [-plist]| size
  [part1Format part1Name part1Size
   part2Format part2Name part2Size
   part3Format part3Name part3Size …]
The operation is live, non-destructive, and does not mount or unmount any APFS Volumes.

size of limits outputs a range of valid values.

size of 0 to grow the targeted Physical Store such that all remaining space is filled to the next partition or the end of the partition map.

Shrinks are constrained by the amount of data usage by all APFS Volumes on the targeted or implied Container. Contributing to this includes quotas, reserves, the usage of Snapshots (e.g. by Time Machine), and metadata overhead.

When shrinking, new partitions may be created to fill the newly-freed space by specifing the format, name, and size parameters as for partitionDisk

Grows are constrained by the amount of partition map free space trailing the targeted or implied Physical Store partition.

All Volumes on the Container must be unlocked.

addVolume ?containerReferenceDevice filesystem name
[-passprompt]| [-passphrase passphrase]| [-stdinpassphrase][-passphraseHint passphraseHint]
[-reserve reserve][-quota quota][-role roles]
[-nomount][-mountpoint mountpoint]
The filesystem parameter sets the permanent APFS personality for this new APFS Volume; you should specify APFS or Case-sensitive APFS.

The new Volume will be unencrypted unless one of the passphrase options is specified
the user which is added will be the "Disk User".
passphraseHint can be displayed while Volume is locked.

volume's file usage to a maximum amount; no more than that many bytes will be available for file data, even if there is otherwise enough space in the parent Container.
the reserve is not larger than quota.

Volumes carry certain metadata hint flags;
supply the role parameter with any combination of one or more of B R V or 0 as a no-op for scripting convenience. The new Volume is mounted after creation; unless -nomount is specified.
If mountpoint is specified it must exist

deleteVolume volumeDevice Remove the Volume from its Container. All of the Volume's data will be lost.
eraseVolume volumeDevice
-name newName
[-passprompt]| [g-passphrase passphrase]|
[g-stdinpassphrase][-passphraseHint passphraseHint]
Erase the contents of a Volume. the Volume is not removed from its Container.

The "new" Volume will inherit the file system type (Case-sensitiveness ) but not attributes such as name, reserve, quota, or encryption status.

If you need more control, delete;add the Volume.

changeVolumeRole |
chrole                         volumeDevice roles
Change the role metadata flags
The roles should be any combination of b r v B R Vi unspecified flags are unchanged, lower-case flags are cleared, and UPPER-CASE sets flags.
clear will remove all flags, 0 no-op for scripting convenience.
unlockVolume |
unlock                         volumeDevice
[-user disk | -user cryptoUserUUID|
 -recoverykeychain file]
[-passphrase passphrase]| [g-stdinpassphrase]
[-nomount | -mountpoint mountpoint]
[-verify][g-plist]
Unlock and mount an encrypted and locked Volume or verify a passphrase. WIthout -user all cryptographic users on that Volume are searched for a match;

-user disk then the Disk UUID (which equals the Volume UUID) user is assumed;
-user UUID that specific user is assumed;

-recoverykeychain then the Institutional Recovery user (see below) is assumed.
-recoverykeychain file full path to a keychain file if an Institutional Recovery Key has been previously set up on the Volume.
The keychain must be unlocked; see security(1) and fdesetup(8) for more information.

-verify will test passphrase correctness without affecting the locked or unlocked state.

To re-lock the volume, unmount it, e.g. with diskutil unmount or diskutil apfs lockVolume.

lockVolume |
lock volumeDevice
Unmount and lock a Volume.
listCryptoUsers |
listUsers |
listCryptoKeys |
listKeys
       [-plist]       volumeDevice
Show all cryptographic users and special-purpose (e.g. recovery) "users" (keys) associated with the Volume, each by their Cryptographic User UUID and usage "type".

The usual purpose of an APFS Cryptographic User is to authenticate for unlocking its APFS Volume; any of its users can do so.

An APFS Volume need not be encrypted in order to contain crypto users; other than the Disk User, they should be added before encrypting.

Types of Cryptographic Users include "Disk" user, whose UUID value always matches its Volume's UUID;
iCloud or personal "Recovery Keys", which store partial crypto keys and are associated with corresponding
"Recovery Users" and have fixed-constant UUID values; and
"Open Directory" users, whose UUID values match corresponding local macOS Open Directory account user GUIDs.

changePassphrase | changeCryptoUserPassphrase | passwd volumeDevice -user disk | cryptoUserUUID
[-oldPassphrase oldPassphrase | -oldStdinpassphrase][-newPassphrase newPassphrase | -newStdinpassphrase]
Change the passphrase of the given cryptographic user associated with the given Volume.
setPassphraseHint | setCryptoUserPassphraseHint | hint volumeDevice -user disk | cryptoUserUUID -hint hintMessage | -clear Set an arbitrary hint string to aid recall of a passphrase for the given cryptographic user associated with the given APFS Volume. Specifying -clear will clear any existing hint (no hint is the default).
encryptVolume | encrypt | enableFileVault volumeDevice -user disk | existingCryptoUserUUID [-passphrase existingOrNewPassphrase | -stdinpassphrase] Start encryption of a currently-unencrypted APFS Volume ("Enable FileVault").
The operation may be accomplished immediately or in the background".

Supply an existing cryptographic user UUID, in which case you must supply its corresponding passphrase, or
disk (or the Disk/Volume UUID) and the corresponding passphrase of the "Disk User"

if no users exist on this Volume, supply disk (or the Disk/Volume UUID), and a "Disk User" will be created with a new passphrase .
Use this acquire the first such user if a volume has no cryptographics users .

decryptVolume | decrypt | disableFileVault volumeDevice [-user disk | existingCryptoUserUUID][-passphrase existingPassphrase | -stdinpassphrase] Start decryption of a currently-encrypted APFS Volume ("Disable FileVault").
The operation may be accomplished immediately, or "in the background".

The APFS Volume must be unlocked before beginning.

listSnapshots |
list[Volume]Snaps[hots][-plist] volume
Show all snapshots that are currently associated with the Volume, including its numeric XID identifier and name.
sudo diskutil apfs listSnapshots disk2s1
Snapshots for disk2s1 (2 found)
|
+-- Name: com.apple.TimeMachine.2018-09-09-083844
|   XID:  700944
|   NOTE: This snapshot sets the minimal allowed size of APFS Container disk2
|
+-- Name: com.apple.TimeMachine.2018-09-09-115808
    XID:  701375

deleteSnapshot volumeDevice -xid xid | -name name Remove the given Snapshot

Apple RAID
appleRAID raidVerb […]
Create, manipulate and destroy AppleRAID volumes (Software RAID).
  • stripe- Striped Volume (RAID 0)
  • mirror- Mirrored Volume (RAID 1)
  • concat- Concatenated Volume (ining)
Only the "mirror" type increases fault-tolerance. may have more than two disks to increase fault-tolerance.
Striped and concatentated volumes are, in fact, more vulnerable to faults than single disk volumes.

From these basic types, "stacked" or "nested" RAID volumes can be created.
Stacked RAID sets that make use of mirrored RAID sets are fault-tolerant.
More common combinations of stacked RAID sets:

  • RAID 50 - striped RAID set of hardware RAID 5 disks.
  • RAID 10 - striped RAID set of mirrored RAID sets.
  • RAID 0+1 - mirrored RAID set of striped RAID sets.
  • Concatenated Mirror - A concatenation of mirrored RAID sets.
When creating new RAID sets or adding disks, it is better to specify the entire disk. This allows the software to reformat the entire disk using the most current partition layouts.

In addition to whole disk and partition device names, AppleRAID uses UUIDs to refer to existing RAID sets and their members. They may be specified by mount point (e.g. /Volume/raidset). Using the UUID is preferred because disk device names may change over time when disks are added, disks are removed or when the system is rebooted.
If RAID members have been physically disconnected from the system or are no longer responding, you must use the member's UUID as the command argument. Messages in the system log will refer to RAID sets and their member disks by UUID.

RAID is not a replacement for backing up data. Backups should be always be performed on a regular basis and before modifying any RAID.

list [UUID] Display volumes with current status and associated member disks.
If UUID is specified, only list that RAID. diskutil listRAID is a deprecated synonym for diskutil appleRAID list.
create mirror|stripe|concat setName format devices … Create a new RAID set consisting of multiple disks and/or RAID sets.
setNameis used for both the name of the created RAID volume and the RAID set itself (as displayed in list). Example: diskutil createRAID stripe MyArray JHFS+ disk1 disk2 disk3 disk4
delete raidVolume Destroy an existing RAID set. If the RAID set is a mirror with a resizable filesystem, delete will attempt to convert each of the member partitions back into a non-RAID volume while retaining the contained filesystem.
For concatenated RAID sets with a resizable filesystem, delete will attempt to shrink the filesystem to fit on the first member partition and convert that to a non-RAID volume.
repairMirror raidVolume newDevice Repair a degraded mirror by replacing a broken or missing member. Broken devices in the mirrored set can also be rebuilt by specifying newDevice. When replacing members of a mirrored set, the new disk must be the same size or larger than the existing disks in the RAID set.
add type newDevice raidVolume Add a new member or hot spare to an existing RAID set.
Typecan be either member or spare. New disks are added live, the RAID volume does not need to be unmounted.
Mirrored volumes support adding both members and hot spares,
When adding to a mirrored RAID set, the new disk must be the same size or larger than the existing disks in the RAID set. Adding a hot spare to a mirror will enable autorebuilding for that mirror.

Concatenated volumes only support adding members. Adding a new member to a concatenated RAID set appends the member and expands the RAID volume.

remove oldDevice raidVolume Remove a member or spare from an existing RAID set. Old disks are removed live, the RAID volume does not need to be unmounted. For missing devices, oldDevice must be device's UUID. Online mirror members with a resizable filesystem will be converted to non-RAID volumes, spare and offline members will be marked free. For concatenated RAID sets, only the last member can be removed. For resizable filesystems remove will first aiempt to shrink the concatenated RAID set so that the filesystem fits on the remaining disks.
enable mirror|concat device Convert a non-RAID disk partition containing a resizable filesystem (like JHFS+) into an unpaired mirror or single disk concatenated RAID set. Disks that were originally partitioned on Mac OS X 10.2 Jaguar or earlier or were partitioned to be Mac OS 9 compatible may not be resizable.
update key value raidVolume Update the key value parameters of an existing RAID set. Valid keys are:
  • AutoRebuild 0|1- If true, the system attempts to rebuild degraded mirrored volumes automatically. When looking for devices for rebuild, AppleRAID first looks for hot spares and then degraded members.
  • Settingtimeout ssseconds system waits (in seconds) for a missing device before degrading a mirrored raid set. Also controls the amount of time you have to disconnect all devices from an unmounted mirror without degrading it.
  • coreStorage
    cs coreStorageVerb […] CoreStorage verbs can be used to create, manipulate and destroy CoreStorage volumes.

    CoreStorage maintains a world of virtual disks, somewhat like RAID, in which one can easily add or remove imported backing store disks, as well as exported usable volumes, to or from a pool (or several pools). This provides the user with flexibility in allocating their hardware; user or operating system data can span multiple physical disks seamlessly, for example.

      Types of objects, instances of which are uniquely represented by a UUID:
    • Logical Volume Group (LVG)
    • Physical Volume (PV)
    • Logical Volume Family (LVF)
    • Logical Volume (LV)
    The Logical Volume Group (LVG) is the top or "pool" level; zero or more may exist during any OS boot time session.

    An LVG imports one or more Physical Volumes (PVs). A PV represents a device that feeds the LVG storage space; a PV is normally real media but it can be a disk image or even an AppleRAID Set. A disk offered to be a PV must be a partition and the encompassing scheme must be GPT.

    An LVG exports zero or more Logical Volume Families (LVFs). An LVF contains properties which govern and bind together all of its descendant Logical Volumes (LVs). These properties provide settings for Full Disk Encryption (FDE) (such as whether the LVG is encrypted, which users have access, etc) and other services. However, at the present time, for new LVF creation, only zero or one LVF per LVG is supported.

    A Logical Volume Family (LVF) exports one or more Logical Volumes (LVs). However, at the present time, only and exactly one LV per LVF is supported.

    A Logical Volume (LV) exports a dev node, upon which a file system (such as Journaled HFS+) resides.

    For more information on specifying device arguments, see the DEVICES section below. CoreStorage is not a replacement for backing up your data. Backups should be always be performed on a regular basis and before modifying any CoreStorage volumes using these commands.

    CoreStorage sub-verbs :

    list [-plist | UUID] Display tree view of the CoreStorage world for all current logical volume groups (LVGs) with member disks (PVs) and exported volumes (LVFs and LVs), with properties and status for each level.
    With -plista property list will be emitted instead of the formatted tree output;
    the UUIDs can be used with the diskutil coreStorage information verb to get properties for the object represented by that UUID.
    With UUIDlist only that UUID
    info | information [-plist]UUID | device
                               Display properties of the CoreStorage object (LVG, PV, LVF, or LV) 
          list                     (Show status of CoreStorage volumes)
         info[rmation]           (Get CoreStorage information by UUID or disk)
         convert                  (Convert a volume into a CoreStorage volume)
         revert                   (Revert a CoreStorage volume to its native type)
         create                   (Create a new CoreStorage logical volume group)
         delete                   (Delete a CoreStorage logical volume group)
         createVolume             (Create a new CoreStorage logical volume)
         deleteVolume             (Delete a volume from a logical volume group)
         encryptVolume            (Encrypt a CoreStorage logical volume)
         decryptVolume            (Decrypt a CoreStorage logical volume)
         unlockVolume             (Attach/mount a locked CoreStorage logical volume)
         changeVolumePassphrase   (Change a CoreStorage logical volume's passphrase)
    
    diskutil coreStorage  with no options will provide help on that verb
         
    
    
    
    
    


    SIZES

    FLoating point number followed by: When specifying partition triplets, the following relative forms may also be used: Examples: 10G (10 gigabytes), 4.23T (4.23 terabytes), 5M (5 megabytes), 25.4% (25.4 percent of whole disk size).

    FORMAT

    The format parameter for the erasing and partitioning verbs is the filesystem personality name found in a filesystem bundle's /System/Library/Filesystems/fs.fs/Contents/Info.plistor i
    by using listFilesystems, which also lists shortcut aliases for common personalities (these shortcuts are defined by diskutil for use with it only). Common examples include JHFS+, MS-DOS, etc.

    Examples

    Resize a volume and create a volume after it, using all remaining space
    sudo diskutil resizeVolume /Volumes/SomeDisk 50g MS-DOS DOS 0b

    Resize a volume and leave all remaining space as unused
    sudo diskutil resizeVolume /Volumes/SomeDisk 12g

    Merge two partitions into a new partition
    diskutil mergePartitions JHFS+ not disk1s3 disk1s5

    Split a partition into three new ones
    sudo diskutil splitPartition /Volumes/SomeDisk JHFS+ vol1 12g MS-DOS vol2 8g JHFS+ vol3 0b

    Erase a disk
    sudo diskutil eraseDisk UFS UntitledUFS disk3

    Erase a volume
    sudo diskutil eraseVolume HFS+ UntitledHFS /Volumes/SomeDisk

    Partition a disk with three partitions
    sudo diskutil partitionDisk disk3 3 HFS+ Untitled 10G UFS UntitledUFS 10G MS-DOS DOS 10G

    Partition with APM partitioning scheme
    sudo diskutil partitionDisk disk3 APM HFS+ vol1 25% Journaled HFS+ vol2 25% Journaled HFS+ vol3 50% Free Space volX 0%

    Partition with GPT partitioning scheme
    sudo diskutil partitionDisk disk3 GPT HFS+ vol1 25% MS-DOS vol2 25% HFS+ vol3 50% Free Space volX 0%

    Create a RAID
    diskutil createRAID mirror MirroredVolume JHFS+ disk1 disk2

    Destroy a RAID
    diskutil destroyRAID /Volumes/MirroredVolume

    Repair a damaged RAID
    diskutil repairMirror /Volumes/MirroredVolume disk3

    Convert volume into RAID volume
    diskutil enableRAID mirror /Volumes/ExistingVolume

    SEE ALSO

    authopen(1), hdid(8), hdiutil(1), ufs.util(8), msdos.util(8), hfs.util(8), drutil(1), diskarbitrationd(8), mount(8), umount(8), newfs(8), vsdbutil(8), fsck(8)
    defaults


    msdos.util -- DOS/Windows (FAT) file system utility

    [-m mountflag1 mountflag2 mountflag3 mountflag4]device node mount
    [-p mountflag1 mountflag2 mountflag3 mountflag4]device probe for mounting
    [-u]deviceunmount
    [-n]device name set name

    mountflags :

    fsck_msdos

    DOS/Windows (FAT) file system consistency check

    verifies and repairs FAT file systems (more commonly known as DOS file systems).

    -p normally started by fsck during automatic reboot, when a FAT file system is detected.
    When preening file systems, fixs common inconsistencies non-interactively.
    If more serious problems are found, indicates that it was not successful, and exits.
    -q quickly check if the volume was unmounted cleanly.
    If the volume was unmounted cleanly, the exit status is 0.
    If the volume was not unmounted cleanly, then the exit status will be non-zero.
    -f ignored
    -n provide N as the answer to operator questions, except CONTINUE?.
    -y provide Y as the answer
    -p Preen the specified file systems.

    Single User Mode

    Hold CMD - S when booting.
    Start the following five services first:
    launchctl load /System/Library/LaunchDaemons/com.apple.notifyd.plist
    launchctl load /System/Library/LaunchDaemons/com.apple.kextd.plist
    launchctl load /System/Library/LaunchDaemons/com.apple.diskarbitrationd.plist
    launchctl start com.apple.diskarbitrationd
    launchctl load /System/Library/LaunchDaemon/com.apple.DirectoryServices.plist
    launchctl load /System/Library/LaunchDaemons/com.apple.configd.plist
    

    HISTORY

    Starting with Mac OS X 10.6, the input and output notation of disk and partition sizes use power-of-10 suffixes.
    In the past this has been power-of-2, for display or accepted as input.

    See also

    booting OS X utility partition

    Disk Utility (Graphic User Interface) application

    See bless, gpt
    HDIutil for disk images.

     1/16/23 
    /Volumes/DATA/dgerman > man diskutil 
    DISKUTIL(8)                                         System Manager's Manual                                        DISKUTIL(8)
    
    
         diskutil - modify, verify and repair local disks
    
    
         diskutil [quiet]verb [subVerb][options]
    
    
         diskutil manipulates the structure of local disks. It provides information about, and allows the administration of,
         partitioning schemes, layouts, and formats of disks. This includes hard disks, solid state disks, optical discs, disk
         images, APFS volumes, CoreStorage volumes, and AppleRAID sets.  It generally manipulates whole volumes instead of
         individual files and directories.
    
    CAUTION
         Many diskutil commands, if improperly used, can result in data loss. Most commands do not present confirmation prompts.
         You should back up your data before using any of these commands.
    
    VERBS
    
         list [-plist][internal | external][physical | virtual][device]
                    List disks, including internal and external disks, whole disks and partitions, and various kinds of virtual or
                    offline disks.
    
                    If no argument is given, then all whole disks and their partitions are listed.
    
                    You can limit the number of disks shown by specifying filtering arguments such as internal above, and/or a
                    device disk. When limiting by a disk, you can specify either a whole disk, e.g. disk0, or any of its slices,
                    e.g. disk0s3, but filtering is only done at the whole disk level (disk0s3 is a synonym for disk0 in this
                    case).
    
                    If -plist is specified, then a property list will be emitted instead of the normal user-readable output.
    
                    A script could interpret the results of diskutil list -plist and use diskutil info -plist as well as diskutil
                    listFilesystems -plist for more detailed information.
    
                    The top-to-bottom appearance of all whole disks is sorted in numerical order by unit (whole disk) number.
                    However, within each whole disk's "sublist" of partitions, the ordering indicates actual on-disk location. The
                    first disk item listed represents the partition which is located most near the beginning of its encompassing
                    whole disk, and so on.
    
                    When viewed this way, the slice (partition) parts of the BSD disk identifiers may, in certain circumstances,
                    not appear in numerical order.  This is normal and is likely the result of a recent partition map editing
                    operation in which volumes were kept mounted.
    
                    Note that both human-readable and plist output are sorted as described above.
    
                    See the DEVICES section below for the various forms that the device specification may take for this and all of
                    the other diskutil verbs.
    
         info | information [-plist]device | -all
                    Get detailed information about a specific whole disk or partition.  If -plist is specified, then a property
                    list instead of the normal user-readable output will be emitted.  If -all is specified, then all disks (whole
                    disks and their partitions) are processed.
    
         activity
                    Continuously display system-wide disk manipulation activity as reported by the Disk Arbitration framework
                    until interrupted with a signal (e.g. by typing Control-C).
    
                    This can be useful to watch system-wide activity of disks coming on-line or being ejected, volumes on disks
                    being mounted or unmounted, volumes being renamed, etc.  However, this output must never be parsed; programs
                    should become Disk Arbitration clients instead.
    
                    For debugging information, such as the monitoring of applications dissenting (attempting to deny) activities
                    for disks for which they have registered an interest, you must use the logging features of the
                    diskarbitrationd daemon. Programs needing this information must become Disk Arbitration clients.
    
         listFilesystems [-plist]
                    Show the file system personalities available for formatting in diskutil when using the erasing and
                    partitioning verbs.  This is a subset of the complete set of personalities exported by the various file system
                    bundles that may be installed in the system.  Also shown are some shortcut aliases for common personalities.
                    See the FORMAT section below for more details.  If -plist is specified, then a property list instead of the
                    normal user-readable output will be emitted.
    
         unmount | umount [force]device
                    Unmount a single volume.  Force will force-unmount the volume (less kind to any open files; see also umount
                    (8)).
    
                    Up to a few seconds (or more) may be required for any Disk Arbitration dissenters in the system to approve the
                    unmount, and/or for the file system to flush data.  This verb gives up and returns failure after a maximum of
                    1 minute in most situations.
    
         unmountDisk | umountDisk [force]device
                    Given a disk containing a partition map, unmount all of its volumes. That is, unmounts are attempted for the
                    map's partitions containing file system volumes, as well as for "virtual" volumes exported by storage systems
                    which import data from the map's partitions.  Storage systems supported include APFS, AppleRAID, and
                    CoreStorage.
    
                    Force will force-unmount the volumes (less kind to any open files; see also umount (8)).
    
                    You should specify a whole disk, but all volumes of the whole disk are attempted to be unmounted even if you
                    specify a partition.
    
         eject device
                    Eject a disk.  Media will become offline for the purposes of being a data store for file systems or being a
                    member of constructs such as software RAID or direct data.  Additionally, removable media will become eligible
                    for safe manual removal; automatically-removable media will begin its physical (motorized) eject sequence.
    
         mount [readOnly][nobrowse][-mountOptions option [, option]][-mountPoint path]device
                    Mount a single volume.
    
                    If readOnly is specified, then the file system is mounted read-only, even if writing is supported or allowed
                    by the volume's underlying file system, device, media, or user (e.g. the super-user).  If nobrowse is
                    specified, then the file system is mounted with a recommendation to prevent display (e.g. by the Finder) to
                    the end user.  These options are equivalent to passing rdonly or nobrowse as "-o" arguments to the appropriate
                    file system bundle's mount (8) program.  If -mountOptions is specified, then the argument strings you specify
                    will be passed (by diskarbitrationd) verbatim to "-o"; multiple arguments must be separated with commas.
    
                    Up to a few seconds (or much longer in rare cases) may be required for any Disk Arbitration dissenters or disk
                    claimers in the system to approve the mount, and/or for the file system to complete a minimal fsck(8).  (For
                    example, Disk Arbitration might invoke fsck_apfs -q before mounting an APFS Volume.)  This verb gives up and
                    returns failure after a maximum of 1 minute in most situations.
    
                    If -mountPoint is specified, then your path, rather than the standard path of /Volumes/VolumeName or
                    /System/Volumes/VolumeName, will be used as the view into the volume file content; a directory at that path
                    must already exist.
    
         mountDisk device
                    Mount all mountable and UI-browsable volumes on the given partition map; that is, a mount is attempted on the
                    directly-mountable volume, if any, on each of the whole disk's partitions. However, "virtual" volumes, such as
                    those are implied by e.g. Core Storage Physical Volumes, AppleRAID Members, etc., are not handled.  You should
                    specify a whole disk, but all volumes of the whole disk are attempted to be mounted even if you specify a
                    partition.
    
         rename | renameVolume device name
                    Rename a volume.  Volume names are subject to file system-specific alphabet and length restrictions.
    
         enableJournal device
                    Enable journaling on an HFS+ volume.  This works whether or not the volume is currently mounted (the volume is
                    temporarily mounted if necessary).  Ownership of the affected disk is required.
    
         disableJournal [force]device
                    Disable journaling on an HFS+ volume.  This normally works whether or not the volume is currently mounted (the
                    volume is temporarily mounted if necessary).  If the force option is specified, then journaling is disabled
                    directly on disk; in this case, the volume must not be mounted.  Ownership of the affected disk is required.
    
         moveJournal external journalDevice device
                    Create a 512MB Apple_Journal partition using the journalDevice partition to serve as a journal for the volume
                    device. For best results, journalDevice should be a partition on a different whole-disk than the volume
                    itself.
    
                    The journal for device will be moved externally onto the newly created Apple_Journal partition.
    
                    Since the journalDevice you specify will invariably be larger than 512MB, a new HFS+ partition will be created
                    following the Apple_Journal partition to fill the remaining space.
    
                    Moving the journal works whether or not the volume is mounted, provided journaling is enabled on that volume.
                    No errors are currently supported to flag attempts to move journals on volumes that do not have journaling
                    enabled.  If you have multiple volumes for which you want external journals, each must have its own external
                    Apple_Journal partition.  Ownership of the affected disks is required.
    
         moveJournal internal device
                    Move the journal for device back locally (onto that same device).  Ownership of the affected disk is required.
    
         enableOwnership device
                    Enable ownership of a volume.  The on-root-disk Volume Database at /var/db/volinfo.database is manipulated
                    such that the User and Group ID settings of files, directories, and links (file system objects, or "FSOs") on
                    the target volume are taken into account.
    
                    This setting for a particular volume is persistent across ejects and injects of that volume as seen by the
                    current OS, even across reboots of that OS, because of the entries in this OS's Volume Database.  Note thus
                    that the setting is not kept on the target disk, nor is it in-memory.
    
                    For some locations of devices (e.g. internal hard disks), consideration of ownership settings on FSOs is the
                    default.  For others (e.g. plug-in USB disks), it is not.
    
                    When ownership is disabled, Owner and Group ID settings on FSOs appear to the user and programs as the current
                    user and group instead of their actual on-disk settings, in order to make it easy to use a plug-in disk of
                    which the user has physical possession.
    
                    When ownership is enabled, the Owner and Group ID settings that exist on the disk are taken into account for
                    determining access, and exact settings are written to the disk as FSOs are created.  A common reason for
                    having to enable ownership is when a disk is to contain FSOs whose User and Group ID settings, and thus
                    permissions behavior overall, is critically important, such as when the plug-in disk contains system files to
                    be changed or added to.
    
                    See also the vsdbutil(8) command.  Running as root is required.
    
         disableOwnership device
                    Disable ownership of a volume.  See enableOwnership above.  Running as root is required.
    
         verifyVolume device
                    Verify the file system data structures of a volume.  The appropriate fsck program is executed and the volume
                    is attempted to be left mounted or unmounted as it was before the command.  Any underlying Storage System
                    (e.g. Core Storage, APFS) is verified before the target volume itself.  In certain cases, "live" verify,
                    including of the boot volume, is supported.  Ownership of the disk to be verified is required.
    
         repairVolume device
                    Repair the file system data structures of a volume.  The appropriate fsck program is executed and the volume
                    is attempted to be left mounted or unmounted as it was before the command.  Any underlying Storage System
                    (e.g. Core Storage, APFS) is repaired before the given target volume.  In most cases (e.g. except mount-read-
                    only), the target volume must be unmountable; in all cases, the underlying storage media must be writable.
                    "Live" repair (e.g. of a file-writable mounted volume) is not supported.  Ownership of the affected disk is
                    required.
    
         verifyDisk device
                    Verify the partition map layout of a whole disk intended for booting or data use on a Macintosh.  The checks
                    further include, but are not limited to, the integrity of the EFI System Partition, the integrity of any Core
                    Storage Physical Volume partitions, and provisioning of space for boot loaders.  Ownership of the disk to be
                    verified is required; it must be a whole disk and must have a partition map.
    
         repairDisk device
                    Repair the partition map layout of a whole disk intended for booting or data use on a Macintosh.  The repairs
                    further include, but are not limited to, the repair or creation of an EFI System Partition, the integrity of
                    any Core Storage Physical Volume partitions, and the provisioning of space for boot loaders.  Ownership of the
                    affected disk is required; it must be a whole disk and must have a partition map.
    
         resetFusion
                    For Fusion Drive machines (two internal disk device hardware configurations), reset the disk devices in the
                    machine to the factory-like state of one empty Fusion volume.
    
                    This command will only run on a machine that contains exactly two internal disk devices: one solid-state
                    device (SSD) and one rotational device (HDD), or, alternatively, two solid-state devices.  This command must
                    be able to make a positive identification thereof.  If these requirements are met, you are prompted, and if
                    you confirm, the erase and reset begins.
    
                    Both internal disk devices are (re)-partitioned with GPT maps, and then they are turned into (used to create)
                    an APFS Fusion Drive Container with one APFS Volume.
    
                    All internal-disk data is lost. This includes any "extra" partitions (e.g. for Boot Camp or other "user"
                    purposes).  No system software is installed and no user data is restored.  After running this command, you
                    should (re)-install macOS on the machine (on the newly-created APFS Volume); otherwise, the machine will not
                    be usable (bootable).
    
                    You generally must be booted from the Internet Recovery System (CMD-OPT-R) or from an externally-connected
                    macOS boot disk (e.g. a USB drive), because you cannot erase a disk that hosts the currently-running macOS.
    
                    Externally-connected disk(s) are not affected.  Ownership of the affected disks is required.
    
         eraseDisk format name [APM[Format]| MBR[Format]| GPT[Format]]device
                    Erase an existing disk, removing all volumes and writing out a new partitioning scheme containing one new
                    empty file system volume.  If the partitioning scheme is not specified, then an appropriate one for the
                    current machine is chosen.  Format is discussed below in the section for the partitionDisk verb.  Ownership of
                    the affected disk is required.
    
         eraseVolume format name device
                    Write out a new empty file system volume (erasing any current file system volume) on an existing partition.
                    The partition remains but its data is lost.  Format is discussed below in the section for the partitionDisk
                    verb.
    
                    If you specify Free Space for format, the partition itself is deleted (removed entirely) from the partition
                    map instead of merely being erased.  Ownership of the affected disk is required.
    
         reformat device
                    Erase an existing volume by writing out a new empty file system of the same personality (type) and with the
                    same volume name.  Ownership of the affected disk is required.
    
         eraseOptical [quick]device
                    Erase optical media (CD/RW, DVD/RW, etc.).  Quick specifies whether the disc recording system software should
                    do a full erase or a quick erase.  Ownership of the affected disk is required.
    
         zeroDisk   [force][short]device
                    Erase a device, writing zeros to the media.  The device can be a whole-disk or a partition.  In either case,
                    in order to be useful again, zeroed whole-disks will need to be (re)partitioned, or zeroed partitions will
                    need to be (re)formatted with a file system, e.g. by using the partitionDisk, eraseDisk, or eraseVolume verbs.
    
                    If you desire a more sophisticated erase algorithm or if you need to erase only free space not in use for
                    files, use the secureErase verb.
    
                    The force parameter causes best-effort, non-error-terminating, forced unmounts and shared-mode writes to be
                    attempted; however, this is still no guarantee against drivers which claim the disk exclusively. In such
                    cases, you may have to first unmount all overlying logical volumes (e.g. CoreStorage or AppleRAID). If a disk
                    is partially damaged in just a certain unlucky way, you might even have to un-install a kext or erase the disk
                    elsewhere.
    
                    The short parameter causes only a minimal amount of zeros to be written ("wipefs"); this is quick. You can use
                    this to prevent inadvertent identification by software, e.g. as filesystem data.
    
                    Ownership of the affected disk is required.
    
         randomDisk [times]device
                    Erase a whole disk, writing random data to the media.  Times is the optional (defaults to 1) number of times
                    to write random information.  The device can be a whole-disk or a partition.  In either case, in order to be
                    useful again, randomized whole-disks will need to be (re)partitioned, or randomized partitions will need to be
                    (re)formatted with a file system, e.g. by using the partitionDisk, eraseDisk, or eraseVolume verbs.  If you
                    desire a more sophisticated erase algorithm or if you need to erase only free space not in use for files, use
                    the secureErase verb.  Ownership of the affected disk is required.
    
         secureErase [freespace]level device
                    Erase, using a "secure" (but see the NOTE below) method, either a whole-disk (including all of its partitions
                    if partitioned), or, only the free space (not in use for files) on a currently-mounted volume.  Secure erasing
                    makes it harder to recover data using "file recovery" software.
    
                    Erasing a whole-disk will leave it useless until it is partitioned again.  Erasing freespace on a volume will
                    leave your files intact, indeed, from an end-user perspective, it will appear unchanged, with the exception
                    that it will have attempted to make it impossible to recover deleted files.
    
                    If you need to erase all contents of a partition but not its hosting whole-disk, use the zeroDisk or
                    randomDisk verbs.  Ownership of the affected disk is required.
    
                    Level should be one of the following:
    
                          o   0 - Single-pass zero fill erase.
    
                          o   1 - Single-pass random fill erase.
    
                          o   2 - Seven-pass erase, consisting of zero fills and all-ones fills plus a final random fill.
    
                          o   3 - Gutmann algorithm 35-pass erase.
    
                          o   4 - Three-pass erase, consisting of two random fills plus a final zero fill.
    
                    NOTE: This kind of secure erase is no longer considered safe. Modern devices have wear-leveling, block-
                    sparing, and possibly-persistent cache hardware, which cannot be completely erased by these commands. The
                    modern solution for quickly and securely erasing your data is encryption. Strongly-encrypted data can be
                    instantly "erased" by destroying (or losing) the key (password), because this renders your data irretrievable
                    in practical terms.  Consider using APFS encryption (FileVault).
    
         partitionDisk device [numberOfPartitions][APM[Format]| MBR[Format]| GPT[Format]][part1Format part1Name part1Size
                    part2Format part2Name part2Size part3Format part3Name part3Size ...]
    
                    (re)Partition a disk, removing all volumes.  All volumes on this disk will be destroyed.  The device parameter
                    specifies which whole disk is to be partitioned.  The optional numberOfPartitions parameter specifies the
                    number of partitions to create; if given then the number of parameter triplets (see below) is expected to
                    match; else, the number of triplets alone given will determine the number of partitions created.
    
                    The optional partitioning scheme parameter forces a particular partitioning scheme; if not specified, a
                    suitable default is chosen.  They are:
    
                          o   APM[Format]specifies that an Apple Partition Map scheme should be used.  This is the traditional
                              Apple partitioning scheme used to start up a PowerPC-based Macintosh computer, to use the disk as a
                              non-startup disk with any Mac, or to create a multiplatform compatible startup disk.
    
                          o   MBR[Format]specifies that a Master Boot Record scheme should be used.  This is the DOS/Windows-
                              compatible partitioning scheme.
    
                          o   GPT[Format]specifies that a GUID Partitioning Table scheme should be used.  This is the
                              partitioning scheme used to start up an Intel-based Macintosh computer.
    
                    For each partition, a triplet of the desired file system format, volume name, and size must be specified.
                    Several other diskutil verbs allow these triplets as well (and for them, the numberOfPartitions parameter is
                    also optional).  The triplets must be as follows:
    
                          o   Format names are of the form jhfs+, HFS+, MS-DOS, etc.; a list of formattable file systems (more
                              precisely, specific file system personalities exported by the installed file system bundles) and
                              common aliases is available from the listFilesystems verb.
    
                              Format guides diskutil both in what partition type to set for the partitions (slices) as well as
                              what file system structures to initialize therein, using the file system bundle's plist's
                              FormatExecutable setting which usually points to the appropriate formatter program such as
                              newfs_hfs(8).
    
                              You can specify a format of Free Space to skip an area of the disk.
    
                              You can specify the partition type manually and directly with a format of %% such as %Apple_HFS% or %% such as
                              %48465300-0000-11AA-AA11-00306543ECAC%; these imply a name of %noformat% (below).  Human-readable
                              types must be known to the system but UUID types (GPT scheme only) can be arbitrary.
    
                          o   Names are the initial volume names; they must conform to file system specific restrictions.
    
                              If a name of %noformat% is specified, then the partition is left blank such that the partition space
                              is carved out, the partition type is set according to the file system format name or explicit type,
                              the partition space is partially erased ("wiped"), but a file system structure is not initialized
                              with any file system's formatter program, e.g.  newfs_hfs(8). This is useful for setting up
                              partitions that will contain user-defined (not necessarily file system) data.
    
                              For a triplet whose format is Free Space or a directly-specified partition type, its name is ignored
                              but a dummy name must nevertheless be present.
    
                          o   Sizes are floating point numbers followed by a letter or percent sign as described in the SIZES
                              section at the end of this page (e.g. 165536000, 55.3T, 678M, 75%, R).
    
                    In addition to explicitly-requested partitions, space (gaps) might be allocated to satisfy certain
                    filesystems' position and length alignment requirements; space might be allocated for possible future booter
                    partition insertion; and indeed, actual booter partitions might be implicitly created.
    
                    In particular, there is a rule that unrecognized partitions 1GiB or larger automatically acquire booters.
                    Thus, if you create an arbitrary partition with e.g.  diskutil partitionDisk disk0 gpt
                    %11112222-1111-2222-1111-111122221111% %noformat% 3gib jhfs+ Untitled r, then a booter partition will also be
                    created. You can always delete that booter with diskutil eraseVolume "Free Space" dummy disk0s3.
    
                    The last partition is usually automatically lengthened to the end of the partition map (disk).  You can
                    specify an exact size for your last partition by specifying it as the penultimate triplet and specifying an
                    additional (last) triplet as Free Space.  Or you can use the R (remainder) size specifier for one of your
                    middle partitions while specifying an exact size for your last partition.
    
                    Ownership of the affected disk is required.
    
         resizeVolume device limits | mapsize [-plist]| R | size [numberOfPartitions][part1Format part1Name part1Size
                    part2Format part2Name part2Size part3Format part3Name part3Size ...]
                    Non-destructively resize a volume (partition); you may increase or decrease its size.  Alternatively, take no
                    action and print information.
    
                    Specifying limits instead of size takes no action, but instead prints the range of valid values for the target
                    partition, taking into account current file system and partition map conditions such as files in use and other
                    (immovable) partitions following the target.
    
                    Specifying mapsize instead of size takes no action, but instead prints the size of the encompassing whole-disk
                    device, as well as the size of the entire partition map (all partitions less map overhead). The whole-disk
                    device might be larger than the partition map if the whole-disk device has grown since the partition map was
                    created. Growing a whole-disk device is possible with certain enterprise disk (RAID) systems.
    
                    The -plist option will print partition or whole-disk size inquiry information in property list format.
    
                    You can grow a volume (partition) (back) to its maximum size possible, provided no new partitions have been
                    created that are in the way, by specifying R for the new volume size. You should use R instead of attempting
                    an absolute value such as 100% because the latter cannot count partition map overhead.
    
                    When decreasing the size, new partitions may optionally be created to fill the newly-freed space.  To do this,
                    specify the numberOfPartitions, format, name, and size parameters in the same manner as the triplet
                    description for the partitionDisk verb.
    
                    Resizing a volume that is currently set as the computer's startup disk will invalidate that setting; use the
                    Startup Disk System Preferences panel or bless (8) to reset the resized volume as the startup disk.
    
                    Device refers to a volume; the volume's file system must be journaled HFS+.  Valid sizes are a number followed
                    by a capital letter multiplier or percent sign suffix as described in the SIZES section at the end of this
                    page (e.g. 1.5T, 128M, 50%).  Ownership of the affected disk is required.
    
         splitPartition device [numberOfPartitions][part1Format part1Name part1Size part2Format part2Name part2Size part3Format
                    part3Name part3Size ...]
                    Destructively split a volume into multiple partitions.  You must supply a list of new partitions to create in
                    the space of the old partition; specify these with the numberOfPartitions, format, name, and size parameters
                    in the same manner as the triplet description for the partitionDisk verb.
    
                    For one of your triplets, you can optionally specify the R meta-size in lieu of a constant number value for
                    the size parameter: the substituted value will be exactly the amount of space necessary to complete the re-
                    filling of the original partition with all of your triplets.
    
                    Device refers to a volume.  Ownership of the affected disk is required.
    
         mergePartitions [force]format name fromDevice toDevice
                    Merge two or more partitions on a disk.  All data on merged partitions other than the first will be lost.
                    Data on the first partition will be lost as well if the force argument is given.
    
                    If force is not given, and the first partition has a resizable file system (e.g. JHFS+), the file system will
                    be preserved and grown in a data-preserving manner; your format and name parameters are ignored in this case.
                    If force is not given, and the first partition is not resizable, you are prompted if you want to format.  You
                    will also be prompted to format if the first partition has an (HFS) Allocation Block Size which is too small
                    to support the required growth of the first partition; see the -b option for newfs_hfs (8).
    
                    If force is given, the final resulting partition is always (re)formatted. You should do this if you wish to
                    (re)format to a new file system type.  You will be prompted to confirm.
    
                    Format and name must always be given, but they have an effect only when force is given.
    
                    Merged partitions are required to be ordered sequentially on disk (see diskutil list for the actual on-disk
                    ordering).  All partitions in the range, except for the first one, must be unmountable.  Ownership of the
                    affected disk is required.
    
         addPartition device format name size
                    Create a new partition following an existing partition.  The new partition will start immediately beyond the
                    end (start + size) of the existing partition.
    
                    If device is a partition, then a new partition will be created in the gap that follows it, formatted with the
                    file system personality format, with an initial volume name of name, extending for size, in the same manner as
                    the triplet description for the partitionDisk verb.
    
                    If device is a (partition map-bearing) whole disk, then the new partition will automatically be placed last in
                    the map.
    
                    Alternatively, you can create a new partition without any formatting by providing the partition type manually.
                    To do so, pass a format parameter in the form of % followed by a raw GPT UUID or valid human-readable
                    ioContent string followed by %, together with %noformat% for name.  In this usage, any old on-disk data at the
                    location of the new partition will be "wiped" (partially set to zeroes) to avoid any undesired interpretation.
    
                    You can request fit-to-fill by specifying a size of 0.
    
                    The partition map scheme must be GPT.  A gap must exist at the target location, which will generally not be
                    the case unless you have resized or deleted partitions.  The partition map must contain at least one entry
                    (the EFI partition suffices).  Ownership of the affected disk is required.
    
         APFS | ap apfsVerb [...]
                    Apple APFS is a system of virtual volumes.  APFS verbs can be used to create, manipulate and destroy APFS
                    Containers and their APFS Volumes.  Apple APFS defines these types of objects:
    
                          o   Container - An APFS Container imports one or more APFS Physical Store disks and exports zero or more
                              APFS Volume disks.  Zero or more APFS Containers can exist in (might be attached to) the system at
                              any one time.
    
                              While attached, the "handle" by which an APFS Container is identified is by its APFS Container
                              Reference disk (device), e.g. "disk5" or "/dev/disk5". You should treat this as an opaque reference
                              token.
    
                              The Container Reference disk is a synthesized whole-disk which is exported by APFS for
                              identification purposes only; it has no storage. It is associated with the AppleAPFSContainerScheme
                              node in the IO Registry. While APFS Volume device identifiers appear to be of a related form, you
                              should never use the Container Reference as a basis to create device identifiers yourself; use the
                              listing verbs with their plist options instead.
    
                              An APFS Container has a certain fixed size (capacity) which, via its Physical Store(s), uses
                              physical space on a device. An APFS Container can be resized, but this is not a part of normal
                              operation.
    
                          o   Physical Store - An APFS Physical Store is a disk which is imported into (that is, which backs,
                              indeed defines) an APFS Container. An APFS Container can import more than one Physical Store, e.g.
                              for Fusion-style Containers.
    
                              An APFS Physical Store disk is not necessarily a disk from a partition map; it could be e.g. an
                              AppleRAID Set disk. Therefore, you must never assume that an APFS Physical Store's disk identifier
                              is a 2-part form such as disk0s2.
    
                          o   Volume - An APFS Volume is an [un]mountable file system volume which is exported from an APFS
                              Container.  Zero or more APFS Volumes may be exported out of an APFS Container.
    
                              An APFS Volume is identified by its device node, e.g. "disk5s1" or "/dev/disk5s1". The term
                              volumeDevice is used below to refer to this device node.
    
                              APFS Volumes have no specified "size" (capacity). Instead, all APFS Volumes consume capacity out of
                              the remaining free space of their parent APFS Container, consuming or returning such capacity as
                              user file data is added or deleted. Note that this means that all Volumes within a Container compete
                              for the Container's remaining capacity. However, you can manage Volume allocation with the optional
                              reserve and quota size values.
    
                              The optional reserve size requests an assured minimum capacity for an APFS Volume. If successfully
                              created, the Volume is guaranteed to be able to store at least this many bytes of user file data.
                              Note that beyond this, the Volume might be able to store even more until constrained by reaching
                              zero free space in its parent Container or by reaching a quota, if any. You can use a reserve to
                              prevent running out of capacity due to competition from other Volumes or from a Container shrink
                              attempt.
    
                              The optional quota size applies a maximum capacity to an APFS Volume, placing a limit on the number
                              of bytes of user file data which can be stored on the Volume. Note that you might not be able to
                              reach this limit if its parent Container becomes full first. You can use a quota to enforce
                              accounting or to manage against "unfair" premature filling-up of the parent Container due solely to
                              this Volume at the expense of sibling Volumes.
    
                              APFS Volumes can be tagged with zero or more role metadata flags which give a hint as to their
                              intended use.  Not all combinations of flags are valid, and not all flags are allowed to be set or
                              changed by a user.
    
                              Efficient file copy cloning (copy-on-write) is supported; see copyfile(3) COPYFILE_CLONE.
    
                              Optional volume-level encryption is supported (see also Volume Groups below).  An APFS Volume can be
                              in an encrypted state because it was converted from a Core Storage encrypted volume, or because it
                              was created as encrypted from its inception (e.g. with the diskutil apfs addVolume -passphrase verb)
                              or because FileVault was enabled on it at some later time.  On machines that support hardware
                              encryption, the on-disk-device data for local volumes is encrypted even if FileVault is not enabled;
                              this is termed "encrypted at rest".
    
                              The format of an APFS Volume's device identifier (volumeDevice) is that of a slice disk of a special
                              whole-disk; both disks are synthesized by APFS. The "whole" identifier number (a positive possibly-
                              multi-digit integer) is arbitrary, and the "slice" numbers (positive possibly-multi-digit integers)
                              count up from 1 with each new Volume. Deleting Volumes may cause gaps in the numbering.  This form
                              appears the same as a partition (map) scheme and partitions, but it is completely unrelated.  For
                              example: If "disk3s2" is a Physical Store defining a Container, then "disk5s1", "disk5s2", and
                              "disk5s3" might be the Container's Volumes; "disk5" exists but is never used directly.
    
                              Although it has a device node, an APFS Volume's data may only be accessed through its files; 3rd-
                              party code cannot open an APFS Volume device node to "directly" access its on-disk bytes.
    
                          o   Snapshot - An APFS Snapshot represents a read-only copy of its parent (or "base") APFS Volume,
                              frozen at the moment of its creation.  An APFS Volume can have zero or more associated APFS
                              Snapshots.
    
                              APFS Snapshots are normally not discoverable unless the "base" or one of the snapshots is mounted.
                              APFS Snapshots are uniquely identified with a UUID (preferred) or within their parent Volume's
                              namespace by either a numeric identifier or by their name; they can be renamed, but APFS will never
                              allow duplication of names (within a Volume) to occur.
    
                              APFS Snapshots are mountable; when this occurs, its mount point (separate from and simultaneous with
                              its parent Volume) provides a read-only historic version of the Volume content at Snapshot creation
                              time.
    
                              You can revert the present state of an APFS Volume back to equality with a Snapshot in its history.
                              This is a destructive reset/restore operation: Once a Volume is reverted, it cannot be brought
                              forward.  Any Snapshots between the revert point and the present are lost as well.
    
                              You can delete a Snapshot; this removes the possibility of ever reverting to that Snapshot's state,
                              but does not affect the Volume's present-time content.
    
                              An APFS Snapshot mount point's "source device" (its statfs(2) f_mntfromname shown by the mount(8)
                              command) is not necessarily a device node (e.g. disk0s2) as is common; it can be the Snapshot name
                              followed by the '@' character and the "parent" Volume's device node, e.g.
                              "SnapName123@/dev/disk2s1".  See the mount_apfs(8) -s and fs_snapshot_create(2) commands. However,
                              it is also possible for f_mntfromname to have a 3-part form ("diskCsVsS") if you are rooted (booted)
                              from an APFS Snapshot; in this case, its "base" Volume (e.g. "diskCsV") will not be mounted.
    
                          o   Volume Group - Collections of APFS Volumes can be associated with each other via an APFS Volume
                              Group.  Zero or more APFS Volume Groups may exist on any given APFS Container. The "members" (APFS
                              Volumes) of any particular APFS Volume Group must all be on the same APFS Container. There is no
                              such thing as an "empty" (zero-member) APFS Volume Group.
    
                              APFS Volume Groups are identified using their Volume Group ID (a UUID). Assignment of this ID may be
                              deferred in some cases.
    
                              A primary use for APFS Volume Groups is realization of macOS installations in which "System"-role
                              (for the operating system) and "Data"-role (for user data) APFS Volumes are functionally linked
                              (overlaid file namespace, crypto info), yet separated for reasons of security, backup, and software
                              update.
    
                              Cryptographic identity, if any, is shared among all members of an APFS Volume Group.
    
                    APFS itself has no provision for backing up your data.  Backups should be always be performed on a regular
                    basis and before modifying any APFS Container using these commands.
    
                    The following is a list of APFS sub-verbs with their descriptions and individual arguments.
    
                    list [-plist][containerReferenceDevice]
                               Display APFS objects as a tree. APFS Container(s) are shown with their imported Physical Store(s)
                               and exported Volume(s).
    
                               All currently-attached APFS Containers in the system are listed unless you specify a
                               containerReferenceDevice, which limits the output to that specific APFS Container family.
    
                               If -plist is specified, then a property list will be emitted instead of the normal user-readable
                               output.
    
                    convert device [-dryrun][-prebootSource yourStagingDirectory][-noPrebootAdditions]
                               Non-destructively convert an HFS volume to an APFS Container with a single (but see below) APFS
                               Volume. The APFS Container can later be manipulated (e.g. adding and deleting APFS Volumes) as
                               usual.  This verb can be used to convert nonbootable "data"-only volumes as well as "macOS" volumes
                               (see below).
    
                               The source HFS volume can be located on a GPT partition or on an encrypted or non-encrypted, Fusion
                               or non-Fusion CoreStorage logical volume (LV).  In the latter case, the CoreStorage logical volume
                               group (LVG) is dismantled, including automatic removal of any related Boot Camp Assistant
                               partition(s).
    
                               If -dryrun is specified, all calculations, checks, and some data moving is performed, but your disk
                               is left as valid HFS (headers remain declared as HFS, partition types are left alone, etc).
    
                               For volumes currently or planned to be macOS-bearing (and bootable), you can optionally specify
                               -prebootSource with your own staging directory of macOS boot items; a Preboot Role APFS Volume with
                               a UUID directory will automatically be created as part of the conversion process to facilitate
                               macOS bootstrap.  Normally your directory should be writable; additional (cryptographic and EFI
                               rendering) items are automatically added to your directory prior to conversion and are not removed
                               afterwards.  You can opt-out of automatic item addition with the -noPrebootAdditions option.
    
                               Ownership of the affected disks is required.
    
                    create device [device]name
                               Convenience verb which creates an empty APFS Container and then adds one APFS Volume with the given
                               name.  The APFS Volume will have default attributes such as no encryption, no capacity reserve nor
                               quota, etc.  If you specify more than one device, a Fusion Container is created, with the
                               performance parts assigned automatically.  This is a combination of the diskutil apfs
                               createContainer and diskutil apfs addVolume verbs.
    
                               Ownership of the affected disks is required.
    
                    createContainer [-main]device [-secondary][device]
                               Create an empty APFS Container.  The device(s) specified become APFS Physical Stores.  If you
                               specify more than one device, a Fusion Container is created.
    
                               For Fusion cases, if you do not explicitly use the -main and -secondary options, the performance
                               duties are assigned automatically; this is preferred.  Rotational vs. solid-state hardware design
                               must be detectable; this is often not the case for external disks. Solid-state hardware is welcome
                               but not required; it is the identification which holds as a hard requirement with this usage.
    
                               Alternatively, you can explicitly specify -main and -secondary devices; if you do so, you must
                               specify both.  The "main" device is assumed to be "faster" (you should use solid-state hardware if
                               available), while the "secondary" device is assumed to be "slower" and is often used to store OS-
                               associated "auxiliary" data such as a Boot Camp Assistant partition.
    
                               You cannot mix the use of disks from a disk image and not from a disk image.
    
                               After running this command, you may add APFS Volumes with the diskutil apfs addVolume verb; you
                               must do this at least once in order to "use" the new Container.
    
                               Ownership of the affected disks is required.
    
                    deleteContainer [-force]containerReferenceDevice | physicalStoreDevice [newName][newFormat newName newSize]
                               Destroy an existing APFS Container, including all of its APFS Volumes.  Data on all of those
                               volumes will be lost.
    
                               You can identify the APFS Container by its Container Reference disk (preferred), or by one of its
                               Physical Store disk(s).
    
                               The APFS Volumes are unmounted first; this process may not succeed if one or more is busy, in which
                               case deleteContainer is aborted and all data is left intact (although some volumes might now be
                               unmounted).
    
                               Otherwise, all APFS Volumes are deleted, their encryption-store entries are removed as applicable,
                               the parent APFS Container is deleted, and the APFS Container's former Physical Store(s) are
                               disposed of as follows:
    
                               If you did not specify a newName and all Physical Stores are partitions, then those partitions are
                               deleted (turned into free space).  You might then wish to use diskutil addPartition to re-purpose
                               the newly-created gap in your partition map.
    
                               If you did specify a newName, or if one or more Physical Stores are whole disks (e.g. AppleRAID),
                               then they are reformatted (as something other than APFS) with volume name(s) based on newName.
    
                               If you specified the triplet of newFormat newName newSize in the same manner as when using the
                               partitionDisk verb, then they are each reformatted with the specified format and volume names based
                               on newName.  Only a newSize of 0 (fit-to-fill) is currently supported.
    
                               If your APFS Container is damaged, a Container Reference for it might not exist or it might not be
                               functional. In this case, you can reclaim your former APFS Physical Store disk(s) by specifying the
                               -force option; this activates an alternate last-resort mode. In this mode, if you had more than one
                               Physical Store (e.g. the Fusion case) and the Container is sufficiently damaged, you might have to
                               delete each Physical Store manually.  You should normally avoid this mode.
    
                               Ownership of the affected disks is required.
    
                    resizeContainer containerReferenceDevice | physicalStoreDevice limits [-plist]| size [part1Format part1Name
                               part1Size part2Format part2Name part2Size part3Format part3Name part3Size ...]
                               Resize an existing APFS Container by specifying either an APFS Container Reference (preferred) or
                               an APFS Physical Store partition, plus a proposed new size.  Alternatively, take no action and
                               print constraint information.  The operation is live, non-destructive, and does not mount or
                               unmount any APFS Volumes.
    
                               If you specify an APFS Container Reference and that Container imports more than one Physical Store
                               (in e.g. Fusion setups), the appropriate Physical Store will be chosen automatically.
    
                               Specifying limits instead of a size causes no action to be taken, but instead prints a range of
                               valid values, taking into account various constraints; the -plist option will print this
                               information in property list format.
    
                               Shrinks are constrained by the amount of data usage by all APFS Volumes on the targeted or implied
                               APFS Container.  Contributing to this data usage is the file content on the APFS Volumes, the
                               existence of quotas and/or reserves, the usage of APFS Snapshots (e.g. by Time Machine), and
                               metadata overhead.
    
                               Grows are constrained by the amount of partition map free space trailing the targeted or implied
                               Physical Store partition.
    
                               When shrinking, new partitions may optionally be created to fill the newly-freed space.  To do
                               this, specify the format, name, and size parameters in the same manner as the triplet description
                               for the partitionDisk verb.
    
                               You can specify a size of zero (0) to grow the targeted APFS Physical Store such that all remaining
                               space is filled to the next partition or the end of the partition map.
    
                               Ownership of the affected disks is required, and all APFS Volumes on the Container must be
                               unlocked.
    
                    addVolume  containerReferenceDevice filesystem name [-passprompt]| [-passphrase passphrase]|
                               [-stdinpassphrase][-passphraseHint passphraseHint][-reserve reserve][-quota quota][-role roles]
                               [-group[With]| -sibling groupDevice][-nomount][-mountpoint mountpoint]
                               Add a new APFS Volume to an existing APFS Container. Files can then be stored on this newly-created
                               APFS Volume.
    
                               The filesystem parameter sets the permanent APFS personality for this new APFS Volume; you should
                               specify APFS or Case-sensitive APFS.
    
                               The new APFS Volume will be unencrypted unless you specify one of the passphrase options, in which
                               case the volume will be encrypted from the beginning of its existence (as opposed to having
                               encryption applied later); the user which is added will be the "Disk User".  The optional
                               passphraseHint is a user-defined string that can be displayed even while an encrypted APFS Volume
                               is locked.
    
                               APFS Volumes have no fixed size; they allocate backing store on an as-needed basis.  You can
                               specify the reserve parameter to guarantee a minimum amount of space for your volume; at least that
                               many bytes will be available for file data.  You can also specify the quota parameter to limit your
                               volume's file usage to a maximum amount; no more than that many bytes will be available for file
                               data, even if there is otherwise enough space in the parent APFS Container.  You can specify both
                               reserve and quota simultaneously; however, the reserve is not allowed to be larger than the quota.
    
                               APFS Volumes can be tagged with certain role metadata flags; you can supply the roles parameter
                               with any combination of one or more of the characters BRVITSDUNEXHLCYG, or 0 as a no-op for
                               scripting convenience; the meaning of these characters is, respectively: B=Preboot (boot loader),
                               R=Recovery, V=VM (swap space), I=Installer (temporary usage), T=Backup (Time Machine), S=System,
                               D=Data, U=User, N=Baseband, E=Update, X=XART (hardware security), H=Hardware, L=Internal, C=Sidecar
                               (Time Machine), Y=Enterprise (data), and G=iDiagnostics (EFI).  Note that you may be limited to
                               only one role at a time and various other rules.
    
                               If you specify -groupWith, your new APFS Volume will become a member of the same APFS Volume Group
                               as the APFS Volume groupDevice.  If groupDevice is not yet associated with any group, such will be
                               created automatically when appropriate.
    
                               The new APFS Volume is explicitly mounted after creation; you can specify -nomount to leave it
                               unmounted, or, you can supply a "custom" mountpoint path, in which case you must be root, the
                               directory must already exist, and you must delete the directory yourself when you unmount.
    
                               Ownership of the affected disks is required.
    
                    deleteVolume volumeDevice
                               Remove the given APFS Volume from its APFS Container. All of the Volume's data will be lost.
                               Additionally, a best-effort (error ignored) attempt is made to remove any corresponding XART,
                               Preboot, and Recovery entries.
    
                               Ownership of the affected disks is required.
    
                    deleteVolumeGroup volumeGroupUUID
                               Remove all APFS Volumes belonging to the given APFS Volume Group from its APFS Container.  All of
                               the Volumes' data will be lost.  Additionally, a best-effort (error ignored) attempt is made to
                               remove any corresponding XART, Preboot, and Recovery entries for each Volume.  It is then
                               positively verified that the Volume Group no longer exists.
    
                               Removal will not start unless all Volumes in the Group can first be successfully unmounted.
    
                               Ownership of the parent APFS Container is required.
    
                    eraseVolume volumeDevice -name newName [-passprompt]| [-passphrase passphrase]| [-stdinpassphrase]
                               [-passphraseHint passphraseHint][-role roles][-group[With]| -sibling groupDevice]
                               Erase the contents of an existing APFS Volume; all of its data will be lost.  Unlike diskutil apfs
                               deleteVolume, the APFS Volume is not removed from its APFS Container.
    
                               The "new" APFS Volume will inherit the APFS file system type (Case-sensitive or not) but will not
                               inherit attributes such as name, reserve, quota, role, or encryption status.
    
                               The "new" APFS Volume will be unencrypted, unless you supply passphrase options in the same manner
                               as diskutil apfs addVolume in which case it will be encrypted and initially accessible by the "Disk
                               User".
    
                               The -role and -groupWith options function in the same manner as diskutil apfs addVolume.
    
                               If you need more control, you should delete and (re-)add the Volume instead.
    
                               Ownership of the affected disks is required.
    
                    changeVolumeRole | chrole volumeDevice roles
                               Change the role metadata flags of an existing APFS Volume.
    
                               The roles should be any combination of one or more of the characters
                               brvitsdunexhlcygBRVITSDUNEXHLCYG in much the same manner as diskutil apfs addVolume above, in which
                               unspecified flags are left alone, use of lower-case causes flags to be cleared, and use of upper-
                               case causes flags to be set.  Alternatively, clear will remove all flags, or 0 can be used as a no-
                               op for scripting convenience.  You should not make any assumptions about the usage or legal
                               combinations of role flags.
    
                               Ownership of the affected disks is required.
    
                    unlockVolume | unlock volumeDevice [-user disk | -user cryptoUserUUID | -recoverykeychain file][-passphrase
                               passphrase]| [-stdinpassphrase][-nomount | -mountpoint mountpoint][-systemreadwrite][-verify]
                               [-plist]
                               Unlock and mount an encrypted and locked APFS Volume or verify a passphrase.
    
                               If you do not supply the -user option, then all cryptographic users on that APFS Volume are
                               searched for a match; if you supply -user disk then the Disk UUID (which equals the APFS Volume
                               UUID) user is assumed; if you supply -user with a UUID then that specific user is assumed; if you
                               instead supply -recoverykeychain then the Institutional Recovery user (see below) is assumed.
    
                               You will be prompted interactively for a passphrase unless you specify a passphrase parameter with
                               -passphrase or pipe your passphrase into stdin and use -stdinpassphrase.
    
                               As an alternative to a passphrase, you can specify -recoverykeychain with a full path to a keychain
                               file if an Institutional Recovery Key has been previously set up on the APFS Volume. The keychain
                               must be unlocked; see security(1) and fdesetup(8) for more information.
    
                               This command will normally mount the APFS Volume after unlocking; if part of a Volume Group
                               "System"/"Data"-role pair, both will be mounted.  If (one of the) volume(s) is of the
                               "System"-role, then it will be mounted as read-only unless you specify the -systemreadwrite option.
                               You can skip the explicit mounting step with the -nomount option, or specify a "custom" mountpoint
                               with the -mountpoint option. If you specify your own mountpoint path, it must exist and you must
                               have write privileges on it (e.g. usually you must be root).
    
                               Specifying -verify will test passphrase correctness without affecting the locked or unlocked state.
    
                               If -plist is specified, then a property list will be emitted instead of the normal user-readable
                               output; this list provides additional detail.
    
                               To re-lock the volume, unmount it, e.g. with diskutil unmount or diskutil apfs lockVolume.
    
                               Ownership of the affected disks is required.
    
                    lockVolume | lock volumeDevice
                               Unmount and lock an encrypted unlocked APFS Volume. This is mostly a synonym for diskutil unmount.
    
                               Ownership of the affected disks is required.
    
                    listCryptoUsers | listUsers | listCryptoKeys | listKeys [-plist]volumeDevice
                               Show all cryptographic users and special-purpose (e.g. recovery) "users" (keys) that are currently
                               associated with the given APFS Volume, each by their Cryptographic User UUID and usage "type".
    
                               The usual purpose of an APFS Cryptographic User is to authenticate for unlocking its APFS Volume;
                               any of its users can do so.
    
                               An APFS Volume need not be encrypted in order to contain crypto users; indeed, other than the Disk
                               User, they should be added before encrypting.
    
                               Types of Cryptographic Users include the at-most-one-per-Volume "Disk" user, whose UUID value
                               always matches its Volume's UUID; iCloud or personal "Recovery Keys", which are not users per se,
                               but instead store partial crypto keys and are paired with corresponding "Recovery Users" and have
                               fixed-constant UUID values; and, most commonly, "Open Directory" users, whose UUID values match
                               corresponding local macOS Open Directory (OD) account user GUIDs (e.g. the common local user
                               accounts; see dscl(1) for more information).
    
                               If -plist is specified, then a property list will be emitted instead of the normal user-readable
                               output.
    
                    changePassphrase | changeCryptoUserPassphrase | passwd volumeDevice -user disk | cryptoUserUUID
                               [-oldPassphrase oldPassphrase | -oldStdinpassphrase][-newPassphrase newPassphrase |
                               -newStdinpassphrase]
                               Change the passphrase of the given cryptographic user associated with the given APFS Volume.
    
                               The old and new passphrases are specified in the same manner as diskutil apfs addVolume; you will
                               be interactively prompted as necessary if you do not specify both.
    
                               Ownership of the affected disks is required.
    
                    setPassphraseHint | setCryptoUserPassphraseHint | hint volumeDevice -user disk | cryptoUserUUID -hint
                               hintMessage | -clear
                               Set an arbitrary hint string to aid recall of a passphrase for the given cryptographic user
                               associated with the given APFS Volume. Specifying -clear will clear any existing hint (no hint is
                               the default).
    
                               Ownership of the affected disks is required.
    
                    encryptVolume | encrypt | enableFileVault volumeDevice -user disk | existingCryptoUserUUID [-passphrase
                               existingOrNewPassphrase | -stdinpassphrase]
                               Start encryption of a currently-unencrypted APFS Volume ("Enable FileVault").  Depending on
                               hardware, the operation may be accomplished immediately, or it may proceed "in the background".
    
                               You can supply an existing cryptographic user UUID, in which case you must supply its corresponding
                               passphrase, or you can supply disk (or the Disk/Volume UUID) and the corresponding passphrase of
                               the "Disk User", provided the "Disk User" already exists.
    
                               Alternatively, if no users exist yet on this APFS Volume, you can still supply disk (or the
                               Disk/Volume UUID), and a "Disk User" will be created with a new passphrase which you supply.  This
                               is the only way using diskutil in which an APFS Volume that has no cryptographics users on it yet
                               can acquire the first such user.
    
                               The passphrase, interactive or not, is specified in the same manner as diskutil apfs addVolume.
    
                               Ownership of the affected disks is required.
    
                    decryptVolume | decrypt | disableFileVault volumeDevice [-user disk | existingCryptoUserUUID |
                               -recoverykeychain file][-passphrase existingPassphrase | -stdinpassphrase]
                               Start decryption of a currently-encrypted APFS Volume ("Disable FileVault").  Depending on
                               hardware, the operation may be accomplished immediately, or it may proceed "in the background".
    
                               The APFS Volume must be in an unlocked state before invoking this operation. Additionally, this
                               operation itself requires that you authenticate.
    
                               Any existing cryptographic user and its passphrase on the APFS Volume can be supplied, using -user
                               with either a UUID or the word disk to specify the "Disk User". If a "Disk User" exists on the APFS
                               Volume and you omit the -user parameter, then the "Disk User" is assumed.
    
                               As an alternative to a passphrase, you can specify -recoverykeychain with a full path, in the same
                               fashion as the unlockVolume verb.
    
                               If you do not supply a passphrase, yet one is required, you will be prompted interactively by
                               cryptographic user UUID.
    
                               Ownership of the affected disks is required.
    
                    listSnapshots | listVolumeSnapshots [-plist]volumeDevice | volumeSnapshotDevice
                               Show all APFS Snapshots currently associated with the given APFS Volume, each with information such
                               as its Snapshot UUID, Snapshot Name, numeric XID identifier, and possibly other fields.  If
                               applicable, the unique APFS Snapshot which might be limiting APFS Container resizing is identified.
    
                               If you are rooted (booted) from an APFS Snapshot, you can specify the appropriate 3-part BSD
                               identifier (e.g. "disk1s2s1").
    
                               If -plist is specified, then a property list will be emitted instead of the normal user-readable
                               output.
    
                    deleteSnapshot volumeDevice -uuid snapshotUUID | -xid xid | -name snapshotName
                               Remove the given APFS Snapshot from its APFS Volume.  The ability to restore the state of the APFS
                               Volume back to that point in its evolution will be lost.
    
                               Ownership of the affected disks is required.
    
                    list[Volume]Groups [-plist][containerReferenceDevice]
                               Display the relationships among APFS Volumes which are defined by APFS Volume Groups.  For each
                               currently-attached APFS Container in the system, the Container's APFS Volume Groups are shown; for
                               each APFS Volume Group, the Group's membership list of APFS Volumes is shown.
    
                               If -plist is specified, then a property list will be emitted instead of the normal user-readable
                               output.
    
                    defragment containerDevice | volumeDevice status | enable | disable
                               Manage automatic background defragmentation of user file data at the APFS Container or Volume
                               level.  Enablement of defragmentation at the APFS Container level means that any future Volumes
                               which are created out of that Container will have defragmentation enabled by default.
    
                               Ownership of the affected disks is required.
    
                    updatePreboot volumeDevice [-od openDirectoryPath]
                               Examine the given APFS Volume's cryptographic user (unlock) records, correlating against matching
                               macOS user metadata (e.g. avatar pictures, password hints, etc) and use this information to update
                               the target volume's associated Preboot Volume. The Preboot Volume is used at EFI firmware time to
                               present a login user interface and to load and boot macOS.
    
                               MacOS user metadata is sourced from macOS and Open Directory (OD) database files that are searched
                               for on the given volumeDevice, which is normally expected to be a macOS installation.
    
                               You can use a different Open Directory database by supplying the -od option with a full path, e.g.
                               "/Volumes/SomeOtherMacOSVolume/var/db/dslocal/nodes/Default", or with / to use the currently-
                               running macOS (even if volumeDevice is not). Redirecting the database source can lead to loss of
                               access; it must never be done unless you have a precise reason.
    
                               If some user cannot log in or login metadata is out of date, diskutil apfs updatePreboot / can be
                               used as a repair.
    
                               You should normally never have to use this verb; the Preboot Volume is updated automatically when
                               you use Users & Groups in System Preferences.
    
                               Ownership of the affected disks is required.
    
                    syncPatchUsers volumeDevice
                               Perform a specific, rarely-needed repair of APFS cryptographic user lock records.  If the target
                               volume is part of an APFS Volume Group, all APFS cryptographic user record lock data is copied from
                               the System-role volume, if any, to the Data-role volume, if any.
    
                               You must never use this command unless you know precisely why you are doing so.
    
                               Ownership of the affected disks is required.
    
         appleRAID | ar raidVerb [...]
                    AppleRAID verbs can be used to create, manipulate and destroy AppleRAID volumes (Software RAID).  AppleRAID
                    supports three basic types of RAID sets:
    
                          o   "stripe" - Striped Volume (RAID 0)
    
                          o   "mirror" - Mirrored Volume (RAID 1)
    
                          o   "concat" - Concatenated Volume (Spanning)
    
                    Of these three basic types, only the "mirror" type increases fault-tolerance.  Mirrors may have more than two
                    disks to further increase their fault-tolerance.  Striped and concatentated volumes are, in fact, more
                    vulnerable to faults than single disk volumes.
    
                    From these basic types, "stacked" or "nested" RAID volumes can be created.  Stacked RAID sets that make use of
                    mirrored RAID sets are fault-tolerant.  For example, these are some of the more common combinations of stacked
                    RAID sets:
    
                          o   RAID 50 - A striped RAID set of hardware RAID 5 disks.
    
                          o   RAID 10 - A striped RAID set of mirrored RAID sets.
    
                          o   RAID 0+1 - A mirrored RAID set of striped RAID sets.
    
                          o   Concatenated Mirror - A concatenation of mirrored RAID sets.
    
                    When creating new RAID sets or adding disks, if possible, it is better to specify the entire disk instead of a
                    partition on that disk.  This allows the software to reformat the entire disk using the most current partition
                    layouts.  When using whole disks, the type of partitioning used is selected based on the platform type (PPC =
                    APMFormat, Intel = GPTFormat).  GPT and APM partition formats cannot be mixed in the same RAID set.
    
                    In addition to whole disk and partition device names, AppleRAID uses UUIDs to refer to existing RAID sets and
                    their members.  Existing RAID sets may also be specified by mount point (e.g.  /Volume/raidset). In many
                    cases, using the UUID for the device argument is preferred because disk device names may change over time when
                    disks are added, disks are removed or when the system is rebooted.  If RAID members have been physically
                    disconnected from the system or are no longer responding, you must use the member's UUID as the command
                    argument.  Messages in the system log will refer to RAID sets and their member disks by UUID.  For more
                    information on specifying device arguments, see the DEVICES section below.
    
                    AppleRAID is not a replacement for backing up your data.  Backups should be always be performed on a regular
                    basis and before modifying any RAID set using these commands.
    
                    The following is a list of appleRAID sub-verbs with their descriptions and individual arguments.
    
                    list [-plist | UUID]
                               Display AppleRAID volumes with current status and associated member disks.  If UUID is specified,
                               only list the RAID set with that AppleRAID Set UUID.  If -plist is specified, then a property list
                               will be emitted instead of user-formatted output.  The -plist and UUID arguments may not both be
                               specified.  diskutil listRAID and diskutil checkRAID are deprecated synonyms for diskutil appleRAID
                               list.
    
                    create mirror | stripe | concat setName format devices ...
                               Create a new RAID set consisting of multiple disks and/or RAID sets.  setName is used for both the
                               name of the created RAID volume and the RAID set itself (as displayed in list). e.g. 'diskutil
                               createRAID stripe MyArray JHFS+ disk1 disk2 disk3 disk4'.  Ownership of the affected disks is
                               required.  diskutil createRAID is a deprecated synonym for diskutil appleRAID create.
    
                    delete raidVolume
                               Destroy an existing RAID set.  If the RAID set is a mirror with a resizable file system, delete
                               will attempt to convert each of the member partitions back into a non-RAID volume while retaining
                               the contained file system.  For concatenated RAID sets with a resizable file system, delete will
                               attempt to shrink the file system to fit on the first member partition and convert that to a non-
                               RAID volume.  Ownership of the affected disks is required.  diskutil destroyRAID is a deprecated
                               synonym for diskutil appleRAID delete.
    
                    repairMirror raidVolume newDevice
                               Repair a degraded mirror by adding a "new" disk given as newDevice to the RAID mirror set whose
                               exported disk device or set UUID is given as raidVolume. The new disk must be the same size or
                               larger than the existing disks in the RAID set.  After running this command, you should manually
                               remove the old (orphaned, failed) member(s) with diskutil appleRAID remove. Ownership of the
                               affected disk is required.  diskutil repairMirror is a deprecated synonym for diskutil appleRAID
                               repairMirror.
    
                    add type newDevice raidVolume
                               Add a new member or hot spare to an existing RAID set.  Type can be either member or spare.  New
                               disks are added live, the RAID volume does not need to be unmounted.  Mirrored volumes support
                               adding both members and hot spares, concatenated volumes only support adding members.  When adding
                               to a mirrored RAID set, the new disk must be the same size or larger than the existing disks in the
                               RAID set.  Adding a hot spare to a mirror will enable autorebuilding for that mirror.  Adding a new
                               member to a concatenated RAID set appends the member and expands the RAID volume.  Ownership of the
                               affected disk is required.  diskutil addToRAID is a deprecated synonym for diskutil appleRAID add.
    
                    remove oldDevice raidVolume
                               Remove a member or spare from an existing RAID set.  Old disks are removed live; the RAID volume
                               does not need to be unmounted.  For missing devices, oldDevice must be the device's UUID.  Online
                               mirror members with a resizable file system will be converted to non-RAID volumes, spare and
                               offline members will be marked free.  For concatenated RAID sets, only the last member can be
                               removed.  For resizable file systems remove will first attempt to shrink the concatenated RAID set
                               so that the file system fits on the remaining disks.  Ownership of the affected disk is required.
                               diskutil removeFromRAID is a deprecated synonym for diskutil appleRAID remove.
    
                    enable mirror | concat device
                               Convert a non-RAID disk partition containing a resizable file system (such as JHFS+) into an
                               unpaired mirror or single disk concatenated RAID set.  Disks that were originally partitioned on
                               Mac OS X 10.2 Jaguar or earlier or were partitioned to be Mac OS 9 compatible may not be resizable.
                               Ownership of the affected disk is required.  diskutil enableRAID is a deprecated synonym for
                               diskutil appleRAID enable.
    
                    update key value raidVolume
                               Update the key value parameters of an existing RAID set.  Valid keys are:
    
                                     o   AutoRebuild - If true, the system attempts to rebuild degraded mirrored volumes
                                         automatically.  When looking for devices for rebuild, AppleRAID first looks for hot
                                         spares and then degraded members.  Use a value of "1" for true and "0" for false.
    
                                     o   SetTimeout - Controls how long the system waits (in seconds) for a missing device before
                                         degrading a mirrored raid set.  Also controls the amount of time you have to disconnect
                                         all devices from an unmounted mirror without degrading it.
    
                               Ownership of the affected disk is required.  diskutil updateRAID is a deprecated synonym for
                               diskutil appleRAID update.
    
         coreStorage | cs coreStorageVerb [...]
                    CoreStorage verbs can be used to gather information about, and to remove, CoreStorage volumes.
    
                    CoreStorage maintains a world of virtual disks, somewhat like RAID, in which one can easily add or remove
                    imported backing store disks, as well as exported usable volumes, to or from a pool (or several pools). This
                    provides the user with flexibility in allocating their hardware; user or operating system data can span
                    multiple physical disks seamlessly, for example.
    
                    CoreStorage is deprecated in favor of Apple APFS.
    
                    Apple CoreStorage defines four types of objects, instances of which are uniquely represented by a UUID:
    
                          o   Logical Volume Group (LVG)
    
                          o   Physical Volume (PV)
    
                          o   Logical Volume Family (LVF)
    
                          o   Logical Volume (LV)
    
                    The Logical Volume Group (LVG) is the top or "pool" level; zero or more may exist during any OS boot time
                    session.
    
                    An LVG imports one or more Physical Volumes (PVs). A PV represents a device that feeds the LVG storage space;
                    a PV is normally real media but it can be a disk image or even an AppleRAID Set. A disk offered to be a PV
                    must be a partition and the encompassing scheme must be GPT.
    
                    An LVG exports zero or more Logical Volume Families (LVFs). An LVF contains properties which govern and bind
                    together all of its descendant Logical Volumes (LVs). These properties provide settings for Full Disk
                    Encryption (FDE) (such as whether the LVs are encrypted, which users have access, etc) and other services.
                    However, at the present time, for the creation of any new LVFs, only zero or one LVF per LVG is supported.
    
                    A Logical Volume Family (LVF) exports one or more Logical Volumes (LVs).  However, only and exactly one LV per
                    LVF is supported.
    
                    A Logical Volume (LV) exports a dev node, upon which a file system (such as Journaled HFS+) resides.
    
                    For more information on specifying device arguments, see the DEVICES section below.
    
                    The following is a list of coreStorage sub-verbs with their descriptions and individual arguments.
    
                    list [-plist | UUID]
                               Display a tree view of the CoreStorage world for all current logical volume groups (LVGs) with
                               member disks (PVs) and exported volumes (LVFs and LVs), with properties and status for each level.
                               If -plist is specified then a property list will be emitted instead of the formatted tree output;
                               the UUIDs can be used with the diskutil coreStorage information verb to get properties for the
                               object represented by that UUID.  If UUID is specified then an attempt is made to list only that
                               UUID (whatever type of CoreStorage object it may represent).  The -plist and UUID arguments may not
                               both be specified.
    
                    info | information [-plist]UUID | device
                               Display properties of the CoreStorage object (LVG, PV, LVF, or LV) associated with the given
                               CoreStorage UUID or disk.
    
                    delete | deleteLVG lvgUUID | lvgName
                               Delete a CoreStorage logical volume group. All logical volume families with their logical volumes
                               are removed, the logical volume group is destroyed, and the now-orphaned physical volumes are
                               erased and partition-typed as Journaled HFS+.
    
                    unlockVolume | unlockLV [-nomount]lvUUID [-stdinpassphrase]| [-passphrase passphrase]| [-recoverykeychain
                               file]
                               Unlock a logical volume and file system, causing it to be attached and mounted.  Data is then
                               accessible in plain form to the file system and applications, while the on-physical-disk backing
                               bytes remain in encrypted form.  A credential must be supplied; you must supply either a "Disk"
                               user passphrase or a recovery keychain file.
    
                               If no -passphrase option is specified, you will be prompted interactively; else, your passphrase is
                               used. Or, if you specify -stdinpassphrase then the standard input is read (e.g. so that the
                               passphrase can be securely piped in without having to expose it).
    
                               Alternatively, you can specify -recoverykeychain with a path to a keychain file.  The keychain must
                               be unlocked; see security(1) for more information.
    
                               The locked state means that the CoreStorage driver has not been given authentication information (a
                               passphrase) to interpret the encrypted bytes on disk and thus export a dev node.  This verb unlocks
                               a logical volume family (LVF) and its logical volumes (LVs) by providing that authentication; as
                               the LVs thus appear as dev nodes, any file systems upon them are automatically mounted unless the
                               -nomount option is given.
    
                               To re-lock the volume, make it offline again by ejecting it, e.g. with diskutil eject.
    
    DEVICES
         A device parameter for any of the above commands (except where explicitly required otherwise) can usually be any of the
         following:
    
               o   The disk identifier (see below).  Any entry of the form of disk*, e.g.  disk1s9.
    
               o   The device node entry containing the disk identifier.  Any entry of the form of /dev/[r]disk*, e.g.
                   /dev/disk2.
    
               o   The volume mount point.  Any entry of the form of /Volumes/*, e.g.  /Volumes/Untitled.  In most cases, a
                   "custom" mount point e.g.  /your/custom/mountpoint/here is also accepted.
    
               o   The URL form of any of the volume mount point forms described above.  E.g.  file:///Volumes/Untitled or
                   file:///.
    
               o   A UUID.  Any entry of the form of e.g.  11111111-2222-3333-4444-555555555555.  The UUID can be a "media" UUID
                   which IOKit places in an IOMedia node as derived from e.g. a GPT map's partition UUID, or it can be an
                   AppleRAID (or CoreStorage) set (LV) or member (PV) UUID.
    
               o   A volume name, e.g.  Untitled.  This match is only attempted if the given device is not of the form
                   [/dev/][r]disk*, nor [/Volumes/]*.  The match attempt is against the intrinsic volume label, not against the
                   terminal component, if mounted, of its mount point.
    
    DISK IDENTIFIER
         The (BSD) disk identifier string variously identifies a physical or logical device unit, a session (if any) upon that
         device, a partition (slice) upon that session (if any), a virtual logical volume, or a moment in a volume's evolution.
         It may take the form of diskU, diskUsP, diskUsQ, diskUsQsP, diskC, diskCsV, or diskCsVsS where C, P, Q, S, U, and V are
         positive decimal integers (possibly multi-digit), and where:
    
               o   U is the device unit.  It may refer to hardware (e.g. a hard drive, optical drive, or memory card) or a virtual
                   "drive" constructed by software (e.g. an AppleRAID Set, Apple Disk Image, CoreStorage LV, etc).
    
               o   C is an APFS Container.  This is a virtual disk constructed by APFS to represent a collection of APFS Volumes.
                   Multiple APFS Containers can be active simultaneously.
    
               o   Q is the session and is only included for optical media; it refers to the number of times recording has taken
                   place on the currently-inserted medium (disc).
    
               o   P is a partition in some partitioning scheme. A partitioning scheme divides up a device unit and is also called
                   a "partition map" or simply a "map".  Upon a partition, the raw data that underlies a user-visible file system
                   is usually present, but it may also contain specialized data for certain 3rd-party database programs, or data
                   required for the system software (e.g. EFI partitions, booter partitions, APM partition map data, etc), or,
                   notably, it might contain backing-store physical volumes for AppleRAID, CoreStorage, APFS, or other (3rd-party)
                   Storage Systems.  For example, a partition disk0s2 might contain APFS data and have a partition type of
                   Apple_APFS; this partition would then be termed an APFS Physical Store, out of which an APFS Container disk1 is
                   defined, out of which an APFS Volume disk1s1 is exported.
    
               o   V is an APFS Volume; it refers to a virtual logical volume that is shared out of an APFS Container.  For
                   example, exported from an APFS Container designated as disk1 there might be an APFS Volume disk1s1, mountable
                   as a file system and usable for file storage via its mountpoint path.
    
               o   S is an APFS Snapshot; it refers to a frozen moment in time of the state of files on an APFS Volume.  For
                   example, if APFS Container disk6 has an APFS Volume disk6s3, and two APFS Snapshots have been "taken" on it,
                   these, when mounted, might be designated as disk6s3s1 and disk6s3s2. Zero or more snapshots can be persistently
                   defined on a volume, but only "active" (mounted) snapshots have disk identifiers.
    
         Some units (e.g. floppy disks, RAID sets) contain file system data upon their "whole" device instead of containing a
         partitioning scheme with partitions.
    
         Note that some of the forms appear the same and must be distinguished by context.  For example, diskUsQ, diskUsS, and
         diskCsV are all 2-part forms that can mean different things: For non-optical media, it identifies a partition (on a
         partition map) upon which (file system) data is stored; for optical media, it identifies a session upon which an entire
         partition map (with its partitions with file systems) is stored; for an APFS setup, it identifies an APFS Volume. As
         another example, in "stacked" cases (CoreStorage on AppleRAID or APFS on AppleRAID), the 1-part diskU form becomes a
         CoreStorage PV or APFS PhysicalStore, in contrast with the more-common 2-part form.
    
         It is important for software to avoid relying on numerical ordering of any of the parts.  Activities including but not
         limited to partition deletions and insertions, partition resizing, virtual volume deletions and additions, device ejects
         and attachments due to media insertion cycles, plug cycles, authentication lock cycles or reboots, can all cause
         (temporary) gaps and non-increments in the numerical ordering of any of the parts. You must rely on more persistent means
         of identification, such as the various UUIDs.
    
    SIZES
         Size is output in a base-ten Scripts should -plist 
    
         Wherever a size is to be input, 
         An integer without a suffix is an number of bytes (e.g. 5368709120).  
         May be a real number (e.g. 5.1234t).  
    
         Power-of-ten suffixes: B bytes (not blocks) K[B] M[B] G[B] T[B]
         Power-of-two suffixes:                      Ki[B]Mi[B]Gi[B]Ti[B]
    
         The following are useful when working with devices and partition maps: 
               o   S | UAM ("sectors") is 512-byte units (device-independent) where the multiplier is always 512.  
               o   DBS ("device block size") is the device-dependent native block size of the encompassing whole disk, if
                   applicable, where the multiplier is often 512, but not always; indeed it might not be a power of two.
    
         In certain contexts (e.g. "use all space available", or when building partition triplets) provide a relative value 
    
               o   0 (the number zero) is a request to allocate "all possible". This may mean different things in different
                   contexts.  For partition maps, this requests allocation until the start of the following partition or the end
                   of the partition map's allocatable space.
    
               o   % (with a preceding number) is a percentage of the whole-disk size, the partition map size, or other
                   allocatable size, as appropriate by context.  not supported in all situations.
    
               o   R (with no preceding number) specifies the remainder of the whole-disk size or other allocatable size after all
                   other triplets in the group are taken into account.  It need not be in the last triplet.  
                    only appear in one triplet . not supported in all situations; 
    
         You can provide an operating system-defined constant value as follows:
    
               o   %recovery% (with no preceding number) is the customary size of pre-macOS-13.0 Recovery Partitions.
    
         Note again that B refers to bytes and S and UAM refer to a constant multiplier of 512; the latter are useful when working
         with tools such as gpt (8) or df (1).  Note also that this multiplier is not a "block" size as actually implemented by
         the underlying device driver and/or hardware, nor is it an "allocation block", which is a file system's minimum unit of
         backing store usage, often formatting-option-dependent.
    
         Examples: 10G (10 gigabytes), 4.23tb (4.23 terabytes), 5M (5 megabytes), 4GiB (exactly 2^32 bytes), 126000 (exactly
         126000 bytes), 25.4% (25.4 percent of whole disk size).
    
    FORMAT
         The format parameter for the erasing and partitioning verbs is the file system personality name.  You can determine this
         name by looking in a file system bundle's /System/Library/Filesystems/.fs/Contents/Info.plist and looking at the keys
         for the FSPersonalities dictionary, or by using the listFilesystems verb, which also lists shortcut aliases for common
         personalities (these shortcuts are defined by diskutil for use with it only).
    
         Common examples include JHFS+, JHFSX, MS-DOS, etc, as nicknames for the canonical forms from the file system bundles such
         as "Case-sensitive HFS+".
    
    EXAMPLES
         Erase a whole disk (device): diskutil eraseDisk JHFS+ Untitled disk3
    
         Erase a volume (or format a partition or virtual disk): diskutil eraseVolume jhfs+ UntitledHFS /Volumes/SomeDisk
    
         Erase and (re)-partition a disk (device) with three partitions:
                             diskutil partitionDisk disk3 HFSX Foo1 10G JHFS+ Foo2 10G MS-DOS FOO3 0
    
         Erase and format with a different volume file system diskutil eraseVolume ExFAT FOO disk3s2
    
         Remove a partition from a partition map (results in free space) diskutil eraseVolume free free disk3s2
    
         Add a new partition to a partition map (into free space)
         diskutil addPartition disk3s2 ExFat FOO 0
         diskutil addPartition disk3s2 %Apple_HFS% %noformat% 2.5g
         diskutil addPartition disk3 ExFat FOO 50%
    
         Convert a HFS disk to APFS
         diskutil apfs convert disk3s2
    
         Create a new APFS Container with three new APFS Volumes
         diskutil apfs createContainer disk0s2
         diskutil apfs addVolume disk8 APFS MyVolume1
         diskutil apfs addVolume disk8 APFS MyVolume2 -passprompt
         diskutil apfs addVolume disk8 APFS MyVolume3 -quota 10g
         diskutil apfs list
    
         Lock or unlock an APFS Volume
         diskutil apfs list disk8
         diskutil apfs lockVolume disk8s1
         diskutil apfs unlockVolume disk8s1 (tries all users)
         diskutil apfs unlockVolume disk8s2 -user USERUUID (tries specific user)
    
    
         Remove an APFS Volume from its APFS Container: diskutil apfs deleteVolume disk8s3
    
         Resize an HFS volume and create a volume after it: diskutil resizeVolume /Volumes/SomeDisk 50g MS-DOS DOS 0 
    
         Resize an HFS volume and leave all remaining space as unused:  diskutil resizeVolume /Volumes/SomeDisk 12g
    
         Merge two partitions into a new partition: diskutil mergePartitions JHFS+ not disk1s3 disk1s5
    
         Split a partition into three: diskutil splitPartition /Volumes/SomeDisk JHFS+ vol1 12g MS-DOS VOL2 8g JHFS+ vol3 0
    
    
         Erase a partition, shrink, associate a pre-macOS-13.0 Recovery Partition
         diskutil splitPartition disk8s2 JHFS+ MacHD R %Apple_Boot% %noformat% %recovery%
    
         Partition with the MBR partitioning scheme (e.g. for a camera): diskutil partitionDisk disk3 MBR MS-DOS CAM1 0
    
    
    ERRORS
         0 if successful
         1 includes error string from the DiskManagement or MediaKit frameworks, an underlying POSIX error
    
    sudo diskutil unmount /Volumes/dgerman23
    Volume dgerman23 on disk2s1 failed to unmount: dissented by PID 17597 (/bin/bash)
    Dissenter parent PPID 17596 (/usr/bin/login)
    
    

    SEE ALSO

    authopen(1), drutil(1), hdiutil(1), apfs.util(8), corestoraged(8), diskarbitrationd(8), diskmanagementd(8), diskmanagementstartup(8), fdesetup(8), fsck_apfs(8), fsck_hfs(8), hfs.util(8), ioreg(8), mount(8), mount_apfs(8), msdos.util(8), newfs_apfs(8), newfs_hfs(8), ufs.util(8), umount(8), vsdbutil(8)

    Input and output notation of disk and partition sizes use power-of-10 suffixes. B suffix is optional even for "bare" numeric values.

    Plist output of partitions from diskutil list -plist is presented in on-disk This mimics the order of outputs from programs such as gpt (1). The human-readable is in on-disk order.

    APFS cryptographic user authentication is required even when disabling FileVault.

    partitions on all media above 1GiB in size will default to 1MiB alignment, regardless of the This is significant for MBR partition maps and their use in appliances such as cameras. Free-space requests will not be aligned.

    Certain Core Storage manipulation verbs have been removed. macOS 11 January 2021 macOS