Live data from Hacker News

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

giuliomagnifico.medium.com

41–50 of 154 posts

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

#41
post #35

Earlier quoted context omitted.

> But right now we're just trying to make a device appear functionally empty so that we can re-install an OS without remnants of any previous installation getting in the way The only portable, reliable, robust way to accomplish this is wiping the drive. If the original author had issued a secure erase, they would not have encountered any subsequent difficulties, all of which were due to partially erasing the device.

> The only portable, reliable, robust way to accomplish this That's setting the bar too high. If we're comfortable with solutions that will work on all mainstream PC platforms including Macs, then it is sufficient to overwrite partition tables with zeros. I have never heard of an OS installer that scans for deleted partitions, and worrying about the possibility of such a thing causing problems is unreasonable.

GPT along with most filesystems store a bunch of stuff at random places around the disk, for many filesystems it's even configurable.

The most usual problem with your approach is recreating a set of partition tables exactly matching the old tables, while failing to wipe out a filesystem signature buried halfway into the disk. One reboot later, and magic header bytes start to be recognized as valid filesystems by whatever OS installer or BIOS utility you happen to be using. Even worse if you're been taking some hacky shotgun approach to blowing holes in the drive by zeroing out random sectors that belong to one of those recognized filesystems.

So once again,

> The only portable, reliable, robust way to accomplish this is wiping the drive

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

#43

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…

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 up like new.

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

#44
I recently encountered something similar on my M1 air when i tried to erase it (if you got a new m1 air don't do it it's not really necessary). So turns out, with I believe Catalina, APFS has a system partition and a data partition on an m1 mac. one is read only with SIP on. I don't know how exactly APFS stores snapshots but the read only is for snapshots + macos updates sort of like iOS. If you erase the mac (btw there is an erase mac option like in iOS in recovery if you don't know decryption key so manually doing it is unnecessary) then your mac will basically clean your drive and reinstall macOS to the latest version. Now once you do that the read only partition is basically a dynamic container and remaining software is in the partition called untitled. This is similar but here the partition scheme messes up a little. You can delete local snapshots if you use time machine to free up space but the system snapshots (not the back up ones this is something different to protect system integrity) stay. If you really want to erase an M1 mac do it using the configurator which btw people have claimed has bugs so maybe wait. But otherwise this is going to be like iOS so you can just keep using your mac with delta updates because your system partition is going to be read only with snapshots for any failed updates called macos - System while all your data will be in macos - data. This 'erasing / formatting' a computer is reminiscent of Windows experience. It's just easier to clean everything and start again. But ideally it shouldn't be needed for Apple silicon macs (once macos bugs are sorted ofcourse).

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

#45

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…

I bricked my first TouchBar MacBook the day I received it, trying to do a factory reset as my company's security policies demanded. Not sure exactly how I triggered that state. Thankfully Apple took it back as a return.

It should not be possible to brick a device by pushing the wrong button. I was shocked that this wasn't caught by anyone at Apple before release.

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

#46

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…

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

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

#47
post #35

Earlier quoted context omitted.

> The only portable, reliable, robust way to accomplish this That's setting the bar too high. If we're comfortable with solutions that will work on all mainstream PC platforms including Macs, then it is sufficient to overwrite partition tables with zeros. I have never heard of an OS installer that scans for deleted partitions, and worrying about the possibility of such a thing causing problems is unreasonable.

GPT along with most filesystems store a bunch of stuff at random places around the disk, for many filesystems it's even configurable. The most usual problem with your approach is recreating a set of partition tables exactly matching the old tables, while failing to wipe out a filesystem signature buried halfway into the disk. One reboot later, and magic header bytes start to be recognized as valid filesystems by what…

> 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 always) sufficient to make an OS installer believe the disk to be empty. The backup GPT at the end of the disk is something I've only seen used by manual partitioning tools that are more powerful and complex than the automatic partitioning tools that are part of OS installers.

> The most usual problem with your approach is recreating a set of partition tables exactly matching the old tables, while failing to wipe out a filesystem signature buried halfway into the disk. One reboot later, and magic header bytes start to be recognized as valid filesystems by whatever OS installer or BIOS utility you happen to be using.

Rebooting and re-detecting everything between partitioning and mkfs is not part of any ordinary OS installation procedure. Do you have any evidence that this failure mode can actually occur in practice with real shipping operating systems?

Remember, for the purposes of this hypothetical, we have to assume that at least one of the user or the OS installler is actually trying to make the process work. You can't assume that they're both trying to interfere with the process and are both going out of their way to cause problems.

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

#48
post #42
post #39

IDK but I always just wipe (as in delete all partitions) and do a fresh install on any new MB; and had no issues with the latest Air.

Why do this on a new MacBook? Is there a security concern?

Yeah, peace of mind and Internet-install obv. also has the latest OS build.

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

#49
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. The most usual problem with your approach is recreating a set of partition tables exactly matching the old tables, while failing to wipe out a filesystem signature buried halfway into the disk. One reboot later, and magic header bytes start to be recognized as valid filesystems by what…

> 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 partitioning and mkfs is not part of any ordinary OS installation procedure

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

But you're externalizing the onus to prove cases where some hacky approach won't ever break when there is a vastly simpler way to avoid this entire class of problem. This is exactly the reverse of sound logic -- I'm offering you concrete real world examples of why you should avoid the hack and you're simply ignoring them

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

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

#50

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

Is it that hard to just corrupt the file system?
Post reply on HN