How to change location where logs are stored?
Solution 1:
sudo /etc/init.d/rsyslog stop
sudo mv /var/log /mnt/d2/
sudo ln -s /mnt/d2/log /var/log
sudo /etc/init.d/rsyslog start
You might want to go ahead and reboot the machine, while you're at it, just in case you have something other than rsyslogd
busily trying to write to logs under /var/log - those won't recover until they're restarted as well, which just bouncing the whole box will accomplish nicely.
What we're doing here is, instead of trying to reconfigure everything that might possibly want to write to /var/log, instead just gently redirecting things going there to your other disk. You can still cd /var/log
or less /var/log/syslog
or whatever and have it work just fine, this way, and any new programs that try to log to directories under /var/log directly rather than working through rsyslogd
will also still work as expected.