Thursday, February 4, 2010

DiskPart - Removing ReadOnly Flag from Volume

This is the process I use to add Replay/Clone of SAN disk for recovery. This is only works if the SAN allows writing to your Replay/Clone.

  1. Right click on computer and goto Disk Management
  2. Right Click on Disk Management and Rescan Disks
  3. Right click on the Disk and goto propertiesimage
  4. Find Disk by LUN and Target IDimage
  5. Right Click on the volume and Change Drive Letter and Paths
  6. Click and assign drive letter
  7. Open Command line (CMD)
  8. type 'diskpart'
  9. type 'list vol'
  10. find your volume by drive letter
  11. image
  12. type 'select vol #' (replace # with Volume number)
  13. type 'attrib vol clear readonly' (Allows disk to)
  14. image
  15. Go back to disk management and right click on the volume and Change Drive Letter and Paths
  16. Click Remove on the drive letter and Click OK
  17. right click on the volume and Change Drive Letter and Paths
  18. Click Add and add your drive letter again
  19. Disk should be have write access

 

image

Error: The operation did not complete

Answer: Most likely ISCSI mappings or Disk must be removed and added again.

10 comments:

Anonymous said...

DISKPART> select vol 1

Volume 1 is the selected volume.

DISKPART> attrib vol clear readonly

DiskPart has encountered an error: The media is write protected.
See the System Event Log for more information.


so it doesnt work...

Patrick Nielsen said...

The SAN I was working if only marked the volume as read only. You might want to check your disk level attributes.

diskpart
select disk X
attrib disk

You should see some results like below (my test disk was boot disk)

Current Read-only State : No
Read-only : No
Boot Disk : Yes
Pagefile Disk : Yes
Hibernation File Disk : No
Crashdump Disk : Yes
Clustered Disk : No

if your disk is set to ready only use the similar command for volume on your disk.

attrib disk clear readonly

I hope this helps

Alok said...

THANK YOU
it worked fine

Unknown said...

sir i have try all the thing that you have mention even i got message disk attribute clear successfully
but still when i write attrib disk the flag of current readonly state is
set

Patrick Nielsen said...

Ketul, if your working with SAN and used cloning/mirror/copy(Gold Image, etc...) of a LUN Volume that volume may be readonly at the SAN software level. Also make sure your disk is online for this operation. If the readonly flag on the disk is still set to readonly that may indecate that SAN is not allowing that flag to be cleared.

Anonymous said...

On my disk (external USB 3.0 dock, 3.5" SATA 320GB HDD), when I tried Diskpart, it listed it as CLEAR of 'Read-Only' attributes, but I still had to run the 'attrib vol clear readonly' command. Then it has allowed me to format the volume (it allowed me to create a volume after allowing me to delete the previous volume but gave the 'read-only' error message at the point of trying to format it). It's currently formatted 7% so progress has been made.

Patrick Nielsen said...

You may have a protected disk. This could be because of your USB device that connects to your computer or the disk attribute for read-only is set.

try viewing your disk attributes

diskpart
select disk X
attrib disk


You should see some results like below (my test disk was boot disk)

Current Read-only State : No
Read-only : No
Boot Disk : Yes
Pagefile Disk : Yes
Hibernation File Disk : No
Crashdump Disk : Yes
Clustered Disk : No

if your disk is set to ready only use the similar command for volume on your disk.

attrib disk clear readonly

I hope this helps

mykupang ;)= said...

DO THIS AS A LAST RESORT -almost give up situation

http://curt-kobain-hacker.blogspot.in/2012/06/100-working-method-to-remove-write.html

(read last part – use neo9)

download http://www.box.net/shared/9hgp81ndgs

*proceed with extreme caution!!!

opc.three said...

thanks man, helped me

Anonymous said...

i have problem to write on usb drive, the diskpart shows following attributes-

Current Read-only State : Yes
Read-only : No
Boot Disk : No
Pagefile Disk : No
Hibernation File Disk : No
Crashdump Disk : No
Clustered Disk : No

i apply the command: ATTRIBUTES DISK CLEAR READONLY
but still shows above attributes

i have to set Current Read-only State: No
what i do? help me