System incorrectly mounts /var as read-only

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6

Issue

  • root filesystems (including /var) are on internal drive, and all except /var are mounted as RW.
  • /var mounted as read-only

Resolution

  • If a reboot and fsck cannot be performed, attempt to clear read-only flag with "hdparm -r 0 /var" and remount.
  • If this does not work, a reboot and fsck may still be required.
  • Identification of the 'root cause' of the 'read-only' flag being set is highly recommended. A possible cause is that the kernel will flag a file system 'read only' when it detects serious I/O errors.

Diagnostic Steps

[root@localhost /]\# grep /var /etc/fstab  
/dev/vg00/varvol01 /var ext3 nosuid,nodev 1 2  

[root@localhost /]\# mount -o remount,rw /var  
mount: block device /dev/vg00/varvol01 is write-protected, mounting read-only  

[root@localhost /]\# pvdisplay  
Locking type -1 initialisation failed.

Attempt to run hdparm -r 0 /var against the filesystem. This should remove the read-only flag that has been set against it.

Setup remote logging for RHEL 5 and below or for RHEL 6. If the issue occurs again, gather remote logs to see if we can determine if the filesystem is experiencing a read-only event.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments