6

I accidentally bumped the drive while repartitioning it and it unmounted. After that when I tried to repartition with Disk Utility I got Partition Failed with the error: Could not open device

Now I am unable to modify the drive with Disk Utility. I don't really care about what is on the drive.

0
4

Step 1

Open Disk Utility (it is in Applications/Utilities) and click New Image with the device you want to fix selected

New image

Step 2

It doesn't matter what you name it but put it on your desktop so you can find it easily. Make sure it is a read/write.

Make Disk Image

Step 3

Find the disk on your desktop and open it. It should be empty.

Disk image

Step 4

Open Terminal (in the same place as Disk Utility) and type in diskutil list and locate your drive. It should have something similar to the name that shows up in disk utility indented under it (in my example it doesn't)

disktutil

Step 5

We are going to use a Terminal utility called DD to copy the contents bit by bit of the disk image we created to the drive. Make sure you do this right because you can seriously damage your hard drive if you don't. Feel free to ask questions.

This is the layout of dd: dd if=<source> of=<target> bs=1m

So type dd if= and then drag the drive (the one I named "Something") into the terminal window. After that copy the /dev/disk# from the diskutil command of your disk. Make sure it is the right one or you will overwrite your hard drive or other connected drive. Adding onto the dd command type of= and paste the /dev/disk#. Now add bs=1m to that.

Now in the dd command you should have something that looks like:

dd if=/Volumes/Something of=/dev/disk1 bs=1m

This is what it would look like for my example.

If everything looks ok then press enter.

This can take a long time and will not tell you what is happening until it is done. It will just be a blank line in the terminal. When you press enter just let it go until it is done. You will know when it is done because it will tell you something like copied something bytes....

Final step

Now that you have done that you should be able to go back into disk utility and repartition your dive under the partition tab. If you don't know how to partition it, just click the plus button near the bottom left, name your partition, and make it Mac OS Extended (Journaled) and click apply.

Remember if you are unsure, something is different in the steps, or something doesn't work, ask questions!

3
  • sudo dd if=/Users/me/Documents/storagemedia/Flash\ USB\ Disk\ Media\ fullsize.dmg of=/dev/disk2 bs=1m Password: ****** dd: /dev/disk2: Permission denied I'm also having some funny issues with the file size of the whole disk changing. It would be nice to be able to fix this. I have a few other of these broken laying around. it seams random linux distro's tend to break usb sticks...
    – user125388
    Feb 16 '19 at 23:47
  • Can you drop the result of diskutil list into PasteBin? I can't really help without knowing exactly what you are trying to do. I also wrote this a long time ago so it is possible Apple messed with something and broke this.
    – b2550
    Feb 18 '19 at 5:41
  • pastebin.com/xyKc8Ypx hope that helps someone, although I'm thinking more and more it is a lost cause. And it's only a 4GB thumb stick, although this thing tends to happen to me from time to time...
    – user125388
    Feb 22 '19 at 17:16

You must log in to answer this question.

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