read only attribute of USB cannot be disabled

michiel dhont 0 Reputation points
2024-08-13T15:18:40.7666667+00:00

for my raspberry pi i use a USB stick for the operating system. i changed the USB to read-only in linux and was able to change it back. After rebooting i found out i broke something and it could not boot. so i tried to edit the broken file by plugging the USB into my laptop. however it is still read-only and if i try to edit the file i get an error saying this media is write protected.

i tried the following sollutions:

first i verified that the USB has no write protection switch

then i used diskpart to remove the readonly attribute, i get the message saying the disk attribute was cleared successfully but running attributes disk gives the following

Current Read-only State : Yes

Read-only : No

Boot Disk : No

Pagefile Disk : No

Hibernation File Disk : No

Crashdump Disk : No

Clustered Disk : No

then i tried using regedit by changing

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies

WriteProtect

to 0 and rebooted my computer.

this did not work either.

then i tried formating the drive but windows gives an error saying the disk is write protected.

is there any other way to regain access to the usb drive?

Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. S.Sengupta 24,636 Reputation points MVP
    2024-08-14T00:12:25.9433333+00:00

    You can boot from a Linux live USB, you might be able to remove the read-only flag using the following commands:

    sudo hdparm -r0 /dev/sdX

    Replace X with the letter assigned to your USB drive.

    Open Command Prompt as administrator and try:

    fsutil dirty query X:

    (Replace X with the drive letter of your USB) If it says the volume is dirty, run:

    chkdsk X: /f

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.