Say you have an iMac from 2018–2019 with an Intel processor, and you have to make sure that none of your data is left when you give it away. One way to do this is to boot into Recovery (CMD + R), format the volume, naming it X, then open Terminal and run dd to zero-fill the available space with something like this:
cd /Volumes/X && dd if=/dev/zero of=z bs=1m; rm -f z; syncWhen it’s done, it will report the number of records in and out in the classic dd fashion.
When we ran it and left the machines, whose screens were still on, and came back after a few days, dd had run for only one hour! You would think that in a Recovery session with a bare minimum of tools loaded, power saving would not be turned on. We could not find any reason other than that the (mechanical) disk might have gone to sleep while dd was writing.
When we came back, we pressed CTRL + T in the Terminal where dd was running. This shows the current status of the zero writes. It appeared to resume, and a few more CTRL + T presses showed that the write speed was, in fact, 90 MB/s. At that speed, dd could write 1 TB in about three hours.
So we opened another Terminal and ran:
caffeinate -dimsThen we let it run. This time, the zero write was successful.
So the lesson here is that if you have a long process, like a backup or zero-writing a disk, even in Recovery Mode, do use caffeinate. We also used pmset.