6

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.

4

I have run across something similar before and what I did was issue the command:

diskutil unmountDisk /dev/diskxx

What you do when you shutdown and reboot, even in safe mode is you first unmount all your disks.

0
5

For anyone else who ends up on this question after searching online, be sure that you confirm that your SD card is not mounted as read-only! There is a physical tab that you may need to move:

enter image description here

1
  • +1 for nice illustration haha. It was not my problem, however. I ended up rendering my card useless by somehow corrupting some read-only bit (possibly alterable by hdparm, in my case not) – Jonathan Komar Apr 3 '17 at 18:00
1

I encountered this error message when trying to reformat my encrypted Seagate portable drive following the official website's guide.

You can tell whether the hard drive is encrypted by 'Get Info' when right click on it in Disk Utility. I wasn't able to decrypt it even though I have the correct password as the function was grayed out in Finder's right click menu for some reasons.

I solved it by erasing the volume first and then proceeded to erase the drive in Disk Utility. Obviously make a copy of everything you want to save before erasing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .