As I am running low on disk space on the root partition, I checked with du what was taking all that space, and I found that /root/.esmtp_queue is taking a lot of space (around 20GiB). These seem to be reports from commands executed in the past. Also, /var/cache has grown quite large. (7GiB) Is it safe to
rm -rf these folders, or will something break?
/root/.esmtp_queue is a mail queue. Have you checked what the mail is about? Maybe you can turn off whatever is generating all those messages.
Yes, the mails contain several logs of programs, like
rkhunter. However, they date back until the creation of the system (3 years ago). Is there a way I can delete those old messages?
(Notably, the command
mail displays “No mails for root”.)
These are outgoing messages which failed to send. I removed them, and have not seen negative impact yet.
It is safe to delete in the sense that it won’t harm your system’s stability to do so, but if you care about what’s in it, you might consider archiving it to a USB stick, etc., first.