Mac USB Harddrive formatting using command line tools
I recently bought a 3TB My Passport USB Hard Drive to use as storage for my cloud storage (OneDrive , Google Drive, iCloud). I tried setting up this device using disk utility in Mac but always ended with error
“Erase Process has failed. Press done to continue”
I just couldn’t get this done using the UI tool.
I used the following command line instructions and was able to get it done.
$ diskutil list /dev/disk0 (internal): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme 2.0 TB disk0 1: EFI EFI 314.6 MB disk0s1 2: Apple_CoreStorage Macintosh HD 2.0 TB disk0s2 3: Apple_Boot Recovery HD 650.0 MB disk0s3 /dev/disk1 (internal, virtual): #: TYPE NAME SIZE IDENTIFIER 0: Apple_HFS Macintosh HD +2.0 TB disk1 Logical Volume on disk0s2 3734F2DA-68E5-4A2C-A658-D0CC2E03F7BB Unlocked Encrypted /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *3.0 TB disk2 1: Windows_NTFS New Volume 2.2 TB disk2s1
Notice the column called Identifier. In my case the drive , I wanted to erase had Identifier disk2. It is important to make sure the identifier is correct
Next, unmount the disk
$ diskutil unmountDisk force disk2 Forced unmount of all volumes on disk2 was successful
Next, overwrite the MBR to be Zeros so that Mac OS creates new partition
$ sudo dd if=/dev/zero of=/dev/disk2 bs=1024 count=1024 Password: 1024+0 records in 1024+0 records out 1048576 bytes transferred in 0.647115 secs (1620386 bytes/sec)
Finally, Erase the volume creating new partitions
$ diskutil partitionDisk disk2 GPT JHFS+ "MyUSBDrive" 0g Started partitioning on disk2 Unmounting disk Creating the partition map Waiting for partitions to activate Formatting disk2s2 as Mac OS Extended (Journaled) with name MyUSBDrive Initialized /dev/rdisk2s2 as a 3 TB case-insensitive HFS Plus volume with a 229376k journal Mounting disk Finished partitioning on disk2 /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 MyUSBDrive 3.0 TB disk2s2
Voila and it’s done.
I hope it helps if anyone else encounters similar issue