打印

devicemapper: Error running deviceCreate (createSnapDevice) dm_task_run failed

devicemapper: Error running deviceCreate (createSnapDevice) dm_task_run failed

最近听到太多太多关于断电的事故了!这不,我也给碰上了,由于电源问题,导致主服务器当机了,在接上电源后再进行启动后,发现Docker容器启动时出现问题
连最基本的 docker run hello-world 都报错:
docker: Error response from daemon: devicemapper: Error running deviceCreate (createSnapDevice) dm_task_run failed.

检查镜像列表是正常
# docker images

看来是文件系统相关的由于断电受破坏了,于是我先进行停止 Docker 服务
# systemctl stop docker.service

然后进行 metadata 检查,果真发现了一堆错误了
# cd /var/lib/docker/devicemapper/devicemapper
# thin_check metadata
examining superblock
examining devices tree
examining mapping tree
  missing all mappings for devices: [0, -]
    value size mismatch: expected 8, but got 24.  This is not the btree you are looking for.

加上 --clear-needs-check-flag 参数再查查看
# thin_check --clear-needs-check-flag metadata
examining superblock
examining devices tree
examining mapping tree
  missing all mappings for devices: [0, -]
    value size mismatch: expected 8, but got 24.  This is not the btree you are looking for.

但是,都报错了,只能进行修复看看
# thin_repair [options] -i {device|file} -o {device|file}
thin_repair -i metadata -o metadata
奇怪的是,执行修复命令完成后都没有任何输出!

那就再进行检查一下
# thin_check /var/lib/docker/devicemapper/devicemapper/metadata
examining superblock
examining devices tree
examining mapping tree
checking space map counts

看似没有错误了,然后再进行启动 Docker 服务,按理说应当可以欢天喜地吃阳澄湖大闸蟹了
# systemctl start docker.service

再进行
# docker run hello-world
docker: Error response from daemon: devicemapper: Error running deviceCreate (createSnapDevice) dm_task_run failed.

但是仍是不行,于是我直接进行检查data
# thin_check data
examining superblock
  superblock is corrupt
    bad checksum in superblock

完蛋完蛋了,文件校验出错了!

于是我想尝试修复data
# systemctl stop docker.service
thin_repair -i data -o data
truncating metadata device to 4161600 4k blocks
bad checksum in superblock
看来无解啊!

详细记录如下:
# systemctl status docker.service -l
* docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2017-10-10 02:05:48 CST; 1min 56s ago
     Docs: https://docs.docker.com
  Process: 4403 ExecStart=/usr/bin/dockerd (code=exited, status=1/FAILURE)
Main PID: 4403 (code=exited, status=1/FAILURE)

systemd[1]: Starting Docker Application Container Engine...
dockerd[4403]: time="2017-10-10T02:05:47.656007859+08:00" level=info msg="libcontainerd: new containerd process, pid: 4411"
dockerd[4403]: time="2017-10-10T02:05:48.846004432+08:00" level=error msg="devmapper: Unable to delete device: devicemapper: e dm_task_run failed"
dockerd[4403]: time="2017-10-10T02:05:48.846276825+08:00" level=warning msg="devmapper: Usage of loopback devices is strongly n use. Please use `--storage-opt dm.thinpooldev` or use `man docker` to refer to dm.thinpooldev section."
dockerd[4403]: time="2017-10-10T02:05:48.859958933+08:00" level=error msg="[graphdriver] prior storage driver devicemapper evice UUID and Filesystem verification failed: devicemapper: Error running deviceCreate (ActivateDevice) dm_task_run failed"
dockerd[4403]: Error starting daemon: error initializing graphdriver: devmapper: Base Device UUID and Filesystem verification or running deviceCreate (ActivateDevice) dm_task_run failed
systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
systemd[1]: Failed to start Docker Application Container Engine.
systemd[1]: Unit docker.service entered failed state.
systemd[1]: docker.service failed.


# journalctl -xe
-- Unit session-1.scope has finished starting up.
--
-- The start-up result is done.
systemd[1]: Starting Session 1 of user root.
-- Subject: Unit session-1.scope has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-1.scope has begun starting up.
sshd[1742]: pam_unix(sshd:session): session opened for user root by (uid=0)
dbus[776]: [system] Activating service name='org.freedesktop.problems' (using servicehelper)
dbus-daemon[776]: dbus[776]: [system] Activating service name='org.freedesktop.problems' (using servicehelper)
dbus[776]: [system] Successfully activated service 'org.freedesktop.problems'
dbus-daemon[776]: dbus[776]: [system] Successfully activated service 'org.freedesktop.problems'
fprintd[1688]: ** Message: No devices in use, exit
systemd[1]: Time has been changed
-- Subject: Time change
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The system clock has been changed to REALTIME microseconds after January 1st, 1970.
polkitd[788]: Registered Authentication Agent for unix-process:1807:9161 (system bus name :1.54 [/usr/bin/pkttyagent --notify-path /org/freedesktop/PolicyKit1/AuthenticationA
systemd[1]: Starting Docker Application Container Engine...
-- Subject: Unit docker.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has begun starting up.
dockerd[1813]: time="2017-10-10T02:06:32.331726432+08:00" level=info msg="libcontainerd: new containerd process, pid: 1823"
dockerd[1813]: time="2017-10-10T02:06:33.411882247+08:00" level=warning msg="devmapper: Usage of loopback devices is strongly n use. Please use `--storage-opt dm.thinpooldev`
kernel: device-mapper: table: 253:3: thin: Couldn't open thin internal device
kernel: device-mapper: ioctl: error adding target to table
dockerd[1813]: time="2017-10-10T02:06:33.425302736+08:00" level=error msg="[graphdriver] prior storage driver devicemapper evice UUID and Filesystem verification failed: devi
dockerd[1813]: Error starting daemon: error initializing graphdriver: devmapper: Base Device UUID and Filesystem verification or running deviceCreate (ActivateDevice) dm_task
systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
systemd[1]: Unit docker.service entered failed state.
systemd[1]: docker.service failed.
polkitd[788]: Unregistered Authentication Agent for unix-process:1807:9161 (system bus name :1.54, object path /org/thenticationAgent, locale en_US) (disconnected from bus)
chronyd[817]: Forward time jump detected!
chronyd[817]: Can't synchronise: no selectable sources

看来得重新搞一套环境才行了
简单就是美!
我的Java:http://www.Java2Class.net

TOP