对于使用最小化安装的centos7目录列表,注意链接方式的目录会在统计占用空间时不会算入的;
看看占用空间(链接目录不会出现)
ok到这里,是否你知道每一个大概多少足够了?
这里再看眼使用了几年的普通线上web服务器的目录(ubuntu的)
看看占用空间情况(有mysql,nginx,php)
du -h -d 1 796K ./run 9.4M ./etc 4.0K ./opt 1.2G ./usr 640M ./lib 4.0K ./media 4.0K ./cdrom 172K ./build 5.0M ./tmp 4.0K ./mnt 8.0K ./srv 4.0K ./lib64 9.8M ./bin 272K ./root du: cannot access â./proc/2121/task/2121/fd/4â: No such file or directory du: cannot access â./proc/2121/task/2121/fdinfo/4â: No such file or directory du: cannot access â./proc/2121/fd/4â: No such file or directory du: cannot access â./proc/2121/fdinfo/4â: No such file or directory du: cannot access â./proc/23692/task/23692/fd/26â: No such file or directory du: cannot access â./proc/23692/task/23692/fd/35â: No such file or directory du: cannot access â./proc/23692/task/23692/fd/39â: No such file or directory 0 ./proc 11M ./sbin 16K ./lost+found 264K ./home 86M ./boot 328G ./var 4.0K ./dev 0 ./sys 330G .再看看var中的占用情况(mysql 的data是放在lib中,www是网站与一些相关备份)
ll total 72 drwxr-xr-x 15 root root 4096 Sep 23 02:50 ./ drwxr-xr-x 24 root root 4096 Sep 23 02:45 ../ drwxrwxrwx 3 root root 4096 Sep 25 06:33 backups/ drwxr-xr-x 11 root root 4096 Sep 24 19:04 cache/ drwxrwsrwt 2 root whoopsie 4096 Nov 14 06:25 crash/ drwxr-xr-x 47 root root 4096 Sep 24 19:02 lib/ drwxrwsr-x 2 root staff 4096 Jan 21 2011 local/ lrwxrwxrwx 1 root root 9 Sep 23 02:50 lock -> /run/lock/ drwxrwxr-x 15 root syslog 4096 Nov 19 06:47 log/ drwx------ 2 root root 16384 May 21 2011 lost+found/ drwxrwsr-x 2 root mail 4096 May 21 2011 mail/ drwxrwsrwt 2 root whoopsie 4096 Sep 23 02:44 metrics/ drwxr-xr-x 2 root root 4096 May 21 2011 opt/ lrwxrwxrwx 1 root root 4 Sep 23 02:50 run -> /run/ drwxr-xr-x 5 root root 4096 Sep 23 04:01 spool/ drwxrwxrwt 2 root root 4096 Sep 23 03:04 tmp/ drwxr-xr-x 12 root root 4096 Nov 13 10:30 www/占用空间
/var# du -h -d 1 16G ./lib 9.9G ./log 41G ./backups 4.0K ./opt 4.0K ./local 36K ./spool 16K ./lost+found 4.0K ./mail 17M ./crash 639M ./cache 4.0K ./metrics 262G ./www 4.0K ./tmp 328G .
看看除了mysql外,其它东西占用多
/var# du -h -d 1 /var/lib/ 12M /var/lib/php5 4.0K /var/lib/misc 15G /var/lib/mysql 8.0K /var/lib/update-manager 8.0K /var/lib/sudo 8.0K /var/lib/ureadahead 496K /var/lib/usbutils 20K /var/lib/update-notifier 74M /var/lib/mlocate 12K /var/lib/sgml-base 12K /var/lib/locales 140K /var/lib/ucf 8.0K /var/lib/vim 4.0K /var/lib/update-rc.d 20K /var/lib/initramfs-tools 14M /var/lib/aptitude 52K /var/lib/belocs 4.0K /var/lib/initscripts 4.0K /var/lib/dhcp 4.0K /var/lib/ubuntu-release-upgrader 32K /var/lib/apache2 4.0K /var/lib/git 8.0K /var/lib/logrotate 4.0K /var/lib/landscape 4.0K /var/lib/os-prober 4.0M /var/lib/nginx 12K /var/lib/AccountsService 24K /var/lib/libxml-sax-perl 12K /var/lib/xml-core 8.0K /var/lib/dbus 3.7M /var/lib/apt-xapian-index 4.0K /var/lib/ntpdate 8.0K /var/lib/apparmor 4.0K /var/lib/python 48K /var/lib/nssdb 32M /var/lib/dpkg 146M /var/lib/apt 8.0K /var/lib/pycentral 4.0K /var/lib/plymouth 4.0K /var/lib/libuuid 28K /var/lib/polkit-1 28K /var/lib/pam 8.0K /var/lib/urandom 32K /var/lib/systemd 4.0K /var/lib/insserv 16G /var/lib/
再看眼没用上的阿里去的服务器
[root@lsqvps /]# ll total 96 dr-xr-xr-x. 2 root root 4096 Sep 23 15:55 bin dr-xr-xr-x. 4 root root 4096 Jul 30 2013 boot drwxr-xr-x 5 root root 4096 Sep 24 17:20 data drwxr-xr-x 15 root root 3220 Oct 9 08:39 dev drwxr-xr-x. 61 root root 4096 Oct 9 08:39 etc drwxr-xr-x. 4 root root 4096 Sep 24 17:17 home dr-xr-xr-x. 8 root root 4096 Mar 14 2014 lib dr-xr-xr-x. 7 root root 12288 Sep 23 15:54 lib64 drwx------. 2 root root 16384 Dec 17 2012 lost+found drwxr-xr-x. 2 root root 4096 Sep 23 2011 media drwxr-xr-x. 2 root root 4096 Sep 23 2011 mnt drwxr-xr-x. 2 root root 4096 Sep 23 2011 opt dr-xr-xr-x 87 root root 0 Oct 9 16:39 proc dr-xr-x---. 5 root root 4096 Sep 24 16:56 root dr-xr-xr-x. 2 root root 4096 Sep 23 15:55 sbin drwxr-xr-x. 2 root root 4096 Dec 17 2012 selinux drwxr-xr-x. 2 root root 4096 Sep 23 2011 srv drwxr-xr-x 13 root root 0 Oct 9 16:39 sys drwxrwxrwt. 3 root root 4096 Oct 9 08:39 tmp drwxr-xr-x. 13 root root 4096 Dec 17 2012 usr drwxr-xr-x. 17 root root 4096 Sep 24 16:36 var
[root@lsqvps /]# du -h --max-depth=1 164K ./dev 5.8M ./bin 0 ./sys 4.0K ./mnt 17M ./lib64 39M ./boot 245M ./var 278M ./root 778M ./usr 4.0K ./selinux 63M ./data 9.0M ./sbin du: cannot access `./proc/8146/task/8146/fd/4': No such file or directory du: cannot access `./proc/8146/task/8146/fdinfo/4': No such file or directory du: cannot access `./proc/8146/fd/4': No such file or directory du: cannot access `./proc/8146/fdinfo/4': No such file or directory 0 ./proc 6.6M ./etc 8.0K ./tmp 239M ./lib 4.0K ./opt 4.0K ./media 56K ./home 20K ./lost+found 4.0K ./srv 1.7G .
ok.到这里是不是就可以知道怎么分了呢.
用得足够久.或是看看别人相同的作用服务器.这里就很容易知道怎么分了.
[root@lsqvps /]# du -h --max-depth=1 164K ./dev 5.8M ./bin 0 ./sys 4.0K ./mnt 17M ./lib64 39M ./boot.
原文地址:http://blog.csdn.net/qidizi/article/details/41281029