Are there any files created and or broadened by the system besides mail and logs?

AFAIK, the only files that are created and/or broadened by the system in default are /var/mail/ files and /var/log/ files (broadened by means of file size).

To cope with that I've redirected `/dev/null on files in these directories.

But are there more files besides mail and logs that I should worry that they'll be created and broadened by the Linux system itself, throughout time?

  • Creating symlinks to /dev/null is probably not enough; you also have to deactivate logrotate. – Hauke Laging Jan 15 '18 at 0:13
  • I smell an XY problem. Why don't you desribe what you want to achieve instead? – Murphy Jan 15 '18 at 9:55
  • What I want to achieve is to save disk space by reducing automatically created data that I don't need, so I try to find out what are the places to look for it, an then truncate these in a suitable way. – Arcticooling Jan 15 '18 at 10:24
  • See, this could be a job for logrotate; instead of deactivating it you can reduce the size and number of files, enable compression (if not already set), or discard old logs altogether. But speaking from my experience the effect may possibly be in a range of few megabytes, you shouldn't expect much more. – Murphy Jan 15 '18 at 11:52

I'd recommend reading up on the Unix filesystem.

The /var/ directory holds frequently changing files. The /etc/ directory holds configurations that don't typically grow too much. the /usr/ directory holds OS files that don't change too much outside of system upgrades. If you have third-party applications running off of /srv/ or /opt/, those directories may grow.

  • As it's a minimal server environment (Ubuntu-Nginx-SSHguard-Postfix-WordPress) with a few sites and no system customizations or third party software I don't think much will change in /var/. I also find /var/log -type f -exec truncate -s 0 {} \; on /var/mail and /var/logs/. – Arcticooling Jan 15 '18 at 9:20

The system updates create new files which may be kept.

  • I only use unattended-upgrades usually, and only for security upgrades. Do you think these changes would probably be significant for a minimal Ubuntu-Nginx-SSHguard-Postfix-WordPress minimal server environment? It's a 5 bucks VPS with 20GB SSD space. Also, I run find /var/log -type f -exec truncate -s 0 {} \; on /var/mail and /var/logs/. – Arcticooling Jan 15 '18 at 9:21
  • @Arcticooling You could delete the files after upgrades. I do not know, though, what the official way is for doing that. – Hauke Laging Jan 19 '18 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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