Problem: USB drive formatted for use with an Ubuntu machine. I wanted to format the USB for reuse on a Windows 11 computer. One windows system would not mount the USB device and give an error message that the device needed to be formatted, however, any attempt at format failed. Should also note the device size was listed as unknown in the format wizard.
Earlier and on a different windows box, the USB device would mount but could not be formatted giving an error message that the device was read only. Made several attempts with different solutions found online but none worked. After these attempts, the other machine would not mount the drive.
After a lot of trial and error, it came down to 3 methods most likely to force a format: a registry edit, use diskpart to remove read only status and diskpart to format the drive. There are a couple of others which remove read only status: mechanical switch or disk properties available in windows explorer, but it the drive won’t mount, windows explorer is useless.
For the registry, you need to create a key. Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies
create a value in the key: writeprotect DWORD(32-bit) and set it to 0.
This went smoothly but the USB still failed to format. Probably because the USB drive would not mount. Still got an error of unknown disk size in the formatting wizard.
DISKPART would recognize the device and list the size. So tried removing the read only property.
Run DISKPART > list disk > select disk # > attributes disk clear readonly
It returned success. However, still could not mount or format the disk. Same error message in the wizard box – unknown disk size.
Since DISKPART would recognize and determine the size, I then chose to format the disk directly in DISKPART.
Run DISKPART > list disk > select disk # > clean > create partition primary > format fs=ntfs
This is a full format, not a quick format, and is slow. Patience required to even see the first 1%.
When the format is complete, windows explorer opens focused on the USB device. If the message in the formatting wizard is disk of unknown size, start with this.