Sunday, March 31, 2019

Formatting a Write-Protected USB Stick

Most times you don't even need to format your USB stick. Simply delete the existing files and copy in new files again.

People usually reformat when they want to clean out the pendrive. Or switch from FAT32 to NTFS or exFAT to suit a particular OS. In my case, I was using Rufus to install a bootable ISO to my USB stick. For some reason, it failed during the creation of the partitions. Ended up with a pendrive that is not accessible. Right-click, Format. Windows says no. Tried using the excellent HP USB Disk Storage Format Tool. Says disk media is write-protected. No write-protect switch anywhere on the pendrive.

Now, the forums said that I should use diskpart to set "attributes disk clear readonly". Didn't work. Some suggested using regedit to create a new DWORD called WriteProtect under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies and set it to 0. Didn't work.

What eventually did work - using diskpart to create and format the active partition on the USB stick.

Here's the session log:
Microsoft Windows [Version 10.0.17763.316]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>diskpart

Microsoft DiskPart version 10.0.17763.1

Copyright (C) Microsoft Corporation.
On computer: DESKTOP-46R9F1I

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          465 GB  1024 KB
  Disk 1    Online         7646 MB  7645 MB

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          465 GB  1024 KB
  Disk 1    Online         7646 MB  7645 MB

DISKPART> select disk 1

Disk 1 is now the selected disk.

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          465 GB  1024 KB
* Disk 1    Online         7646 MB  7645 MB

DISKPART> clean

DiskPart succeeded in cleaning the disk.

DISKPART> create partition primary

DiskPart succeeded in creating the specified partition.

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          465 GB  1024 KB
* Disk 1    Online         7646 MB      0 B

DISKPART> select partition

The arguments specified for this command are not valid.
For more information on the command type: HELP SELECT PARTITION

Partition 1 is now the selected partition.

DISKPART> active

DiskPart marked the current partition as active.

DISKPART> format fs=ntfs

  100 percent completed

DiskPart successfully formatted the volume.

DISKPART>

After that, the USB stick works normally again.

No comments:

Post a Comment