I have an USB flash drive which is a gift from a company event. It was formatted into two partitions and one of it is locked to read-only. The company includes advertising documents in this partition. I would like to unlock it and return it into one good usb. I tried disk management utility, diskpart in cmd, but failed.

First I tried right-click format disk, and windows repond with "unable to complete the format".

Then I tried disk management utility but failed because of "write-protected usb".

Then I enter diskpart tried "clean", "create partition primary", "attributes disk clear readonly", "format FS=NTFS label=Data quick". "attribute disk" still tells me disk is in "read-only state" and "format" command failed due to media is write-protected.

  • 2
    Under the hood it may be a USB hub with a flashdrive and (emulated) CD-ROM. Or the firmware of the memory controller inside may not allow you to alter certain areas of the memory. What exact commands/actions did you try? What was the output? How did it fail? Any error messages? Please respond by editing the question. – Kamil Maciorowski Sep 2 '19 at 10:49

As long as you don't have any sensitive information on the drive, you can boot into a Linux LiveCD, and image the disk with zeros if you want to be hardcore about it with:

sudo dd if=/dev/zero of=/dev/sdX bs=4M status=progress

Where X is the number of your USB drive.

It's also simpler to just format it from a Linux LiveCD using a utility like GParted. Sometimes that does not work, if it doesn't, then it is best to just do the above.

If you do decide to format the drive with zeros, create a new partition table (GPT is the best) and create a new FAT32 (best for portability) partition or a new NTFS (if you're only using it for Windows) partition.

  • tried GParted, it says "cant write because opened read only" – mrr010 Sep 3 '19 at 13:52
  • Then try dd'ing the entire drive; that works on read-only partitions – Varun Narravula Sep 3 '19 at 14:03
  • dd:failed to open '/dev/sdf': Read-only file system – mrr010 Sep 3 '19 at 14:21
  • Run mount, then unmount any partitions on the drive shown, then dd it again: maybe also use sudo if you haven't been – Varun Narravula Sep 3 '19 at 14:23
  • GDisk doesn't really care too much about mounted partitions, so you may want to use that as well – Varun Narravula Sep 3 '19 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.