Removing read only flag from Windows Diskpart Partition tool

I was trying to investigate a failed disk from a RAID array using a USB hard drive dock and Windows 7. The problem was Windows was reporting that the disk was read-only, so it wouldn’t repartition the hard disk.

I opened up diskpart tool in windows (Run As Administrator) and tried to run the clean command, but again it complained that the hard drive was in read-only mode.

Finally, I found the way to remove the read-only flag, so I could wipe the drive, and scan it for bad sectors.

DISKPART> list disk
DISKPART> select disk 2
DISKPART> list part
DISKPART> select part 2
DISKPART> attrib part clear readonly

5 Replies to “Removing read only flag from Windows Diskpart Partition tool”

  1. Felipe OrtegaJanuary 17, 2014 at 9:49 am

    Hello Felipe, please fix sequence of commands so anyone can follow and detonate the system table. Below is the correct sequence:
    >list volume
    >select volume n (where n = the problem volume)
    >attributes disk clear readonly
    >attributes volume clear readonly

    If anyone has followed the steps and lost table system can be bypassed using program MiniTool Partition Recovery

  2. felipeJanuary 17, 2014 at 1:45 pm

    My apologies to those that have corrupted or lost their data. I have removed the ‘clean’ line.

  3. JitendraFebruary 16, 2015 at 10:01 pm

    I tried,
    attributes disk clear readonly
    error was diskpart failed to clear disk attributes

    after clean, create partition primary
    error was Disk is write protected

  4. Nick CFebruary 4, 2016 at 2:29 am

    If you select a “volume” then ask it to clear a “disk”, that may be the problem. After having the same failure trying to clear the “disk”, I had success when I entered, “attributes volume clear readonly”.

Leave a Comment