How do I format a partition with FAT32? [duplicate]

Enter diskutil list to get the disk identifier/partition. Then enter:

diskutil eraseVolume FAT32 DATA diskXsY #replace diskXsY by the proper disk identifier

DATA will be the name of the volume. The name has to be capitalized using diskutil ....


The diskutil eraseVolume ... command will change the pMBR of the GUID partition table to a hybrid MBR and probably renders an existing OS X system volume on the same drive unbootable.


The command is newfs_msdos.

Also for HFS+, the command is newfs_hfs.

Use man newfs_msdos or man newfs_hfs for more information.

Generally, you would use diskutil list to get the slice (identifier).

Next you use diskutil unmount identifier, followed by the format command.

Finally, use diskutil mount identifier.

For example.

diskutil list
diskutil unmount /dev/disk0s4
newfs_msdos -F 32 -v BOOTCAMP /dev/disk0s4
diskutil mount /dev/disk0s4

Note: Using diskutil to format a partition (slice) can have the side effect of altering the type of partitioning a drive is using.

For example, the command

diskutil eraseVolume fat32 BOOTCAMP /dev/disk0s4

can result in changing a GPT partitioned disk into a hybrid GPT/MBR partitioned disk.