Format USB Drive Mac using Terminal. We also have a Command Line Disk Utility interface in Mac. And we can use it to format the USB on Mac as well. Now lets see how we do this. First open the terminal (Again press command + space, write terminal and hit enter). In terminal now type the following command. For those of you looking to format an entire disk and remove all partitions here is the command: diskutil eraseDisk free itsfree /dev/disk6 Even though I am formatting with free space- I still had to give it a name for the command to work, in this case itsfree. To list your disks. Diskutil list To securely erase - Needs to have a mounted volume.
Most users use Disk Utility to erase a disk or hard drive. But some Mac users might need to erase them from the command line on Mac OS. To do that, the only thing you need is a bit of precise syntax to make sure that you are erasing the proper disk.
Here I'll show you how you can erase and format a disk using the command line.
Working with Terminal
Start off by running the following command in the command line: Diskutil list
This is going to list all the mounted drives on your Mac.
Once you have found the proper drive to erase, just copy its identifier so you can use it for the next command. Then pick a name and a system format type. This is the syntax we need: Diskutil eraseDisk FILESYSTEM DISKNAME DISKIDENTIFIER
Let’s say the disk I want to erase has “/dev/disk5s2” as its identifier and I’m going to use Mac OS Extended Journaled (JHFS+) as the system format type and name it “Empty”. The syntax is going to look like this: Diskutil eraseDisk JHFS+ Empty /dev/disk5s2
It’s important to keep in mind that if you run the eraseDisk command, the target disk is going to lose all its data, so make sure you are erasing the proper disk.
If you need different system format types, here are a few references you could use instead of JHFS+:
- Mac OS Extended: HFS+
- MS-DOS fat32: FAT32
- ExFAT: ExFAT
All external USB disks can be formatted to work on Mac OSX, but not always straight out of the box.
How To Format Hard Drive For Mac
In this tutorial we look at formatting disks via the GUI app called Disk Utility and its equivalent command line tool diskutil. This will work in all modern versions of Apple Mac OSX including 10.9 Mavericks, 10.8, 10.7 and 10.6.
Initially external disks may be formatted for Windows and after you connect it to your Mac it appears in the device list in the Finder, but is a read only disk meaning that you can’t write to it in its current format.
The when the disk is selected in the finder bottom left symbol with the crossed out pencil means that the disk can only be read not written to. Why this is, is because they come formatted as Windows NTFS drive which OSX can only read, so we need to reformat them so we can read and write – thats where a handy utility called Disk Utility comes to the rescue.
Disk Utility
Disk Utility is found in /Applications/Utilities/Disk Utility.app, open it and select your external disk in the list on the left.
There are 2 items (or more) for each disk, you have the actual disk and the volume of the disk, the example below has the Disk Named 2 TB WD Elements and the Volume is named Elements, this example uses the Volume which will in turn also format the Disk.
Then below you will see the Format type which will be NTFS or possibly MS-DOS (FAT), we need to reformat the volume and make the format Mac OS Extended (Journaled).
Reformatting the Disk
Still with the external disk selected in Disk Utility go to the Erase tab, select Mac OS Extended (Journaled) from the format dropdown, choose to name the disk and then click Erase.
And there you have it one read and writable disk ready for OSX.
The Security Options option next to erase can control how the disk is erased by zeroing out all the blocks on the disk, this then make it impossible to salvage any previous data, with new disks this is not necessary.
Also the other format option Mac OS Extended (Case-sensitive, Journaled) in the dropdown would allow you have same name files or folders in the same location with a mix of case like ‘red’ and ‘RED’, this is popular in the Linux disk format and also possible on OSX but not the default on OSX shipped disks.
Doing it on the line
You can also do this using the command line using the tool diskutil which is the command line interface to Disk Utility, launch Terminal, Applications/Utilities/Terminal – to see a list of your disks:
and the results are similar to:
Format Flash Drive Mac Command Line
This gives us a lot of information including the disk identifiers, size of disk and partitioning scheme. So in this example we will reformat the actual disk, disk2 using the command:
Format Thumb Drive Mac Command Line Windows 10
Here the command diskutil eraseDisk does the erasing, format is expressed as JHFS+ which is the Mac OS Extended (Journaled) and disk is named BackupMaster and the actual target disk is defined by its identifier disk2. The Terminal will result in this output:
Format Thumb Drive Mac Os
And there you have it one formatted disk ready to go.