du -hx --max-depth=1 /
du –sh /var/cache/apt/archives
du –sh /var/lib/apt/lists
清除記錄
apt-get clean
apt-get autoremove --purge
/usr/share/doc 及 /usr/share/man 的文件, 在 embedded 系統中沒有甚麼大用, 只是佔空間 40幾MB, 就看看如何把它們刪掉
建立 /etc/dpkg/dpkg.cfg.d/01_nodoc
加入如下內容, dpkg 在抓套件時, 就不會抓 doc
path-exclude /usr/share/doc/*
# we need to keep copyright files for legal reasons
path-include /usr/share/doc/*/copyright
path-exclude /usr/share/man/*
path-exclude /usr/share/groff/*
path-exclude /usr/share/info/*
# lintian stuff is small, but really unnecessary
path-exclude /usr/share/lintian/*
path-exclude /usr/share/linda/*
然後執行刪除既有 docfind /usr/share/doc -depth -type f ! -name copyright|xargs rm || true
find /usr/share/doc -empty|xargs rmdir || true
rm -rf /usr/share/man/* /usr/share/groff/* /usr/share/info/*
rm -rf /usr/share/lintian/* /usr/share/linda/* /var/cache/man/*
在 /usr/share/locale 也有一堆用不到的語系資料, 可以用 localepurge 來移除
apt-get install localepurge
增加 /etc/locale.nopurge, 假設只留英語
####################################################
# This is the configuration file for localepurge(8).
####################################################
####################################################
# Uncommenting this string enables removal of localized
# man pages based on the configuration information for
# locale files defined below:
MANDELETE
####################################################
# Uncommenting this string causes localepurge to simply delete
# locales which have newly appeared on the system without
# bothering you about it:
DONTBOTHERNEWLOCALE
####################################################
# Uncommenting this string enables display of freed disk
# space if localepurge has purged any superfluous data:
SHOWFREEDSPACE
#####################################################
# Commenting out this string enables faster but less
# accurate calculation of freed disk space:
#QUICKNDIRTYCALC
#####################################################
# Commenting out this string disables verbose output:
#VERBOSE
#####################################################
# Following locales won't be deleted from this system
# after package installations done with apt-get(8):
en
en_US
en_US.ISO-8859-15
en_US.UTF-8
sudo localepurge
localepurge 會刪除不要的語系, 以後安裝新套件, localepurge 會被啟動, 將不要的刪除, 這樣會讓系統變慢. 最好是用完, 將 localpurge remove. 需要再重裝
如果不需要 X-windows, 相關套件也可以刪去
apt-get remove libx11-6 libx11-data
另外 /var 也有些肥胖, 如果不再安裝套件, 可以刪去內容物, 但是路徑要留下來
sudo find /var/cache/apt/ -type f -exec rm -v {} \;
sudo find /var/lib/apt/lists -type f -exec rm -v {} \;
沒有留言:
張貼留言