1、使用df -h
[root@localhost /]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 912M 0 912M 0% /dev
tmpfs 919M 4.0K 919M 1% /dev/shm
tmpfs 919M 8.5M 911M 1% /run
tmpfs 919M 0 919M 0% /sys/fs/cgroup
/dev/sda1 40G 24G 17G 59% / # 一开始会发现这里的磁盘已经满了,这里是已经处理过的
tmpfs 184M 0 184M 0% /run/user/1000
2、cd / 然后执行du -sh *,查看哪个文件夹最占空间,每个人的问题可能都不一样
[root@localhost /]# du -sh *
0 bin
27M boot
0 dev
32M etc
20K home
0 lib
0 lib64
0 media
0 mnt
0 opt
du: cannot access ‘proc/2152/task/2152/fd/3’: No such file or directory
du: cannot access ‘proc/2152/task/2152/fdinfo/3’: No such file or directory
du: cannot access ‘proc/2152/fd/3’: No such file or directory
du: cannot access ‘proc/2152/fdinfo/3’: No such file or directory
0 proc
40K root
8.5M run
0 sbin
0 srv
2.0G swapfile
0 sys
0 test_share
0 tmp
829M usr
21G vagrant # 发现vagrant占用了21G ,因为vagrant映射的问题,一启动的时候映射了vagrantFile所在目录下的所有文件
0 vagrant_data
62M var
3、之后删除掉那些文件,
[root@localhost /]# rm -r vagrant
但我这里没法根本的解决问题,因为我使用的vagrant,在启动虚拟机的时候会自动挂载文件,如果全部果删除不知道会不会导致vagrantfile文件无法共享,导致vagrant获取配置的时候失败,待解决。