SQL Server Error – The media is Write Protected

Recently shut down my SQL Server cluster for maintenance. When I powered on the server and performed healthchecks, I noticed that the SQL Server instance was not started. Tried starting the service and it failed.

Investigated the logs and saw the below error in the logs:

The media is write protected on F:\…….

ReadOnlyDisk#1

Weird. Opened Disk Management and looked at the disks associated with this particular instance. As you can see below, the disk shows as Read Only.

ReadOnlyDisk#2

Solution:

The easiest solution to resolve this is to use DiskPart and clear the Read Only attribute.

Open Powershell as an administrator and run the following commands:

DISKPART

SELECT DISK 2

Where the Disk Number matches the disk number in Disk Manager.

Attributes disk

You will see that the option under Read-Only is Yes.

Attributes disk clear readonly

Attributes disk

You will see that the option under Read-Only is now No.

ReadOnlyDisk#3

Now that the disk is read/writeable, the SQL Server service will now start.

Cause:

The hardware provider in our case had set the disks to read-only on the SAN causing this issue.