chadoe/docker-cleanup-volumes

If you get "recursive directory loop", you might have to just delete the volume

jamshid opened this issue · 0 comments

FYI I ran your dockerized script but it kept outputting the below "grep" warning about "recursive directory loop". Probably nothing for you to do as a fix, just posting in case other users see the error.

Deleting the volume mentioned in the message fixed the problem for me -- it was an old volume for jenkins.

Below are my steps. I first ran "docker-machine ssh dev" to access my docker server. It's a virtual box / boot2docker machine on my macbook, continuously upgraded from ~1.6 to 1.9.1.

root@dev:/mnt/sda1/var/lib/docker# docker version
Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.3
 Git commit:   a34a1d5
 Built:        Fri Nov 20 17:56:04 UTC 2015
 OS/Arch:      linux/amd64

Server:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.3
 Git commit:   a34a1d5
 Built:        Fri Nov 20 17:56:04 UTC 2015
 OS/Arch:      linux/amd64

root@dev:/mnt/sda1/var/lib/docker# docker run -v /var/run/docker.sock:/var/run/docker.sock -v $(readlink -f /var/lib/docker):/var/lib/docker --rm martin/docker-cleanup-volumes --dry-run
...
grep: warning: /var/lib/docker/volumes/0eb33134d5df1f8c88afd051fe4725c0bc53d8f6e3068ce3f64edd8ca4f4a144/_data/sys/class/power_supply/AC/device/subsystem/devices/LNXVIDEO:00/input/input6/subsystem/event6/device/device/subsystem/devices/0000:00:0d.0/ata1/ata_port/ata1/subsystem/ata5/device/host4/subsystem/devices/host25/scsi_host/host25/subsystem/host0/device/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/subsystem/1:0:0:0/device/block/sda/sda1/subsystem/loop3/bdi/subsystem/7:2/subsystem: recursive directory loop

That does seem like a weird directory:

root@dev:/mnt/sda1/var/lib/docker# ls -l /var/lib/docker/volumes/0eb33134d5df1f8c88afd051fe4725c0bc53d8f6e3068ce3f64edd8ca4f4a144/_data/sys/class/power_supply/AC/device/subsyste
m/devices/
total 80
lrwxrwxrwx    1 root     root            63 Sep  4 04:11 ACPI0003:00 -> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/ACPI0003:00
...

That particular volume appears to be for my Jenkins container (/var/lib/jenkins) from a few months ago. Deleting (rm -rf /var/lib/docker/volumes/0eb33134d5df1f8c88afd051fe4725c0bc53d8f6e3068ce3f64edd8ca4f4a144) it allowed your script to run correctly.