1

Suppose I have a full TimeMachine backup of a newly installed and configured Mac OS. No important data yet.

I want to test disaster recovery from the scenario of total physical loss. I don't want to destroy the Mac for real and get a new one, so I need to emulate the situation that the Mac is now the replacement with an empty hard drive.

How to do that?

About 10 years ago I would just do something like:

sudo dd if=/dev/zero of=/dev/disk0 count=128 bs=1M

On modern, cutting-edge Macs, however, I am not even sure if that will work (maybe there are some belts & braces against doing it even for root, or maybe it will not actually wipe the data on the very underlying physical drive, I don't know).

The disks look this:

sudo diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:             Apple_APFS_ISC Container disk1         524.3 MB   disk0s1
   2:                 Apple_APFS Container disk3         494.4 GB   disk0s2
   3:        Apple_APFS_Recovery Container disk2         5.4 GB     disk0s3

/dev/disk3 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +494.4 GB   disk3
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            10.3 GB    disk3s1
   2:              APFS Snapshot com.apple.os.update-... 10.3 GB    disk3s1s1
   3:                APFS Volume Preboot                 5.4 GB     disk3s2
   4:                APFS Volume Recovery                939.8 MB   disk3s3
   5:                APFS Volume Data                    30.0 GB    disk3s5
   6:                APFS Volume VM                      20.5 KB    disk3s6

So, how to wipe my Mac to test disaster recovery?

12
  • "sudo dd if=/dev/zero ..." - Please note there's no point in using dd where a simple cat will do.
    – marcelm
    Commented Jul 31 at 18:42
  • @marcelm dd allows to set the amount of data to be written. How a simple cat can do it?
    – Greendrake
    Commented Jul 31 at 23:33
  • Hah, I had a bit of a knee-jerk reaction when I saw dd, which is often-repeated advice for imaging or erasing entire drives where plain cat would be better. You're right, if you want control over the amount of data written, dd is appropriate.
    – marcelm
    Commented Aug 1 at 8:20
  • Sorry if I'm missing the point and why would you not emulate the situation in which the Mac is the replacement with an empty hard drive and there is no important data by plugging in a new, blank HD, which should cost roughly pocket change? How could any other method not depend on devilish detail? Commented Aug 1 at 21:05
  • @RobbieGoodwin Why juggle hardware if the existing one can be brought to pristine original state just by issuing some commands? I'm not even sure if it's technically possible to replace HDD on modern MacBook Airs without replacing the whole board, and even if it is, why bother?
    – Greendrake
    Commented Aug 1 at 23:45

2 Answers 2

4

I need to emulate the situation that the Mac is now the replacement with an empty hard drive.

A replacement Mac (or a new logic board) will have the drive configured as you now have it. So all you need to do is just restore your data.

I would strongly advise against any kind of low-level wipe of the entire device.

That will delete the Recovery Partition, also firmware, and things like security tokens. Erasing the device may 'brick' your Mac, and you will have to connect a second, working Mac to it, and use Apple's Configurator app to restore the OS and firmware.

Also, note that TM doesn't backup the OS. The OS and user data are held on separate volumes. This means that all user data can be wiped from (and restored to) the "Data" volume, without affecting the OS volume or any other volumes.

Re: "total physical loss". The SSD is now a part of the logic board. Any 'disaster' to the SSD hardware will require a new board.

You can return a Mac to a 'factory' state by using "Erase All Content and Settings" in System Settings > Transfer or Reset.

2
  • Okay, so how to wipe the Data volume? dd?
    – Greendrake
    Commented Jul 31 at 7:49
  • benwiggy: According to everymac.com, the Mac Studio models do have a replaceable SDD. Commented Jul 31 at 9:33
0

For disaster recovery, I would want a bootable USB, hard copy of the instructions for an erase install and your local backup on two external hard drives.

Since modern macOS implementations encrypt the data at rest, you don’t need to mess with overwriting the storage, when you discard the key stored in the T2 chip or Secure Enclave, the data is immediately cryptographically erased. The old ways (writing zeroes with dd or a pseudo random data source) are an ineffective use of time and easy to mess up, use the Erase Assistant and tools.

If you don’t care about being secure, you could boot to recovery and reformat the volume. Searching this site, you will see dozens and dozens of people not able to follow that, so I recommended the surefire steps above using the assistant.

2
  • The purpose of writing zeroes with dd in my case is not to erase data so that it cannot be restored at all, but rather to screw up the computer so that the fastest way to restore it is to use the backup. That's why I am writing the 1st 128 MB only.
    – Greendrake
    Commented Jul 31 at 10:07
  • The erase is very fast @Greendrake have you tried it? If you’re not interested in destroying the data or changing the keys, support.apple.com/guide/disk-utility/… erase the storage in recovery. You need a second OS to correctly remove the first OS. Recovery gives you that second OS.
    – bmike
    Commented Jul 31 at 11:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .