2

Running services are filling up disk space. I reboot it frees up disk space. How can I find files created by programs in disk space but not visible with the "du -ch /.[!.]* /disk1" command.

$ df -Th

/dev/mapper/ubuntu--vg-ubuntu--lv        ext4       15G  9.5G  3.9G  71% /
/dev/xvdb1                               ext4      361G  333G   11G  97% /disk1

$ du -sh /disk1

203G /disk1/

Ubuntu 18.04.3 LTS The server is a virtual on xenserver. Two virtual disks named root and disk1 are attached. /disk1 size is 366GB but the file size is 205GB. The remaining 161GB space appears to be full, only 10GB of free space is available. More than one apache and special services running on this disk are working by showing this disk. But after a while the disk space gets full.

Ens
  • 31
  • 1
    Read man lsof. Use sudo lsof to list all open files, and their sizes. – waltinator Oct 13 '21 at 17:14
  • I don’t think that opened files add much disk usage. Theoretically, we can open a file, unlink it, and the disk size is reported by df until the file is closed, but can’t be reported by du. It is often quite temporary. (Excepted when you update your system : all loaded old shared objects and programs remain on the disk, but are no visible to du since they are replaced by a new one.) – Frédéric Loyer Oct 13 '21 at 17:29
  • We use java in more than one service inside. Could it be that these java services are deleting files but not completely removing them from disk space? By the way, java services are atlassian jira,confluence,bitbucket,sonarqube,tomcat,nexus,bamboo,fecru,crowd etc. services. – Ens Oct 13 '21 at 17:41
  • Restarting the server frees up 142 GB of available space. How can I expose this problem? – Ens Oct 13 '21 at 21:32
  • One quite likely possibility is that there are deleted files that are still opened by other programs. unix will remove a filename from a directory when it is deleted but not actually return the disk space it uses until the last process that had the file open gets around to closing it. This is a feature, not a bug (e.g. it allows log files to be rotated before telling the process to close and re-open them - e.g. by sending them a HUP signal). Do the service(s) you're running support that? Are they buggy crap that just lose track of what file handles they have open? – cas Oct 14 '21 at 06:50
  • actually the problem is not the outputs of the df and du commands. whether the files in a directory are displayed correctly when using them by programs, and if the program is using a file, you can see the total size of that file on the disk. To solve this problem, is it necessary to restart the server every time, even though the disk is not really full? – Ens Oct 14 '21 at 10:37

0 Answers0