How to clean your Ubuntu server disk on DigitalOcean

Ubuntu Server No Comments

1. Delete Journal records:

journalctl --disk-usage
sudo journalctl --rotate
sudo journalctl --vacuum-time=2days
sudo journalctl --vacuum-size=100M
sudo journalctl --vacuum-files=5
sudo -H gedit /etc/systemd/journald.conf
systemctl daemon-reload

2. Check for heavy files and then clean:

sudo du -a / 2>/dev/null | sort -n -r | head -n 20
sudo apt-get autoremove
sudo du -sh /var/cache/apt
sudo apt-get autoclean
sudo find / -xdev -type f -size +100M //Command to check files greater than 100MB.
SET GLOBAL binlog_expire_logs_seconds = 3;  //Command in Mysql 
expire-logs-days=3
PURGE BINARY LOGS TO 'binlog.000113';  //Command in Mysql

 

4 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments