Live data from Hacker News

Don’t format a drive of M1 Macs from recovery mode

giuliomagnifico.medium.com

51–60 of 154 posts

Re: Don’t format a drive of M1 Macs from recovery mode

#51
post #47

Earlier quoted context omitted.

> GPT along with most filesystems store a bunch of stuff at random places around the disk, for many filesystems it's even configurable. This is not remotely accurate. GPT is at the beginning of the disk, with a backup copy at the end of the disk. Wiping the GPT makes the layout of filesystem structures within partitions completely irrelevant. Wiping the primary GPT at the beginning of the disk is usually (possibly al…

> This is not remotely accurate At least Ext4 repeats the complete superblock at the beginning of every block group, so yes, it is not only remotely accurate, but entirely accurate. In the case of GPT, Linux requires explicit command line options to enable alternative GPT use, but do you know this is true for all systems in existence and all versions of Linux? > Rebooting and re-detecting everything between partition…

> Yes, I've personally bumped into this on desktop and unattended server installs - numerous times.

Name and shame, please. Because your spurious complaints about SSD write endurance haven't exactly established your credibility, and you do otherwise seem to be postulating that non-standard nonsensical actions will somehow insert themselves into the process under discussion.

> I'm offering you concrete real world examples of why you should avoid the hack and you're simply ignoring them

No, you're not offering any concrete real-world examples. You're offering hypothetical examples of how a malicious user might be able to trip up a non-specific hypothetical automated OS installer.

> At this point I'm considering this not only to be offering up worst-practice advice, but actively trolling. Possibly the worst case of "a little knowledge is dangerous" I've seen recently. Regards

You are the one who called something "bad advice" but three comments later have yet to prove that it could ever fail in practice. I'm not trolling, and I'm not saying that a dd to the first 1GB of a drive is the best way to clean a drive. I'm just taking exception to your unfounded claims about what "could" go wrong.

Re: Don’t format a drive of M1 Macs from recovery mode

#52

Earlier quoted context omitted.

I was kind of shocked at how hard it is to factory reset a MacBook. I had one at work and I had to pass it on and the guide is a multi step process which I messed up the first time and ended up reinstalling with my user account still there. Had to start again which takes hours. Why does the recovery not just have a button called factory reset which unlinks your apple account, deletes the volume and then sets it all u…

While I'm not disagreeing that this should be possible to (easily) factory reset a device, it also shouldn't be possible for just _anyone_ with physical access to completely reset the device either. Easy resets also mean more interesting to steal

we used to say there's no security if you have physical access... any measure to protect physical access vulnerabilities is bound to cause annoyances and limit freedom of what you can do with your own devices sooner or later

Re: Don’t format a drive of M1 Macs from recovery mode

#53
post #51

Earlier quoted context omitted.

> This is not remotely accurate At least Ext4 repeats the complete superblock at the beginning of every block group, so yes, it is not only remotely accurate, but entirely accurate. In the case of GPT, Linux requires explicit command line options to enable alternative GPT use, but do you know this is true for all systems in existence and all versions of Linux? > Rebooting and re-detecting everything between partition…

> Yes, I've personally bumped into this on desktop and unattended server installs - numerous times. Name and shame, please. Because your spurious complaints about SSD write endurance haven't exactly established your credibility, and you do otherwise seem to be postulating that non-standard nonsensical actions will somehow insert themselves into the process under discussion. > I'm offering you concrete real world exam…

You are literally commenting on the thread for a blog post describing the mess that occurs when a drive is incorrectly erased. JFC

Re: Don’t format a drive of M1 Macs from recovery mode

#54
M1 Macs are not like Intel macs, Apple have done a dismal job of documenting them, and their "for users" tooling is still buggy and broken because the launch was clearly rushed.

Here is what you need to know to actually understand these things:

The SSD has 3 partitions. Each partition is an APFS container. Each container contains multiple APFS volumes.

Your OS, and everything you care about, is on the second partition/container.

The first partition contains boot configurations. The third partition contains the One True Recovery OS (1TR), which includes the Boot Picker menu (that thing you get when you hold down the power button). These partitions form part of system firmware, think of them as part of UEFI/BIOS. Do not touch these. If you mess up those volumes, the only way to recover the machine is via Apple Configurator 2 from another Mac (DFU mode).

Disk Utility, the GUI, is broken sometimes. If something doesn't work properly there, ditch it and use the command line.

Both Disk Utility, the GUI, and diskutil, the CLI, will hide the first and last APFS containers from you to stop you from shooting yourself in the foot. They're still there, just hidden from the main listing. You can get info for them. Be careful with that.

To do OS reinstalls, you want to be in 1TR. This is not the macOS recovery. Hold down the power button and pick Startup Options from there. Then you can use diskutil (preferably the command line version). You should delete the whole APFS container (disk0s2 usually) corresponding to your install, which will contain multiple volumes. Re-create it as APFS. That will create a container with one volume. You can then install to it and the macOS installer will create all the other volumes.

Additionally, the SEP data is stored separately from the OS (in one of the volumes of the first container). To wipe that, after wiping the partition and before reinstalling, run `xartutil --erase-all`. I've never tried that myself, and I suspect it's not really required because a reinstall should start with a fresh store, but it's probably a good idea to try if you have authentication/user-related issues after reinstalling.

