Why does Linux sometimes mark drives read-only?


A read-only condition on a Linux hard drive is either induced by a hardware or software issue (of course).

Hardware
As a hardware issue, the OS has marked the drive read-only due to a sector read / write error or a sense error between the controller and drive.
In the cause of a bad sector, the drive attempts to move the bad sector to a recovery area.
When the drive has to many bad sectors and data can not be moved to a recovery area, errors are logged and the drive should be replaced.
Sense errors are a signal error on the SATA or SAS bus that has been logged.
If they happen in large numbers (hundreds), the drive, cabling and or controller should be replaced. I’ve seen less then ten in years, they are rare.

Software
As a software issue, the OS has marked the drive read-only due to a file system structure corruption that is caused by one of the following conditions –
– a job that was killed with open file(s) on write,
– a software utility not correctly flushing buffers and closing file(s) on write,
– an incorrect server power off during writes,
– a server hang or job hang during writes.

Usually, these conditions happen more when new job(s) or software is being developed. Or, modifications to existing job(s) or software is first being tested. Sometime, new tool(s) in the environment induce issues. Each of these areas is a good place to start investigating what software maybe the root cause.

Isolating if the problem is hardware or software
A review of the DSA log, Linux System, Boot and Dmesg logs clearly shows if the read-only state was induced by a hardware or software issue.

Correcting read-only software errors
Modify column six in /etc/fstab to enable a filesystem structure check & repair on server reboot
This will cause the filesystem to mount in a read/write state after repairs succeed
If filesystem structure repair fails, this will be noted in the Linux logs.

Leave a comment