DevOps

Clean storage on the server

If the storage over filled on the server, the server will stop working automatically. Normally VPS servers has 20 GB of storage, but it could be over filled sometimes if we don’t have a good logging stuff management system.

For example, if we keep the old log files on the server and don’t consider on the files produced automatically by daemon, we will have this kind of issue.

To fix this kind of issue, we need to setup the some proper logging management system on the server and also need to clean the old files periodically.

We can use the following terminal commands to check and clean the storage on the server.

  1. check general disk space
    df -h
  2. check folder size
    du -hx –max-depth=1 /
    du -h -d 1
  3. check tmp size
    df /tmp
  4. clean the tmp files for last 10 days
    find /tmp -ctime +10 -exec rm -rf {} +
    find /tmp -type f -atime +10 -delete

Note: We must reboot the server after clean the storage to get it work properly.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *