diskutil "eraseDisk" on disk0 using terminal

Hi Apple Team & Everyone,

Can someone guide me why sending 'diskutil eraseDisk APFS "WIPED" GPT /dev/disk0' command via terminal to remove/wipe the main physical drive (disk0) is failed?

I tried booting into recovery mode, but it still didn’t work. The command returned the following error:

Started erase on disk0
Unmounting disk
The volume on disk0 couldn't be unmounted because it is in use by process 0 (kernel).
Error: -69877: Couldn't open device

I understand that we can use Disk Utility (GUI) to unmount and erase the drive. Is it possible to perform this operation via Terminal to erase disk0?

I would appreciate any guidance on this.

Regards, Winson

disk0 in Recovery might not be the same thing as disk0 in the booted OS. You should always use diskutil list first to make sure you’re targetting the right drive.

Hi,

Yes, I always check "diskutil list" to ensure I remove the correct internal physical drive. We have no issues using Disk Utility to remove the MacBook internal drive, but we are having issues when using Terminal. Any ideas?

Thanks.

diskutil "eraseDisk" on disk0 using terminal
 
 
Q