Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 13452  / 1 Year ago, tue, may 9, 2023, 11:15:40

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!


More From » log

 Answers
5
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.


[#34130] Wednesday, May 10, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mance

Total Points: 198
Total Questions: 105
Total Answers: 128

Location: South Georgia
Member since Mon, Aug 16, 2021
3 Years ago
;