(101主机[root@server1 ~]#172.25.254.101,201主机[root@client1 ~]#172.25.254.201)
1、今天在client1端从101主机远程复制文件时报错No space left on device:
[root@client1 Desktop]# scp root@172.25.254.101:/root/Desktop/* .
The authenticity of host '172.25.254.101 (172.25.254.101)' can't be established.
ECDSA key fingerprint is 8c:6d:89:99:61:05:85:fc:d3:cd:84:01:19:6c:55:30.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.25.254.101' (ECDSA) to the list of known hosts.
root@172.25.254.101's password:
file1 100% 0 0.0KB/s 00:00
file10 100% 0 0.0KB/s 00:00
file2 100% 0 0.0KB/s 00:00
file3 100% 0 0.0KB/s 00:00
file4 100% 0 0.0KB/s 00:00
file5 100% 0 0.0KB/s 00:00
file6 100% 0 0.0KB/s 00:00
file7 100% 0 0.0KB/s 00:00
./file8: No space left on device
./file9: No space left on device
[root@client1 Desktop]# ls
file1 file10 file2 file3 file4 file5 file6 file7
2、由于那两条报错,只复制过来了8个文件,本来要复制10个文件。
df查看空间发现/dev/vda2已经满了??client1这台主机才刚刚搭建的。
[root@client1 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/vda2 6.1G 6.1G 124K 100% /
devtmpfs 489M 0 489M 0% /dev
tmpfs 498M 80K 497M 1% /dev/shm
tmpfs 498M 7.0M 491M 2% /run
tmpfs 498M 0 498M 0% /sys/fs/cgroup
3、没办法,使用命令查看根下哪个目录占用空间比较大
tip:关于--max-depth=1的用法参考Linux下查看文件和文件夹大小
[root@client1 ~]# du -h --max-depth=1 /
80K /dev
du: 无法访问"/proc/3333/task/3333/fd/4": 没有那个文件或目录
du: 无法访问"/proc/3333/task/3333/fdinfo/4": 没有那个文件或目录
du: 无法访问"/proc/3333/fd/4": 没有那个文件或目录
du: 无法访问"/proc/3333/fdinfo/4": 没有那个文件或目录
0 /proc
7.0M /run
0 /sys
33M /etc
3.9M /root
44K /tmp
74M /var
2.8G /usr
91M /boot
3.5M /home
0 /media
3.1G /mnt
0 /opt
0 /srv
6.0G /
4、发现/usr/和/mnt/目录下有问题,根目录一共7G,他俩就基本占用完了
进入这个目录发现一个3.1G大的目录,才记起来在做远程复制file这10个文件之前我还在101主机向201主机用scp -r /etc/ root@172.25.254.201:/mnt命令远程上传过的/etc目录
[root@client1 /]# cd /mnt/
[root@client1 mnt]# ls
etc
[root@client1 mnt]# du -sh etc/
3.1G etc/5、但是在101主机查看/etc目录只有33M,上传到201主机/mnt目录下却变成了3.1G
[root@server1 Desktop]# du -sh /etc/
33M /etc/6、在201主机继续查看/mnt/etc下到底那个文件最大
[root@client1 etc]# du -h --max-depth=1 /mnt/etc/
300K /mnt/etc/fonts
28M /mnt/etc/X11
2.2M /mnt/etc/pki
52K /mnt/etc/rpm
272K /mnt/etc/ssh
12K /mnt/etc/prelink.conf.d
56K /mnt/etc/lvm
0 /mnt/etc/cron.weekly
0 /mnt/etc/gss
20K /mnt/etc/java
12K /mnt/etc/avahi
0 /mnt/etc/jvm
16K /mnt/etc/samba
0 /mnt/etc/jvm-commmon
0 /mnt/etc/maven
16K /mnt/etc/audit
20K /mnt/etc/cron.daily
64K /mnt/etc/logrotate.d
192K /mnt/etc/dbus-1
4.0K /mnt/etc/my.cnf.d
32K /mnt/etc/iproute2
12K /mnt/etc/rsyslog.d
36K /mnt/etc/yum
8.0K /mnt/etc/ntp
0 /mnt/etc/binfmt.d
76K /mnt/etc/profile.d
0 /mnt/etc/modules-load.d
12K /mnt/etc/tmpfiles.d
304K /mnt/etc/systemd
5.8M /mnt/etc/udev
8.0K /mnt/etc/alsa
148K /mnt/etc/bash_completion.d
0 /mnt/etc/opt
0 /mnt/etc/pm
12K /mnt/etc/skel
444K /mnt/etc/sysconfig
212K /mnt/etc/xdg
0 /mnt/etc/xinetd.d
148K /mnt/etc/libreport
0 /mnt/etc/terminfo
12K /mnt/etc/default
24K /mnt/etc/ld.so.conf.d
13M /mnt/etc/selinux
4.0K /mnt/etc/hp
16K /mnt/etc/cron.d
4.0K /mnt/etc/openldap
0 /mnt/etc/gnupg
0 /mnt/etc/popt.d
3.1G /mnt/etc/alternatives
3.1G /mnt/etc/
7、进入最大的目录查看是哪些文件作祟: [root@client1 ~]# cd /mnt/etc/alternatives/ [root@client1 alternatives]# ls java keytool.1.gz orbd.1.gz servertool.1.gz java.1.gz ld pack200 tnameserv jre libnssckbi.so.x86_64 pack200.1.gz tnameserv.1.gz jre_1.7.0 mkisofs rmid unpack200 jre_exports mkisofs-mkhybrid rmid.1.gz unpack200.1.gz jre_openjdk mkisofs-mkhybridman rmiregistry jre_openjdk_exports mkisofs-mkisofsman rmiregistry.1.gz keytool orbd servertool8、去101主机查看这个目录:
[root@server1 Desktop]# cd /etc/alternatives/ [root@server1 alternatives]# du -sh 4.0K . [root@server1 alternatives]# ll 总用量 0 lrwxrwxrwx. 1 root root 14 10月 17 16:07 cdrecord -> /usr/bin/wodim lrwxrwxrwx. 1 root root 30 10月 17 16:07 cdrecord-cdrecordman -> /usr/share/man/man1/wodim.1.gz lrwxrwxrwx. 1 root root 14 10月 17 16:07 cdrecord-dvdrecord -> /usr/bin/wodim lrwxrwxrwx. 1 root root 30 10月 17 16:07 cdrecord-dvdrecordman -> /usr/share/man/man1/wodim.1.gz lrwxrwxrwx. 1 root root 15 10月 17 16:07 cdrecord-readcd -> /usr/bin/readom lrwxrwxrwx. 1 root root 31 10月 17 16:07 cdrecord-readcdman -> /usr/share/man/man1/readom.1.gz . . . 9、发现全是些链接,可见在执行scp -r /etc/ root@172.25.254.201:/mnt命令时scp把/etc/alternatives/目录下的链接所对应的文件都给远程传输过来了既然没有用就删除
10、然后查看系统空间[root@client1 mnt]# rm -rf etc/ [root@client1 mnt]# pwd /mnt
[root@client1 mnt]# df -h文件系统 容量 已用 可用 已用% 挂载点/dev/vda2 6.1G 3.0G 3.1G 50% /devtmpfs 489M 0 489M 0% /devtmpfs 498M 80K 497M 1% /dev/shmtmpfs 498M 6.9M 491M 2% /runtmpfs 498M 0 498M 0% /sys/fs/cgroup
11、记得第3步查出还有一个大文件在/usr目录下,用命令查看:[root@client1 usr]# du -h --max-depth=1 /usr/ 118M /usr/bin 66M /usr/sbin 445M /usr/lib 696M /usr/lib64 1.4G /usr/share 0 /usr/etc 0 /usr/games 36K /usr/include 35M /usr/libexec 12K /usr/local 0 /usr/src 2.8G /usr/
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
445M /usr/lib
696M /usr/lib64
1.4G /usr/share
12、这三个目录占用空间很大,但不知道是什么文件暂时未处理
本文记录了一次在Linux系统中解决因磁盘空间不足导致文件复制失败的问题过程。通过排查发现,问题源于意外的大文件占用及错误的远程文件复制操作。
1万+

被折叠的 条评论
为什么被折叠?



