Mac – Time Machine offers to erase disk data (format), will it delete all the partitions

disk-utilityhard drivehfs+partitiontime-machine

So, I'm trying to perform my Macbook backup on my 3TB drive. This drive is currently has a GPT table with 4 partitions:

  1. BackupMain
  2. BackupKubuntu
  3. BackupWindows
  4. BackupMac

Before BackupMain, there are 3 free MiB, before BackupMac there are free 256 MiB and after BackupMac there are other free 256 MiB (I read around 128 MB were required after partitions, so for safety I wasted 512 MiB! 😛 )

BackupMain is NTFS, BackupKubuntu is EXT4, BackupWindows is NTFS, BackupMac is ExFAT, I thought it was usable but looks like I need to format to hfs.

Now, Disk Utility from OSX gets stuck (probably due to the Ext4 partition which it's not detected correctly). I need to replace BackupMac with a proper partition that can be used for Time Machine.

  1. What command line should I use? I currently found Create new partition in unallocated space with diskutil but it's a bit complicated because it's not my specific usecase (and doesn't say how to delete a partition first)
  2. If I use Time Machine to "Erase Disk", will it actually erase it or only the specified partition? Because the dropdown menu asks me to choose a partition, but then says "delete disk"
  3. Time Machine uses the same stuff as Disk Utility? Not interested in getting stuck, I prefer command line tools if that's the case

enter image description here
enter image description here

Best Answer

Look at Erase a volume under EXAMPLES in the diskutil man page.

diskutil eraseVolume HFS+ UntitledHFS /Volumes/SomeDisk

In this case the command line you'll probably want to use is:

diskutil eraseVolume HFS+ BackupMac /Volumes/BackupMac

However check that the command line is formatted as needed before executing it.

I tested this on a 2 volume disk and it only touched the 1 targeted volume leaving the other intact and the target reformatted HFS+, which is what you want for the Time Machine backup.

Note: It may need to unmount all volumes on the disk so make sure nothing is open on the other volumes before hand. While it may unmount the other volumes not to worry as it will only erase and reformat the target volume and remount upon completion.