Blog Navigation
Partners
Latest Activity
Phil gives the source code for implementing a MySQL singleton class in both PHP and Python.
Posted on: March 11th, 2010 by Famous Phil
For all of you who have no clue what single user mode is, it is a recovery environment for Linux based servers. Single user mode allows for the system administrator account (root) to login via the local server (the console) to fix problems that prevent the server from coming up normally.
Single user mode can be triggered by a lot of factors, but there are two huge factors that can cause this. One is when the system’s drive information file (fstab) becomes inconsistent with the server’s configuration. The other time when a system will boot into this mode is when a file system is found to have errors on it. Linux automatically checks its file system occasionally on boot, which is why single user mode may occur without much notice (that is if the check can’t quickly fix the problem on its own).
Single user mode presents only the root file system (/) to the root user after login and this file system has only read access. This is to allow for file system checking since this mode is used commonly for running file system checks and repairs. If your file system becomes corrupt, the last thing you want is for your computer to write to the file system and lead to further corruption. The admin must mount the file system as read write in order to modify anything on the drive.
I’ve been in single user mode twice now for neglecting to verify all the information in the fstab file. My first time in single user mode was not fun and I ended up using a Ubuntu live cd to fix the problem since I didn’t have enough patience to look up the command. After my first time, I looked up the command in case I ever needed to enter single user mode again. This effort paid off since I knew that I would be rebooting one of the servers a little earlier that had significant edits to the fstab file. Although I was certain I didn’t make any mistakes, I didn’t check for duplicate entries. This caused the server to boot into single user mode. My job was to simply remove the duplicated line and reboot the server. Since I can never remember the command, I decided to write this blog. Remember this is a Centos 5.4 server running CPanel.
The command is: mount -n -o remount /
That command will mount the root file system (/) as a writable file system, thus allowing for a text editor such as vi to write edits back to the file system. I simply used vi to remove the duplicated line in the /etc/fstab file and rebooted and the server is back up. Hopefully I won’t see another time of single user mode, but as an admin, I’ve grown to expect stuff like this. I thought I would share the command so I don’t ever get lost again trying to find it
Tags: mount, single user mode, write
Posted in Hosting / Server Administration
|| 1 Comment »