Apr 28, 2017 Symptom when diskpart failed to clear disk attributes. DiskPart is a text-mode command interpreter provided by Windows operating system. With this tool, you are able to complete many tasks by typing corresponding command in Command Prompt, for example, partition hard drive, create volume, format disk, clear disk attributes, etc. What I mean is that the first IDE controller and location behaves like this. So it does not need to be IDE 0 location 0. If the very first disk in the VM is say IDE 1 location 1, then DISKPART cannot clear its readonly attribute. While it can successfully clear readonly attribute of any other disk.
Failed To Clear Disk Attributes
We recently had an issue with a hard disk on one of our servers reporting that it was set to read only. It occurred after an unknown error with the system. Windows refused to allow us to write to the disk and stated that the 'Media was Right-Protected.' We also found that the read only attribute was nowhere to be found on the properties of the disk, so that we could remove it. To cut a long story short, it can only be removed using the Diskpart Utility with the following commands.Diskpart is run from the command prompt and launched by typing 'diskpart' and hitting enter.First thing you need to do is to identify your disk within the utility: Use the 'list disk' command and then use the following. This will clear the write protect from the disk.
Clear Attributes Diskpart
You can check if it has cleared the problem by running the 'detail disk' command again and/or attempting a file copy to the problematic disk. We found that it wasn't successful even though the attribute had been cleared. We then found that the volume was set to readonly too.We used:'list volume' - To Identify the drive By drive Letter'select volume' volume number'detail volume' - This gave us a complete synopsis of our drive and told us that readonly was switched on on the volume aswell.' ATTRIBUTES VOLUME CLEAR READONLY'This cleared the write-protect and fixed our problems almost instantly. Again yo ucan check using 'detail volume' and testing the write on the disk.In some cases a reboot of the server is required, but we found everything worked fine without.