Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: /var is full  (Read 3423 times)

0 Members and 1 Guest are viewing this topic.

lathu_official

  • Guest
/var is full
« on: January 02, 2014, 01:46:27 pm »
If you have a /var partition, and if that partition is too small it may fill up quickly.  If you want to move the data which is stored in "/var" to another partition, run the following:

cd /var
du | sort -n


This will give you a full readout of all the directories that are using the most space.  The directory using the most disk space will appear at the bottom of the list.

One common culprit is mysql (/var/lib/mysql on Redhat).  To move that path to another partition, run the following:

cd /home
mkdir mysql
chown mysql:mysql mysql
cd mysql

perl -pi -e 's/mysqld=ON/mysqld=OFF/' /usr/local/directadmin/data/admin/services.status
/sbin/service mysqld stop

cp -Rp /var/lib/mysql/* .
cd /var/lib
mv mysql mysql_old
ln -s /home/mysql ./mysql

/sbin/service mysqld start
perl -pi -e 's/mysqld=OFF/mysqld=ON/' /usr/local/directadmin/data/admin/services.status

#once satisfied that mysqld is running and functioning correctly, remove the old data:

rm -rf mysql_old


You can also specify a new socket path in the file:

/usr/local/directadmin/conf/mysql.conf

if you want, but shouldn't be required if you've correctly created the symbolic link with the above "ln -s" command.

--------

Thanks.