Clear disk or volume read-only attribute with Windows 7 DVD
This article applies to Windows XP only. In newer Microsoft operating systems, DiskPart utility is able to do the job properly.
Sometimes you might see an error message such as "The operation did not complete because the media is write-protected" or "The volume is read only" while trying to format or initialize a disk. This happens when someone or some program has marked the disk or volume/partition read-only.
Sadly, Windows XP version of command-line DiskPart utility has no ability to set or clear read-only attribute for a disk or a volume, so you need some workaround in case you encounter such error messages.
Windows Vista, 7, 8 and 8.1 users can clear the read-only attribute easily using DiskPart.
If you do not have any of the listed options available, you can download Windows 7 Enterprise (or newer) evaluation DVD from http://www.microsoft.com/en-us/evalcenter/evaluate-windows-7-enterprise. Please download the x86/32-bit edition, because this one works best with older PC-s.
You need to login with your Microsoft account to access the downloads.
This is a large download (over 3 gigabytes), so take your time. Burn the downloaded file to a blank DVD using instructions in the Create disc from ISO image article. If you have not installed CDBurnerXP, read the Install CDBurnerXP article first.
Next, make sure your computer is set to boot from CD/DVD. Instructions are in the Computer boot order article.
Insert the DVD you created and restart your computer. Press Space or Enter while the message "Press any key to boot from CD or DVD" is displayed and wait until Windows finishes loading files.
Install Windows appears with language and regional options. Select your keyboard layout from the Keyboard or input method combo box and click Next.
Click Repair your computer in the next screen.
Windows setup tries to locate an existing installation, just stand by.
Because Windows XP and Windows 7 use different methods for booting, an error message stating "Windows found problems with your computer's startup options" appears. Always click No here, otherwise you might make your Windows XP unbootable!
Select the Use recovery tools that can help fix problems starting Windows option and click Next.
Click Command Prompt in the recovery tools selection window.
In the Command Prompt window, type diskpart and press Enter.
The following commands work for both volumes and disks, just replace "volume" with "disk" to make a disk writable.
To see a list of all available volumes, type list volume and press Enter. Find the problematic volume by its size and file system (unformatted volumes have "RAW" written in the Fs column). Note the number of the volume. In this case, the number is 4.
Now type select volume <the number of volume you need to change> and press Enter. For example, select volume 4.
Then run the attributes volume command and verify the volume is set Read-only.
Finally, type attributes volume clear readonly and press Enter. This will make the volume writeable.
You might want to repeat the same process for other volumes or disks. When finished, run the exit command to return to Command Prompt.
Close the Command Prompt window and click Restart back in the System Recovery Options window. Remove the Windows 7 DVD from the drive.
That's it - Windows XP should now be able to initialize and format the disk as shown in the Disk Management in Windows article.