The probable causes of this issue are as follows:

Diskpart failed to clear disk attributes

You could try the following solutions to resolve the problem:

1] Run the CHKDSK utility

The CHKDSK utility helps in checking for bad sectors in the hard-drive and repairing them. This should be the first step prior to concluding anything about the hardware.

2] Check for a physical write-protection switch on external drives

Some external drives have a physical write-protection switch on them. When the switch is turned ON, you wouldn’t be able to modify the contents of the drive. A personal suggestion would be to exclude external drives while using the Diskpart utility, but if you have to use it, please turn OFF the toggle switch on the external drive.

3] Change the format of the external drive from RAW to something else

The RAW format gets created when certain files in an external drive are corrupt. It could also be caused by a hardware issue, but in that case, we cannot resolve the problem ourselves. In this situation, we would have to format the File System to either FAT or NTFS. Press Win + R to open the Run window and type the command diskpart. In the elevated Command prompt window which follows, type the following commands and press Enter after each one of them to execute it.

Where x is the drive letter of the external drive to be formatted. Once done, you could proceed with whatever you intended to do with the Diskpart command initially.

4] Remove Write protection via Registry

The Registry Editor method could be used to resolve the issue. The procedure to do so is as follows: Press Win + R to open the Run window. Type the command regedit and press Enter to open the Registry Editor window. Navigate to the following path in the Registry Editor:

On the right-pane, double-click on WriteProtect to edit its properties. Change the value of Value Data to 0. Click on OK to save the settings and restart the system. If the above-mentioned solutions don’t work, the cause could be a hardware problem. You could consult a support technician.