Can't delete APFS volume! ...rendering MacBook unusable.
I have a MBP with SSD which won't boot. (I can enter the Filevault password but the progress bar gets to 100% and then stalls. If I boot into Single User mode I can't run fsck without it throwing up an endless loop of errors to do with spaceman_freed. The same booting in Verbose mode.)
If I try to use Disk Utility from Recovery mode or a USB boot drive, anything I try to do with the APFS drive hangs Disk Utility, so I'm working from the Terminal in Recovery mode.
At this point all I want to do is wipe the drive so I can install Mojave from scratch. However I can't wipe the APFS-formatted drive - each method I try I get a different setback. When I tried just running the Mojave install from a USB drive, it got to the point of prompting me for a password for the drive (it takes several minutes for the prompt to come up from the point I click Unlock...) and then just seems to hang, as if it's unable to decrypt the drive.
There's an APFS container (disk2) with four volumes (disk2s1 to disk2s4). disk2s1 is FileVault encrypted.
I tried decrypting the volume (diskutil apfs decryptVolume /dev/disk2s1 -user UUID); it accepts the password and says it's decrypting in the background but won't return me to the command line. Nothing seems to happen for several hours. I can ctrl-c out of this but the disk remains encrypted.
I then tried deleting the Container (diskutil apfs deleteContainer /dev/disk2); this failed at the point at which it tried to unmount the volumes. Error -69888.
I then tried deleting the volumes individually (diskutil apfs deleteVolume /dev/disk2s1); after five minutes or so I got "Error: -69888: Couldn't unmount disk". This happened on the encrypted or unencrypted volumes.
Eventually after several reboots diskutil unmountDisk force /dev/disk2s1 worked to the point that the deleteVolume would get as far as "Deleting Volume" with an ASCII progress bar getting to 50%; however after many minutes with no progress, the machine hangs with a black screen and has to be force-restarted. I note that during this process the fan is kicking in, which seems odd given I wouldn't think deleting a volume should be too computationally intensive.
I've also tried doing all this from Terminal from a USB drive set up as a Mojave installation disk, to the same effect.
Please can somebody tell me how to wipe this drive! I'm starting to think it's a hardware fault with the SSD.
MacBook Pro