Today, I noticed that the MySQL server on my FreeBSD server is down for unknown reason, and today is Thanksgiving.
Initially, I tried to restart the MySQL server using the following command, but it didn’t help to restart the MySQL:
sudo /usr/local/etc/rc.d/mysql-server restart
and it gives me the following error message:
mysql not running? (check /var/db/mysql/icesquare.com.pid).
That’s interesting. So I check the pid file and I found that it is not available. After scratching my head for a while, I noticed one thing:
df
Filesystem Size Used Avail Capacity Mounted on /dev/ad4s1d 7.7G 7.7G -1M 100% /var
Obviously, the /var directory is full. No wonder why the MySQL could not create any file, which explains why it stopped working.
Since the server is already up and running, it will be too late to increase the size of /var without reinstalling the entire system. The simplest way is to soft link the /var directory to somewhere else. Since a lot of system applications depends on /var, I don’t want to move the entire /var into a different places. So I decide to softlink /var/log into /usr/var/log.
The steps are easy:
sudo su mkdir -p /usr/var/ mv /var/log /usr/var/ ln -s /usr/var/log /var/
To verify your work, it should look something like that:
ls /var
lrwxr-xr-x 1 root wheel 13B Nov 22 11:48 log -> /usr/var/log/
df
Filesystem Size Used Avail Capacity Mounted on /dev/ad4s1d 7.7G 1.1G 6.0G 15% /var
Now, if you try to start the MySQL server again, it may or may not work. If you experience any difficulties, try to reboot the server. After the server is reboot, MySQL should be up and running again.
Lesson learned: Always create single partition. 🙂
–Derrick
Our sponsors: