CentOS Docker安装No space left on device失败
在使用centos/7安装Docker的时候,因为磁盘满了引发No space left on device导致安装失败。
按Docker官网给出的命令安装时,报错 rpmdb open failed ;
C:\Users\zy>vagrant ssh
Last login: Sun Nov 14 12:39:52 2021 from 10.0.2.2
[vagrant@localhost ~]$ sudo yum install -y yum-utils \
> device-mapper-persistent-data \
> lvm2
error: db5 error(28) from dbenv->open: No space left on device
error: cannot open Packages index using db5 - No space left on device (28)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:
Error: rpmdb open failed
按报错百度大概就两个解决方案: 1、将原rpmdb文件都更名为结尾带.bak的文件 2、重建rpm数据库 https://www.jianshu.com/p/c531e28de195
方法2是比较有用的;
在重建rpm数据库的时候又因为磁盘满了而失败,错误信息:No space left on device
[vagrant@localhost ~]$ rpm --rebuilddb
error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied)
[vagrant@localhost ~]$ su
Password:
[root@localhost vagrant]
error: failed to create directory /var/lib/rpmrebuilddb.958: No space left on device
因为是头一次玩就很迷惑,csdn一些老哥的经验;是要去看磁盘和inode
df -h 后能直接看到 /dev/sda1 路径下已经100%了;
[root@localhost vagrant]
Filesystem Size Used Avail Use% Mounted on
devtmpfs 237M 0 237M 0% /dev
tmpfs 244M 0 244M 0% /dev/shm
tmpfs 244M 4.5M 240M 2% /run
tmpfs 244M 0 244M 0% /sys/fs/cgroup
/dev/sda1 40G 40G 148K 100% /
tmpfs 49M 0 49M 0% /run/user/1000
我为了简单操作,直接进入根目录下# du -h --max-depth=1 ;能看出占用空间最大的文件夹
[root@localhost dev]
[root@localhost /]
0 ./dev
du: cannot access ‘./proc/2014/task/2014/fd/3’: No such file or directory
du: cannot access ‘./proc/2014/task/2014/fdinfo/3’: No such file or directory
du: cannot access ‘./proc/2014/fd/4’: No such file or directory
du: cannot access ‘./proc/2014/fdinfo/4’: No such file or directory
0 ./proc
4.5M ./run
0 ./sys
32M ./etc
36K ./root
61M ./var
0 ./tmp
829M ./usr
27M ./boot
20K ./home
0 ./media
0 ./mnt
0 ./opt
0 ./srv
37G ./vagrant
40G .
[root@localhost /]
再进入占用空间最大的 /vagrant 文件夹下(注意最下面的40G说的是总大小)
随后不断使用上述的# du -h --max-depth=1 指令;找到占满磁盘的文件;谨慎删除;
删除后重试重建数据库,成功;
[root@localhost Application Data]
[root@localhost /]
[root@localhost rpm]
[root@localhost rpm]
[root@localhost rpm]
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
重新安装,成功;
[vagrant@localhost ~]$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.dgut.edu.cn
* updates: mirrors.dgut.edu.cn
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/4): base/7/x86_64/group_gz | 153 kB 00:00:00
(2/4): extras/7/x86_64/primary_db | 243 kB 00:00:01
(3/4): base/7/x86_64/primary_db | 6.1 MB 00:00:02
(4/4): updates/7/x86_64/primary_db | 12 MB 00:00:44
Resolving Dependencies
--> Running transaction check
...
...
...
Dependency Updated:
device-mapper.x86_64 7:1.02.170-6.el7_9.5 device-mapper-libs.x86_64 7:1.02.170-6.el7_9.5
Complete!
[vagrant@localhost ~]$
参考: 1、linux磁盘满了怎样清理 2、无法从 /var/lib/rpm 打开软件包数据库 3、使用yum时出现Error: rpmdb open failed解决方案
|