0

I recently had a problem with a dedicated server (LINUX) where the file system went read-only.

Recent modifications include installation of fcgid using PHP 5,2 on certain <VirtualHost> accounts.

The system wide PHP is PHP 5.3

I have explored the logs and not been able to find anything that would cause alarm.

Any help/advice would be greatly appreciated.

1 Answers1

5

Usually, if the kernel decides to make one of your filesystems read only, it means that it has detected some critical problem on the filesystem. Often this is caused by a harddisk which is starting to break down and causes IO errors.

Check your dmesg output, by entering sudo dmesg. I think there should be some information about the reasons why the kernel would make your filesystem read only.

replay
  • 3,180
  • 13
  • 16
  • Thank you for your advice I am looking now. A quick scan of dmesg output doesn't seem to show anything alarming. after a fsck the system seems to be running fine. – CodeCryptor Feb 16 '13 at 16:26
  • Usually this message would include the device name, like for example /dev/sda1. So maybe you could grep for it like `dmesg | grep /dev/sda1` – replay Feb 16 '13 at 16:30
  • Did I understand your issue correctly that the filesystem suddenly went read-only while the server was running? Or did it restart and then become read-only? That would be a different case. – replay Feb 16 '13 at 16:31
  • root@cdn1:~# dmesg | grep /dev/sda [ 4.129159] Adding 15624992k swap on /dev/sda2. Priority:-1 extents:1 across:15624992k – CodeCryptor Feb 16 '13 at 16:32
  • adding swap is not a critical error – CodeCryptor Feb 16 '13 at 16:34
  • yes, adding swap is no problem. Did I understand it right that the fs went read-only while the machine was running? Or did it reboot and then become read-only? – replay Feb 16 '13 at 16:39
  • is it possible that my PHP 5.2 build may cause this behavior. I installed PHP 5.2 in order to run an encoded PHP script (ZendOptimizer) – CodeCryptor Feb 16 '13 at 16:40
  • It went read-only whilst running. I initiated a reboot from the console and had to contact support in order to regain SSH access – CodeCryptor Feb 16 '13 at 16:42
  • This would be very strange. If you say the fs went read-only, this means it was mounted with the `ro` option, right? The PHP should never have permissions to remount your filesystem, and the way how you build it should also not make it do that. – replay Feb 16 '13 at 16:42
  • Btw you said you rebooted the server after the fs went read-only. Thats the reason why you can't see the error in the output of `dmesg`, because the dmesg buffer gets flushed on reboot. Try to see if your distribution doesn't also write the dmesg output into some logfile like /var/log/dmesg or /var/log/messages. Maybe you could find the error there. – replay Feb 16 '13 at 16:44
  • I was logged into the system via SSH as it is a remote system. When i tried modify files I got error stating read-only filesystem. So then i initiated a reboot #shutdown -t sec now. This did not work immediately and ps aux showed i had man processes apache2/mysql. I issued killall commands on both these processeses then the system tried to reboot. Maybe it was in fsck mode when i was trying to reconnect. I contacted support and requested reboot and fsck. I just want to be aware if there is an underlying problem :) – CodeCryptor Feb 16 '13 at 16:50
  • yes i thought that was the situation with dmesg – CodeCryptor Feb 16 '13 at 16:52
  • Yes, try to see if there is something in the log about the kernel mounting this partition as read-only. If not, maybe the log daemon couldn't write it because the partition was alreayd read only in that moment, then there is no way to trace what happened. If it happens again, it would be better if you check the output of `dmesg` before you restart the server. – replay Feb 16 '13 at 16:52
  • Thank you Replay your advice is well taken. Has aided me in learning a bit more. – CodeCryptor Feb 16 '13 at 16:55