简单记录一下节点重启后docker无法启动的修复记录。
日志提示 Sep 14 15:35:00 uat-w03 dockerd[1787]: Error starting daemon: error initializing graphdriver: devicemapper: Non existing device docker--vg-docker--pool
使用 lvscan 命令检查,磁盘未激活
ACTIVE '/dev/centos/usr' [50.00 GiB] inherit
。。。
inactive '/dev/docker-vg/docker-pool' [494.75 GiB] inherit
理论修复命令
lvchange -ay '/dev/docker-vg/docker-pool'
中间有报错
修复命令
lvremove /dev/docker-vg/docker-pool
可能遇到的报错,一并记录
bad checksum in metadata index block Check of pool docker-vg/docker-pool failed (status:1). Manual repair required!
即需要修复 metadata
运行修复命令 lvconvert --yes --repair '/dev/docker-vg/docker-pool'
提示 WARNING: Not using lvmetad because a repair command was run.
查看进程 ps -ef 发现有 /usr/sbin/lvmetad -f 进程从 上午开始运行,于是 杀死这个 lvmetad 进程
再次执行添加命令 lvchange -ay '/dev/docker-vg/docker-pool'
提示 Error starting daemon: error initializing graphdriver: devmapper: Base Device UUID and Filesystem verification failed: devicemapper: Error running deviceCreate (ActivateDevice) dm_task_run failed
需要执行命令
systemctl stop docker
rm -rf/var/lib/docker/*
Systemctl start Docker
运行命令: vgcreate docker-vg /dev/sdb
(提示 已存在 A volume group called docker-vg already exists.)
运行命令 : lvcreate --type thin-pool -c 256K -l 99%FREE -n docker-pool docker-vg
(提示 成功, Thin pool volume with chunk size 256.00 KiB can address at most 63.25 TiB of data. Logical volume "docker-pool" created.)
运行命令lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 150G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 149.5G 0 part
├─centos-root 253:0 0 49.5G 0 lvm /
├─centos-usr 253:1 0 30G 0 lvm /usr
└─centos-var 253:2 0 70G 0 lvm /var
sdb 8:16 0 500G 0 disk
└─sdb1 8:17 0 500G 0 part
├─docker-vg-docker-pool_tmeta 253:3 0 124M 0 lvm
│ └─docker-vg-docker-pool 253:5 0 494.8G 0 lvm
└─docker-vg-docker-pool_tdata 253:4 0 494.8G 0 lvm
└─docker-vg-docker-pool 253:5 0 494.8G 0 lvm
可能存在的简洁版处理命令备用,即遇到上面问题,直接执行下面的命令重建 docker pool
#!/bin/sh
lvcreate --wipesignatures y -n thinpool docker -l 95%VG -y
lvcreate --wipesignatures y -n thinpoolmeta docker -l 1%VG -y
lvconvert -y --zero n -c 512k --thinpool docker/thinpool \
--poolmetadata docker/thinpoolmeta
\cp docker-thinpool.profile /etc/lvm/profile/docker-thinpool.profile
lvchange --metadataprofile docker-thinpool docker/thinpool
lvs -o+seg_monitor
https://github.com/moby/moby/issues/34343
可能是 device mapper storage-driver 驱动问题,相关 issue 很多,有些 issue 从 2016年开始创建,今年7月才被doker官方维护人员关闭,关闭原因是 device mapper storage-driver 被弃用了,我理解潜台词是建议使用 overlay2 等驱动 ,
其实重点是最后2句,赶紧升级。
https://github.com/moby/moby/issues/21304#issuecomment-660952701
With the device mapper storage-driver being deprecated, I'm closing this issue
https://github.com/moby/moby/issues/30726#issuecomment-277556409
Those instructions mention installing aufs as a storage driver, but on modern kernels (4.4, for example), overlay2 may be a good choice
文章评论