Skip to main content
1 of 3
Jonathan Komar
  • 915
  • 3
  • 12
  • 21

How can I fix Error: -69877: Couldn't open device after interrupted formatting process?

This question, possibly the same question, has been asked: Couldn't open device

However, my question hopefully demonstrates a more specific scenario as the situation in which caused the error explicitly known:

The following done as a root user:

  1. I plugged in my SD card and ran diskutil list to grab the internal device node (/dev/disk2)
  2. I ran diskutil partitionDisk /dev/disk2 GPT UFSD_EXTFS4 New 100% (UFSD_EXTFS4 is ext4 provided by Paragon)
  3. I saw that it was working, so I interrupted the process at step 2.
  4. I attempted to rerun the command with the number of partitions explicitly stated diskutil partitionDisk /dev/disk2 1 GPT UFSD_EXTFS4 New 100%

I get the message:

Started partitioning on disk2
Unmounting disk
Error: -69877: Couldn't open device

Running gpt show -l /dev/disk2 yields

start     size  index  contents
    0  7741440

Running `gpt destroy /dev/disk2 yields

gpt destroy: unable to open device '/dev/disk2': Permission denied

It seems to me there is some lock on device disk2. I just need to figure out how to release it.

I was able to release it by rebooting into safe mode (holding shift key during boot) and then rebooting back into normal mode. I would like to know, however, what exactly could be done to release this lock without rebooting.

Jonathan Komar
  • 915
  • 3
  • 12
  • 21