There is also OS recovery, which is the recovery instance that comes with an OS install. It looks exactly the same as 1TR, but it's not the same, and this is highly confusing. For any serious digging around, you want to be in 1TR. Booting holding down the power button will get you there, usually; after a failed macOS boot I've seen it go into regular recovery anyway. To be absolutely sure, boot into 1TR (holding down power, then startup options), then do a clean shutdown, and boot again the same way.

More info on what's on the SSD of these things:

https://github.com/AsahiLinux/docs/wiki/SW:Storage

Re: Don’t format a drive of M1 Macs from recovery mode

#55
post #5

Why not just do the usual dd if=/dev/zero of= bs=1M count=1024 instead of using those weird proprietary tools?

That "bricks" your Mac, and you have to do a DFU restore with Apple Configurator 2 to recover from it.

The SSD on these Macs contains system firmware, including the boot picker and recovery mode. Do not wipe the entire top-level block device. They cannot boot from external media, by design.

M1 Macs are not PCs, and you shouldn't blindly apply whatever you think you know from the PC world. Their low-level design is much closer to an embedded device like a Raspberry Pi, minus the SD card slot. https://github.com/AsahiLinux/docs/wiki/M1-vs.-PC-Boot

It's hard to truly brick these things (you need to wipe NOR flash for that, and even then Apple can fix it without taking them apart, but you can't, because if you wipe NOR flash calibration data is gone and it has to go back through part of the manufacturing test process), but wiping the entire SSD isn't going to help you. If you start messing at that level, you'd better be prepared with another Mac and Apple Configurator 2 to get a proper clean start.

Re: Don’t format a drive of M1 Macs from recovery mode

#56
post #51

Earlier quoted context omitted.

> Yes, I've personally bumped into this on desktop and unattended server installs - numerous times. Name and shame, please. Because your spurious complaints about SSD write endurance haven't exactly established your credibility, and you do otherwise seem to be postulating that non-standard nonsensical actions will somehow insert themselves into the process under discussion. > I'm offering you concrete real world exam…

You are literally commenting on the thread for a blog post describing the mess that occurs when a drive is incorrectly erased. JFC

Look, I get that you don't like the advice to overwrite the first 1GB of a drive, probably because it strikes you as inelegant and suboptimal. But you've done a horrible job of identifying any real problems with that method, and it's certainly simpler and more reliable than the procedures in the blog post that didn't work. And your proposed "portable, reliable, robust" method is by any measure less portable, and not available at all on macOS.

Re: Don’t format a drive of M1 Macs from recovery mode

#57
post #38
post #32

Apparently the author erased the APFS volume instead of erasing the physical volume.

You can't wipe actual physical volume on M1 without some command line magic and even then I not sure it's gonna work. Recovery disk utility say it's will wipe it, but it do nothing and Erase Mac option is the same: all it do is erase user data. I got stuck with almost the same issue even though I'm system administrator and programmer with decade of experience. I can't imagine how all this mess should feel for average…

You absolutely can wipe the main APFS container on M1, from 1TR mode (the recovery menu that you get by holding down power). That will wipe the OS along with user data. Unless you have something broken in system firmware at that point, it's a clean start.

This works from the GUI Disk Utility too, usually, though that tool is flaky sometimes. It definitely works from the command line.

Re: Don’t format a drive of M1 Macs from recovery mode

#58

This is because the author didn't delete the entire volume group. You have to delete the whole volume group, i.e. erase the entire drive and it's partitions to reinstall OSX. This isn't new with the M1 Macs. This has been a thing since they introduced APFS. When they went into disk utility after the cli - Then they could delete everything and kick off the OSX Install. If the APFS Volume Group still exists the install…

Not the entire drive, just the entire OS volume group (containing multiple volumes), which is one GPT partition. There are 3 volume groups (partitions), two of them are hidden by the main listings in diskutil (but still exist). If you mess those up, the only way to recover is Apple Configurator 2.

Re: Don’t format a drive of M1 Macs from recovery mode

#59

Earlier quoted context omitted.

While I'm not disagreeing that this should be possible to (easily) factory reset a device, it also shouldn't be possible for just _anyone_ with physical access to completely reset the device either. Easy resets also mean more interesting to steal

Is it that hard to just corrupt the file system?

Like iPhones, new Macs are linked to an account and you can’t activate a new installation without access to the account. This is a pretty strong theft deterrent.

Of course this only works if you need access to the account to break this link.

Re: Don’t format a drive of M1 Macs from recovery mode

#60

Earlier quoted context omitted.

I was kind of shocked at how hard it is to factory reset a MacBook. I had one at work and I had to pass it on and the guide is a multi step process which I messed up the first time and ended up reinstalling with my user account still there. Had to start again which takes hours. Why does the recovery not just have a button called factory reset which unlinks your apple account, deletes the volume and then sets it all u…

While I'm not disagreeing that this should be possible to (easily) factory reset a device, it also shouldn't be possible for just _anyone_ with physical access to completely reset the device either. Easy resets also mean more interesting to steal

Why though ? If someone wants to harm you, they can damage the hard drive enough so that the data is unreadable if they have physical access.
Post reply on HN