DEV Community

Cover image for disk_filling
Tim
Tim

Posted on

disk_filling

identify the filling disk

df -h

find the culprit

pipe sort -h will sort by size.

du -h --max-depth=1 /var

Use -x it restricts to only where its ran

zipping and compressing

cat /var/log/solr/solr.log | gzip > /data/solr.log.gz

zip multiple directories into individual files

be careful you are in correct directory….

for i in */; do zip -r "${i%/}.zip" "$i"; done

back up log somewhere with more space

cat /var/log/jboss/server.log.2016-03* | gzip > /usr/bak/server.log.2016-03.gz

zero out the log file without disrupting the process

tar cf - test/ | gzip > test .tar.gz

tar cf - /var/log/jboss/server.log.2016-03* | gzip > /usr/bak/serverlog201603.tar.gz

echo > /var/log/solr/solr.log

delete all files older than 5 days (fix the command to actually use it, ya dope)

find /path/to/files* -mtime +5 -exec 'are em' {} \;

find whats eating up space if root partition /  is eating up space

find / -xdev -size +1000M

nested find, better than du -h -max-depth, less memory intensive

for i in $(find /data/users -mindepth 1 -maxdepth 1 -type d) ; do echo $i && find $i -type f -exec du -x {} \; | awk '{ print $1 }' | paste -sd+ | bc ; done

TODO

  • merge or add notes on LVM
  • merge or add notes on NFS

Top comments (0)