Cannot format USB flash drive, everything claims it's write protected
I have a 4GB HP USB flash drive that I had written a Chromium OS image to with Win32DiskImager. Now I am trying to reformat it but I can't. Everything tells me the disk is write protected. Being a USB flash drive, there is no write-protect switch. I have tried the standard windows format thing, disk management, diskpart and HP USB Disk Storage Format Tool. I also tried the registry modification. Any ideas? Here is the results of trying to use diskpart:
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>diskpart
Microsoft DiskPart version 6.3.9600
Copyright (C) 1999-2013 Microsoft Corporation.
On computer: BRANDON-PC
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 931 GB 1024 KB
Disk 1 No Media 0 B 0 B
Disk 2 No Media 0 B 0 B
Disk 3 No Media 0 B 0 B
Disk 4 No Media 0 B 0 B
Disk 5 No Media 0 B 0 B
Disk 6 Online 3824 MB 0 B
DISKPART> select disk 6
Disk 6 is now the selected disk.
DISKPART> attributes disk clear readonly
Disk attributes cleared successfully.
DISKPART> clean
DiskPart has encountered an error: Incorrect function.
See the System Event Log for more information.
DISKPART> create partition primary
DiskPart succeeded in creating the specified partition.
DISKPART> format fs=fat32
0 percent completed
Virtual Disk Service error:
The media is write protected.
DISKPART> exit
Leaving DiskPart...
C:\WINDOWS\system32>
Even after using "attributes disk clear readonly" it still says the media is write protected. I think it's because the clean operation fails.
If none of the other suggested answers here work, then your USB flash drive is probably going bad.
There is a controller chip on the USB stick that manages the flash memory. If the flash controller detects any kind of unrecoverable error with the memory cells (a reallocation failure, for example), then it trips a safety condition and makes the drive read-only at the firmware level to protect your data.
Unfortunately, there is no way to get the drive out of this condition without the factory software for your drive. Flash drive manufacturers do not make this software available to the public, so the only way to get it is from Chinese hack sites.
Your only option here is to replace it. The top brands (Kingston, SanDisk, Lexar, etc.) provide lifetime warranties on their products. I have no idea how to go about getting that warranty though. But with flash drive prices being what they are, it's probably better to just go buy a new one -- unless it's a really nice one.
Being a USB flash drive, there is no write-protect switch.
Well, there are USB flash drives with (sometimes very well hidden) write-protect switches. I don't know of any such drive made by HP though.
Assuming your drive doesn't have such a switch, seeing what you've already tried, I think you need a new one. I've had two flash drives from different manufacturers that suddenly were read-only, and there was no way of fixing it.
I don't have any sources on this, but I assume this is a protection mechanism diminishes the risk of total data loss when the flash drive starts failing.