I found myself with a run away disk space problem on my dev centos machine, where something I couldn't locate was filling up the disk, so I figured I needed a script to at least find out which folder was being filled.
The first point of call was to find any oversized files using an alias I set up as bigfiles
...
bash :: bigfiles alias
this helps finding individual culprit big files, but if the problem is lots of small files being created then I need bigfolders
to find oversized folders (i.e. those with big-files, or lots of files summing up to a problem)...
bash :: bigfolders alias
This then gives me clues to find the problem folder.
Another more labour intensive search can be done using a busier looping script as follows.
This bash(4.2) centos linux script is designed to collect folder sizes and poll those folders looking for disk changes, reporting on them as they go.
It must be said - this is not the fastest - maybe due to my bash environment unable to use associative arrays (bash 4.2 isn't capable), so the script needed to store the information in a list that then needed to be scanned each time. (Note, this is hardcoded to the
The difference between this script and a df -k
or du -sh
(or du -h --max-depth=1
) would be that the script pinpoints which folders are changing size (whereas du
would mark the parents of folders as changed as well).
Copy the script into your desired script folder
Run the monitor using the command
bash :: Run command
warningNote, only use this when you are desperate as it will be demanding on the resources
So I was running an opencv.js
process from php and this was creating large numbers of files in the /procs
folder. Restarting apache
Comments
New Comment