19

I have a PNY 128gb flash drive that I can no longer modify (can't delete files). I've tried to reformat it using Disk Utility but I get the following message and my usb is unmounted:

enter image description here

I've followed the solutions found from these two postings with no luck.

Disk Utility cannot erase

Disk Utility won't erase

When I type in 'diskutil eraseDisk free EMPTY /dev/disk2' into terminal my usb is unmounted just like before and I get this message:

enter image description here

Any ideas on what I can do to erase and reformat my USB drive? Any help is much appreciated. Thanks!

3
  • Have you tried formatting the disk through diskutil?
    – Agbb
    Commented Jan 29, 2018 at 10:40
  • Sounds like it's suffered a write error & the firmware protect has kicked in. This is to all intents & purposes irreversible. See superuser.com/questions/1125282/…
    – Tetsujin
    Commented Jan 29, 2018 at 10:48
  • I got a similar error just the other day, actually (couldn't modify partition map). Did you partition it with a tool like GParted? That's what caused it for me. I don't know where the error comes from, but I think Disk Utility needs to have empty space around all your partitions, and GParted may not have put that in.
    – SilverWolf
    Commented Nov 4, 2018 at 17:02

6 Answers 6

8

Before trying anything more radical, do make sure (if you're using a microSD-SD adapter) that the adapter isn't write protected / locked. D'oh! It can be missed easily.

2
  • How can an adapter be "write protected"? Commented May 7, 2021 at 23:44
  • Some cards and adapters have a physical lock, a plastic switch.
    – alezvic
    Commented May 21, 2021 at 13:47
6

When nothing else works, you can try reinitializing the flash drive back to the conditions similar to when it was manufactured.

First, you need to determine the file name for the flash drive. Insert the flash drive in a USB port and execute the following Terminal application command.

diskutil list

The file name will be /dev/disk followed by a positive integer. You should also see the phrase (external, physical). For example, my 16 GB flash drive produces the output shown below. So the file name is /dev/disk2.

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *15.5 GB    disk2
   1:                 DOS_FAT_32 WINSTALL                15.5 GB    disk2s1

Next, the command to reinitialize the flash drive is given below. If your file name was not /dev/disk2, make the appropriate substitution.

diskutil  partitionDisk  /dev/disk2  1  MBR  FAT32  MYUSB  R
7
  • 12
    I tried this, and I obtain the following message on terminal: Error: -69877: Couldn't open device followed by: (Is a disk in use by a storage system such as AppleRAID, CoreStorage, or APFS?) Any suggestions?
    – Xavi
    Commented Nov 8, 2018 at 12:23
  • @Xavi: You are not the first to complain about my answer. You can try posting your own question and I will try to include some other possible solutions. Be sure to include the output from diskutil list and the output from any other commands you have tried. Commented Nov 8, 2018 at 12:51
  • Here is a question of someone who did exactely the same as I did, and is having the same problems. apple.stackexchange.com/questions/338300/… It would be great if you could add sime light there!
    – Xavi
    Commented Nov 8, 2018 at 13:14
  • @Xavi: Comments are not questions. You should not expect an answer from a comment. Commented Nov 8, 2018 at 13:39
  • Thanks for the advice :) I am not expecting an aswer here, but in the question of the link I provided above. Since it is posted by someone experiencing exactly the same problems as I am, I believe it is better that I don't add another question which might become a duplicate.
    – Xavi
    Commented Nov 8, 2018 at 13:54
4

I had a SanDisk USB stick that was giving me this issue when trying to build a bootable disk in Disk Drill. I was able to fix it by doing this:

  • Insert the drive
  • Run Disk Utility
  • Select "Partition Disk"
  • Partition the disk as ExFAT

After this I was able to use the disk to create a bootable USB. Hopefully this will fix the issue for you as well.

2

I had a similar problem with a Sandisk 32GB SD card. I solved it with the Windows management disk. I erased all partitions of the disk and then created a fat32. Initially no drive letter was assigned but then from My Computer, format the drive without problems. My SD card had this problem after using it for a raspberry pi.

1

I just faced the same issue on OSX Mojave with a Western Digital 2TB USB external drive. It started happening after I was trying to create multiple partitions using Disk Utility.. it kept hanging and becoming unresponsive. Even after rebooting the problem would continue. I then tried using the command line and ran into the error above.

What worked for me is I booted into Windows 10 and from there I was easily able to delete all the partitions on my drive and format it as ex-fat. Then I booted back into OSX and I was able to format that partition was JHFS+. I then continued to run into problems trying to create multiple partitions. I had to repeat the above cycle and finally I was able to create all my partitions by creating them one at a time.

0

I had this with a Sandisk card because I wasn't using the microSD to SD converter it came with, but one I had from a Raspberry Pi. As soon as I used the official one it worked fine.

You must log in to answer this question.

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