0

A while ago I acquired a small cloud server that is running cloudlinux. I have realized that my disk space is filling up so I ran a command to see which folders or files occupy the most space and this is the list:

1.1G    /usr/tmpDSK
447M    /var/log/btmp-20200401
298M    /var/log/btmp
273M    /var/log/chkservd.log
141M    /var/log/secure-20200329
138M    /var/log/secure-20200406
124M    /var/log/secure-20200419

I don't have much Linux knowledge yet, so I don't know if I can alter some of these files without causing any problems in the system. Should I do this, or look for the cause of the full disk somewhere else?

Dave M
  • 4,494
max
  • 101

2 Answers2

0

Whether a file can be deleted depends on the applications which use that file. Thus there is no universal answer. The search engine of your choice should tell you which service is writing to a certain file.

But in general (not without exception, e.g. Postgres) you can delete everything in /var/log.

If you are unsure then you may use stat for checking the last read (atime) and write (access) times and fuser for checking whether the file is currently opened by any process.

Hauke Laging
  • 5,415
0

The problem you faced is pretty common. [rosehosting]


Disk usage analysis.

There are several ways to analyze disk usage. If you want to see your disk usage, take a look at the following topics:

df -h
du -sh ./*
  • You can install a special tool, called ncdu.

Log rotation.

You can remove old files, but do it carefully. It may cut forensics possibilities or even break your system. Moreover, it will not solve the root-cause.

limakzi
  • 321