Also at Deasil Works · txn2 · Plexara
Profiles GitHub · X · LinkedIn
Theme Light · Auto · Dark
Professional notes by Craig Johnston
long-form, short-form, working drafts · since 2008
VOL. XIX · MMXXVI
111 NOTES IN PRINT
FOLIO XIII 2018-05-12 · 3 MIN · SHORT-FORM

Formatting Drives on MacOS

A stack of old drives, a terminal and diskutil.

Diagram · folio xiii
sequenceDiagram
    autonumber
    actor U as User
    participant T as Terminal
    participant DU as diskutil
    participant K as Kernel

    U->>T: diskutil list
    T->>DU: query
    DU->>K: enumerate devices
    K-->>DU: disk0, disk2, ...
    DU-->>T: identifiers + sizes
    T-->>U: device list

    U->>T: diskutil eraseDisk JHFS+ Backup disk2
    T->>DU: eraseDisk
    DU->>K: unmount + format + remount
    K-->>DU: ok
    DU-->>T: Volume Backup created
    T-->>U: done

I have had this collection of old external drives hanging around for years. There was a time I was having terrible luck with hard drives. It turned out I managed to amass a collection of about eight drives from one terabyte to four terabytes.


§2026 Update

diskutil eraseDisk works the same on Apple Silicon and current macOS as it did here. The one thing worth updating is the format I picked. In 2018 I used JHFS+ (Mac OS Extended, Journaled), and that is still a fine choice for a spinning backup drive. But APFS is the default now. It is what macOS itself runs on, and it is built for the SSDs that ship in every Apple Silicon Mac. A quick guide for the format argument:

  • APFS: the modern default. Best for SSDs and drives that stay on the Mac. Time Machine prefers it on recent macOS.
  • JHFS+ (Mac OS Extended, Journaled): still works, good for spinning hard drives and older-macOS compatibility, and fine for Time Machine.
  • ExFAT: use this if the drive needs to move between Mac and Windows. Note that Time Machine will not back up to an ExFAT drive.

Run diskutil listFilesystems to see every personality you can pass to eraseDisk. So for an SSD I would now write diskutil eraseDisk APFS Backup /dev/disk2 instead of the JHFS+ command below.


Original article below. Everything from here down is the post as originally written. The 2026 Update above covers what’s changed since.

Fortunately, I keep copies of nearly all my files on cloud drives, split between Amazon, Google and DropBox. I had a sneaking suspicion that the discs themselves were ok and somehow my Mac was communicating with the RAID controllers in a way that caused them to fail.

This weekend I received a Cable Matters USB 3.0 SATA HDD/SSD Docking Station I ordered a few days ago. I removed all my drives from their old cases and plugged them directly into my new dock. Out of my eight drives, only two were unusable.

I did quick work of re-setting my stack of drives. I do my work on the command line when I can, and the MacOs command diskutil works great for this.

My Mac complained about most of the drives I plugged in, but diskutil was able to see them fine.

Run diskutil list for a listing of internal and external drives and their partitions.

$ diskutil list

/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         1.0 TB     disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         1.0 TB     disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +1.0 TB     disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            376.2 GB   disk1s1
   2:                APFS Volume Preboot                 21.7 MB    disk1s2
   3:                APFS Volume Recovery                517.8 MB   disk1s3
   4:                APFS Volume VM                      7.5 GB     disk1s4

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *3.0 TB     disk2
   1:                        EFI EFI                     314.6 MB   disk2s1
   2:                  Apple_HFS                         3.0 TB     disk2s2
   

Mounted on /dev/disk2 is a three terabyte Seagate that was part of a failed RAID. The data is corrupt, but the disk is in working order. It just needs a new format.

diskutil has a ton of options and OSX Daily has a great article and cheatsheet for some of the most common commands.

I used the following command to format my stack of drives and now have a ton of extra backup storage.

Mac OS Extended Journaled (JHFS+):

diskutil eraseDisk JHFS+ 3TBackup /dev/disk2

I’ll probably stick with just using bare hard drives and a dock from now on. Drives are pretty cheap these days, and if you don’t need to keep your drive in a backpack, then I can attest they sit nicely on my bookshelf neatly labeled on their sides.

← back to all notes