Delta Engine Blog

All about multiplatform and game development

Write permissions on disk suddenly gone?

Hard disk

For some strange reason I could not write any files on one of my server hard disks anymore. I just got the following error all the time when trying to write anything to the disk:

 

The media is write protected.

 

Well, maybe my user has not enough rights? Nope, even changing the drive or any folder permissions just gave me the same error and reverted any changes I made to the permissions. I certainly did not write protect that drive, but the only way for me to remove the write protection was to use diskpart.

 

If you run into the same kind of problem use the following procedure:

  • Start diskpart (via Run->"cmd" or directly via WindowsKey+R->"diskpart")
  • Select your disk with select disk 0 (or a higher number if you have multiple disks)
  • List all your drive partitions with list partition
  • Go to the partiion in question (see drive letter), e.g. select partition 3
  • Execute the following command to remove the write protection: attributes volume clear readonly

And now writing to that disk is possible again. To speed up file access I usually also remove "Index this drive for faster searching" in the local disk properties. Next I go to the hardware section of the properties and go to Properties->Policies and enable both "Enable write caching on the disk" and "Enable advanced performance", which speeds up writing a bit (useful in my case because I write a lot of data to that server). The disadvantage is that you might lose data in case of a crash or power failure, but that never happend to me.