Skip to content

Instantly share code, notes, and snippets.

@fduran
Last active November 29, 2022 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fduran/1870527 to your computer and use it in GitHub Desktop.
Save fduran/1870527 to your computer and use it in GitHub Desktop.
Linux making disk space
# www.fduran.com
# disk space usage
df -h
# biggest (10) directories in size (MB)
du -mxS / | sort -n | tail -10
# clean package cache
apt-get clean
# or
yum clean
# ext2, ext3 file systems: reduce default 5% capacity of partition reserved to root (to 1%):
tune2fs -m1 /dev/hda1
# delete files older than 10 days and bigger than 5MB under a dir (/tmp for ex):
find /tmp -mtime +10 -size +5M -exec rm -f {} \;
# compress unused directory
tar cvfz dir.tar.gz dir
# look at /var/log , set up logrotate if too big
# See also http://pastebin.com/fMQL2dWH for low available disk space email alert
# journald space
journalctl --disk-usage
# make space reducing to 500MB or last 2 weeks
journalctl --vacuum-size=500M
journalctl --vacuum-time=2weeks
# settings in /etc/systemd/journald.conf
SystemMaxUse=500M
MaxFileSec=14day
systemctl restart systemd-journald
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment