Clear Read-Only flag on Disk in Windows 7 using Diskpart
This is a short HOWTO clear the read-only/readonly flag/attribute on a disk in Windows 7 using the diskpart command from a Windows Command Prompt.
Warning!
Be sure to do this on the right disk since the diskpart command can do serious damage if you run it on the wrong disk.
- Open a command window by running the diskpart command from a Command Prompt
- Determine which disk you are going to modify:
-
DISKPART> list disk Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 149 GB 1024 KB Disk 1 Online 465 GB 465 GB
- Select the disk you are going to modify
DISKPART> select disk 1
You have now selected disk 1
list disk Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 149 GB 1024 KB * Disk 1 Online 465 GB 465 GB
- Clear the Read-Only attribute on the selected disk
DISKPART> attributes disk clear readonly
The disk is no longe Read-Only protected.
If you would like to set the disk Read-Only again just do the same procedure and write
DISKPART> attributes disk set readonly
in the last operation.
When you are done modifying the disk attributes just issue the exit command
DISKPART> exit
and the diskpart windows will be closed.
Thank you so very much, I have been looking everywhere for this solution best one i have found. Already took one card back and didn’t have to.
Once again Ty worked like a charm after removing and reinserting
What if ….”diskpart failed to clear disk attributes” msg pop?
Are you sure you did run diskpart with administrator rights?
What if ….”diskpart failed to clear disk attributes” msg pop? using as administrator
how do you know wich one disk to select??
You probably know the capacity/size of the disk you are going to modify and choose it.
Try to remove disks if you have several of the same size to avoid working on the wrong disk.
Just installed Windows 7 yesterday for the first time and all went nice and smooth until this “read-only” problem started to pop-up. I did google the solution and came to this web site and did it like explained – all I can say it thank you big time cause it worked right away with no problems what so ever.
I did as you said every command got successfully executed but still it shows disk is write protected??
not working…i have sandisk pd bt same problem….pls help…urgent….contact me on email id(chintanshah0123@gmail.com) pls….
I tried it but still write protected. Are there still any other methods? Please help me. Thank you
Sorry to hear that. This method worked for me so I have not done any more searching about this problem.
ive tried this… and afterwards i typed in “det dis” and i got the following:
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
——– ————- ——- ——- — —
Disk 0 Online 298 GB 0 B
Disk 1 Online 596 GB 7168 KB
* Disk 2 Online 29 GB 0 B
DISKPART> sel dis 2
Disk 2 is now the selected disk.
DISKPART> att dis clear readonly
Disk attributes cleared successfully.
DISKPART> det dis
ChipsBnk Multi-Reader USB Device
Disk ID: 00000000
Type : USB
Status : Online
Path : 0
Target : 0
LUN ID : 0
Location Path : UNAVAILABLE
Current Read-only State : Yes
Read-only : No
Boot Disk : No
Pagefile Disk : No
Hibernation File Disk : No
Crashdump Disk : No
Clustered Disk : No
Volume ### Ltr Label Fs Type Size Status Info
———- — ———– —– ———- ——- ——— ——–
Volume 5 E RAW Removable 29 GB Healthy
i need “current read only State” to be “no” as well…
Any suggestions please email me at ballzac2000(at)hotmail.com.
Thanks,
Zacc
sir , my sandisc pendrive is write protected
plese send me on my email how to cancel write protection on my pen drive
Hi Rajendra gupta,
Why don’t you try to follow the instructions in the post and let me know what went wrong?
I tried the above mentioned commands.When I run the last command “attributes disk clear readonly” then I am getting the message as “Disk attributes cleared successfully” . But still when I try to format or paste something then I am getting the same message that disk is write protected. Plz guide me.
Hi Ketaki,
Are you sure you did run diskpart with administrator rights?
You guys need to unplug your drives and then plug them back in. Also, try rebooting your computer. For harddrives for example, setting the readonly bit will only work after a reboot (or possibly after remounting the drive).
I get this error, so apparently you need to run a check-disk to remove the dirty flag from the drive. chkdsk u: /f /r /x I have a exfat ssd on windows 7 and this happens every other month where it mounts as read only. If it tells you the drives in use, in task manager you can go view>select columns> image path name to see whats loading off the drive. Not 100% but may help.
@Hans-Henry & @Solver, Morning! I’ve been searching a method myself for un-setting the read-only state on my sandisk drive. Nothing seems to work. I followed this procedure every step of the way, but nothing seems to work.
I got to this so far:
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
——– ————- ——- ——- — —
Disk 0 Online 250 GB 0 B
Disk 2 Online 16 GB 0 B
DISKPART> sel dis 2
Disk 2 is now the selected disk.
DISKPART> att dis clear readonly
Disk attributes cleared successfully. (This is really annoying… Appearently all worked out just fine…)
DISKPART> det dis
ChipsBnk Multi-Reader USB Device
Disk ID: 00000000
Type : USB
Status : Online
Path : 0
Target : 0
LUN ID : 0
Location Path : UNAVAILABLE
Current Read-only State : Yes
Read-only : No
Boot Disk : No
Pagefile Disk : No
Hibernation File Disk : No
Crashdump Disk : No
Clustered Disk : No
That current Read-Only State has never changed, no matter what I do. After that, I typed exit as instructed, removed the flashdrive then plug it back in but nothing seems to work. I even repeated every step but after I typed “exit” and removed the flashdrive I even went ahead and reboot my PC, still, no changes took place. is there anything I’m missing? I’d very much appreciate if you could please guide me a little bit on this matter. Thanks in advance.
jogs2602@yahoo.com
Try and close any Control Panel, My Computer and any folder you have opened. Then insert memory card and close autorun. Run the procedure. In My Computer eject memory card dismount dismount, reinsert. See if that helps!
Many thanks – worked like a charm!!! i had a 3TB backup drive that all of the sudden went READ-ONLY, and i’ve been ‘stuck’ with it like that for almost a year!!!
this solution is too easy ( as they say in the military )
THANK YOU x 1000!!
I tried the above mentioned commands.When I run the last command “attributes disk clear readonly” then I am getting the message as “Disk attributes cleared successfully” . But still when I try to format or paste something then I am getting the same message that disk is write protected. Plz guide me.
Hello Everyone,
I was able to resolve my issue. Here is what I did.
Firstly, there are a series of options in the Group Policy Object Editor that deal with read/write permissions on hard drives and removable media. I basically changed their individual settings from “Not configured” to “Disabled”.
Start -> Run… -> gpedit.msc -> OK
Computer Configuration -> Administrative Templates -> System -> Removable Storage Access
In here I disabled all of the “Deny read access/write access” options; you may only want to disable the ones relating directly to the type of media that you want to access.
Here are the ones I changed:
Removable Disks: Deny execute access
Removable Disks: Deny read access
Removable Disks: Deny write access
Double-click each one and select the ‘Disabled’ radio button.
i got same problem but try this
GREAT page. Searched and searched, I didn’t found the solution anywhere as here. Still a mystery why the (initially GPT, now MBR, always with exFAT partition) disk got readonly! THANK YOU!!
Thanks for this tip that solved my problem.
^^^^^ i got the same problem