format/Erase Equivalence Disk Utility and Terminal Command diskutil

What is the diskutil equivalence from Disk Utility of

  • Format/Erase with Format MS-DOS(FAT) and Scheme GUID Partition Map.

  • Format/Erase with Format MS-DOS(FAT) and Scheme Master Boot Record.

In other words how do format/erase a disk with Console/Terminal?


The equivalent commands are given below.

diskutil eraseDisk MS-DOS GPT diskX
diskutil eraseDisk MS-DOS MBR diskX

Where diskX is the identifier for the drive. The value of X needs to be replaced with a integer of 0 or higher. The command diskutil list will list all the current disk identifiers. The command diskutil listfilesystems will list the available formats.