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.


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 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.


Leaving DiskPart...


Even after using "attributes disk clear readonly" it still says the media is write protected. I think it's because the clean operation fails.


7 Answers 7


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.

  • Could you post me a link about this safety lock-mechanism? I'd like to learn more about the topic, but -unfortunately-, I can't find any articles about this. Commented Apr 19, 2016 at 10:47
  • 1
    Here's an article that passively mentions it. "... Eventually, a write is no longer possible. When that happens the existing data can not be overwritten and is therefore preserved." The article is talking about why individual cells fail, but USB flash drive wear-leveling algorithms are not as sophisticated as those found on SSDs, and brick themselves when unrecoverable errors are found. The sensitivity to errors varies by brand and quality.
    – Wes Sayeed
    Commented Apr 19, 2016 at 18:38
  • 1
    Aside from that, I can't find a lot of details without investing a lot of time into research. My knowledge just comes from first-hand experience with forensic data recovery, but I've been out of that game for a few years.
    – Wes Sayeed
    Commented Apr 19, 2016 at 18:42

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.


There are a couple of ways to fix this problem. Some of them are mentioned in the other answers, but I don't think that is the case. I've had the same issue before. Here's what you have to try...
1. Download a tool called CheapEasy and check your device VID and PID.
2. Go to http://flashboot.ru/iflash/ and enter the device VID or PID and search for the flash tool for your device. To make sure you get the right one, check on the CheapEasy tool for your Flash Part number or flash ID, which usually will be on the description of the flash tool you have to download.

P.S. If you have trouble finding the right tool, export you device information and send a link so I can check it. It might look impossible to find the right one, but I've fixed almost all types of USBs, expect some chinese copies of Kingston USBs.

  • 1
    Thank you very much! your solution is the best one!!! In my case I had to download a tool from Transcend website, and only this tool was able to repair my USB drive. us.transcend-info.com/supports/special.aspx?no=3
    – MeV
    Commented Dec 3, 2016 at 11:53
  • 1
    Thanks @MeV! I'm glad you had it fixed. Of course, I would always suggest checking the device "support & drivers" page in case they have a tool. Flashing the drive is the last option, in case all the others don't work. And by the way, I'm a fan of Transcend as well. :)
    – Erlis D.
    Commented Dec 4, 2016 at 12:30
  • 2
    In many years experience working in IT I never had this kind of issue. Last week I ran a 'dd' unix command to copy a ISO file into the pendrive and after that I couldn't do anything to format or erase it. As someone mentioned I believe the pendrive went read-only and only its original flashing tool could help. Thank you again, really, I was 5 minutes close to bin the pendrive forever :-)
    – MeV
    Commented Dec 5, 2016 at 10:45
  • 1
    An English version of the Flashboot site would be great!
    – dan
    Commented May 30, 2018 at 4:18
  • @MeV Solution worked for me. Thank you so much. Please put this up as a solution for others, people might miss this gem because of being in the comments. Commented Sep 28, 2021 at 15:19

Try this if using cmd doesn't work:

Removing write-protection in the Registry using Regedit.exe

  1. Search and open regedit.

  2. Navigate to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies.

  3. Double-click on the WriteProtect value in the right-hand pane of Regedit.exe. Change the Value data from 1 to 0 and click OK to save the change.

  4. Close Regedit and restart your computer.

Connect your USB drive again, and you should find it is no longer write protected. You can now format the drive as normal by right-clicking on it in My Computer and choosing Format.

After formatting you may revert the settings(0 to 1) or if you created the value, then delete it, then reboot.


If you can't find StoredDevicePolicies then you have to create one by right clicking on Control > New > Key and name it as StoredDevicePolicies. Now create WriteProtect by right clicking on Stored Device Policies> New > DWORD and name it as WriteProtect.

*DWORD chosen depending on your system: 32bit or 64bit.

By the way, some flash drives have a switch too. And be aware that this could also be caused by the USB's fails safe, where all reserved sectors that could be mapped in by the continuously generated bad sectors are exhausted.

  • This looks like a global setting, not something associated with that particular flash drive. Aren't there some ramifications to this beyond that drive? Also, if this is the failsafe for a dead drive, aren't there risks of data loss if you bypass it?
    – fixer1234
    Commented Sep 30, 2014 at 23:26
  • Yes it's a global settings which can be reverted after he formats the usb, and would be the last resort if he insists to format it. IF it's a dead drive, then there might be that possibility, but since he want's to format it it won't matter anyway, though I doubt that's the case-more likely to be some read-only files in the usb itself I think. Answer edited. Commented Oct 1, 2014 at 0:00

If you have a Linux somewhere (computer, cd, live-usb, etc), try to use dd in order to erase and write every bit of your usb key of zeroes. That Linux command never fails, and if it can't rewrite anything on your usb key, it's definitely over for it.

To make it fast, do you have any Linux on your computer ?

You said you got an ubuntu, so you'll need to install gnome-disk-utility or palimpsest in order to determine the right disk to erase. Once it's installed, you should find it as "Disk Utility" or simply Disks like here:


Just connect your usb key and then look which drive it is, like sdb or sdc, etc

Once it's done, open a terminal, become root and do the following command, X being the whole correct drive:

dd if=/dev/zero of=/dev/sdX

The terminal will now hang until it's done, and will show you how much bits was written, and say "no left space on device".

Note that it can take long, but assuming you have 4GB, it should take an hour at 2MB/s if you have a slow usb-key. The worst I ever had reached also an hour at 0.5MB/s for a 2GB uSD card. Plus, do not EVER ctrl-c an ongoing dd command, it can cause errors on the device, even if it doesn't often occurs.

You should now have a completely erased device. Go back to gnome-disk-utility to eject your usb key.

Reconnect it and then use gnome-disk-utility again in order to create a partition after creating a Master Boot Record.

  • 2
    Luckily I have Ubuntu installed on my computer.
    – Sega dude
    Commented Sep 30, 2014 at 23:43
  • Good :D So I will update my answer up.
    – X.LINK
    Commented Sep 30, 2014 at 23:54
  • @Segadude, +1 for installing ubuntu
    – pylover
    Commented Jul 27, 2016 at 14:32

I ended up fixing it by re-partitioning it using Disk Utility on my MacBook. This was back before El Capitan, when Disk Utility was redesigned. I made it one partition and formatted it as MS-DOS File System. It's been working fine ever since.


Open cmd.exe with administrative privileges and execute this command:

To unlock write-protect usb:

reg add "HKLM\SYSTEM\ControlSet001\Control\StorageDevicePolicies" /v WriteProtect /t REG_DWORD /d 0 /f

To lock write-protect usb:

reg add "HKLM\SYSTEM\ControlSet001\Control\StorageDevicePolicies" /v WriteProtect /t REG_DWORD /d 1 /f

For the changes to take effect, you must restart the PC and / or disconnect the USB storage device and reconnect it.

You must log in to answer this question.

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