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:
- I plugged in my SD card and ran
diskutil list
to grab the internal device node (/dev/disk2
) - I ran
diskutil partitionDisk /dev/disk2 GPT UFSD_EXTFS4 New 100%
(UFSD_EXTFS4 is ext4 provided by Paragon) - I saw that it was working, so I interrupted the process at step 2.
- 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.