How to prepare a brand new hard drive for use with macOS
I bought a brand new external hard drive (disk) Transcend StoreJet 25M3 1Tb. A Transcend company says that it can be used on both Windows and macOS. But most drives (from any manufacturer) come formatted in the NTFS file system format for OS Windows, while for macOS we needed the HFS+ format or the Apple’s brand new APFS (Apple File System) format. macOS can read but not write to NTFS formatted drives. So the only workaround is to format the disc to HFS+ or APFS.
The easiest way to format the disc is by using macOS built-in Disk Utility app, but problems are very possible. For many people a hard drive becomes unusable after using the Disk Utility app. You can read more about the issue in this article. Therefore, to avoid problems, I prefer a very old and proven method. We will use the Terminal app and two tools diskutil
and dd
. Both tools are built-in in macOS, so we do not need to download or install anything. Let’s get started.
Critical! The instructions in the article below are designed to help repartition and format a hard drive. This process is data destructive and cannot be undone. Once the process begins, all the data on the drive will be lost!
Be careful working with disks in the terminal. Incorrect actions can lead to data loss and even computer failure.
Launch the Terminal app from the Utilities folder of your Applications folder, or use Spotlight to find it.
Firstly we need to identify the mount name of our disk (hard drive):
diskutil list
/dev/disk0 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *121.3 GB disk0 1: EFI EFI 209.7 MB disk0s1 2: Apple_APFS Container disk1 121.1 GB disk0s2 /dev/disk1 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +121.1 GB disk1 Physical Store disk0s2 1: APFS Volume Macintosh HD 105.5 GB disk1s1 2: APFS Volume Preboot 21.0 MB disk1s2 3: APFS Volume Recovery 509.9 MB disk1s3 4: APFS Volume VM 3.2 GB disk1s4 /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *1.0 TB disk2 1: Apple_HFS Transcend 1.0 TB disk2s1
There are two types of devices (methods to communicate with devices):
- raw devices
/dev/rdisk*
, communication is direct with the disk.- buffered devices
/dev/disk*
, data transit via buffer.When using
dd
or other duplication programs, always use raw device.
The below commands assume this is disk2
, but replace disk2
with the correct disk if it’s something different.
Before any operations on the disk we must unmount it:
diskutil unmountDisk force disk2
Forced unmount of all volumes on disk2 was successful
Warning! Do not forget to replace the
disk2
before pressing the key Enter.
Now we will write zeros to the disk (this will erase the entire disk):
sudo dd if=/dev/zero of=/dev/rdisk2 bs=1024 count=1024
Warning! Do not forget to replace the
rdisk2
before pressing the key Enter.
This command will prompt us to enter our computer password. Enter your password and then watch the magic happen…
Note! It’s normal that the password you enter is not displayed. This is how the password is entered on the command line. Just enter your password, and then press the Enter key.
Password: 1024+0 records in 1024+0 records out 1048576 bytes transferred in 2.448794 secs (428201 bytes/sec)
Let’s now partition the disk. This will be the GUID Partition Table (GPT) and the Journaled HFS+ format of file systeme:
diskutil partitionDisk disk2 GPT JHFS+ "Transcend" 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 Transcend Initialized /dev/rdisk2s2 as a 931 GB case-insensitive HFS Plus volume with a 81920k journal Mounting disk Finished partitioning on disk2 /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *1.0 TB disk2 1: EFI EFI 209.7 MB disk2s1 2: Apple_HFS Transcend 999.9 GB disk2s2
Note! Replace “Transcend” with the name that you want to give to your hard drive.
Note! To get Master Boot Record (MBR) instead of GUID Partition Table (GPT), simply replace the “GPT” mention to “MBR”. That should work.
Warning! Do not forget to replace the
disk2
before pressing the key Enter.
Conclusion
That’s it, you’re done. Our brand new hard drive is ready for use with macOS. So simple isn’t it?
We can leave our hard drive in the HFS+ format or convert it from HFS+ to the Apple’s brand new APFS (Apple File System) format using the Disk Utility app. You can read more in this article.
If this article has helped you then please leave a comment
Thanks for reading!
Arthur is a designer and full stack software engineer. He is the founder of Space X-Chimp and the blog My Cyber Universe. His personal website can be found at arthurgareginyan.com.