Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am running out of space and would like to move my logs to recover some room on my SSD. My question:

  1. I have an SSD (mounted at /) and regular hard-drive (mounted at /mnt/d2). How can I change it so that my logs (all the logs stored in /var/log) are stored somewhere on my other hard-drive (maybe /mnt/d2/var/log)?

Thank you!

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted
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.

share|improve this answer
    
Ah, this is so helpful. Thank you. I thought to potentially do the symlinking, but I got caught up in a mire of symlink subtleties (didn't think to stop rsyslog). –  weirdcanada Nov 23 '12 at 22:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.