docker lvm thin pool cleanup
Asked Answered
R

0

8

Scenario: Configured direct-lvm mode for production for docker on my concourse ci system here.

Problem: The thin-pool gets filled up after a while.

df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             16G     0   16G   0% /dev
tmpfs           3.2G  329M  2.9G  11% /run
/dev/xvda2       97G   36G   62G  37% /
tmpfs            16G  656K   16G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            16G     0   16G   0% /sys/fs/cgroup
/dev/xvda1      240M  192M   36M  85% /boot
/dev/dm-3        10G  381M  9.7G   4% /var/lib/docker/devicemapper/mnt/efbc893b77ea9e6e7915d6521571262cd5b60dc1c677bb80fdf2008e066a9d6f
shm              64M  4.0K   64M   1% /var/lib/docker/containers/f0cc48235bb5e641430c2805d565ef20914b4c3e8486595d605840a28b36fd05/shm
/dev/dm-4        10G  477M  9.6G   5% /var/lib/docker/devicemapper/mnt/0ddafb3255270634fdb707634bf2a0a73929abcb28bad416a34fc56e66957c0e
shm              64M     0   64M   0% /var/lib/docker/containers/4283e5b76703273c31a4fd349c61ec5dc852bd28b626a16922292f0e42e01224/shm
/dev/dm-5        10G   10G  108K 100% /var/lib/docker/devicemapper/mnt/dba4634303d2601fd29a183de0db3d44064cdce46ea7a86c9007ef513032f6c8
shm              64M     0   64M   0% /var/lib/docker/containers/ff101ba988b24f2fabe18df4a2733e589ea3be66520aad2a510494bfb8100e1d/shm
tmpfs           3.2G     0  3.2G   0% /run/user/0


lsblk
NAME                                                                                        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
xvda                                                                                        202:0    0  100G  0 disk 
├─xvda1                                                                                     202:1    0  256M  0 part /boot
└─xvda2                                                                                     202:2    0 99.8G  0 part /
xvdb                                                                                        202:16   0    2G  0 disk 
└─xvdb1                                                                                     202:17   0    2G  0 part [SWAP]
xvdc                                                                                        202:32   0  100G  0 disk 
├─docker-thinpool_tmeta                                                                     252:0    0 1020M  0 lvm  
│ └─docker-thinpool                                                                         252:2    0   95G  0 lvm  
│   ├─docker-202:2-2837443-efbc893b77ea9e6e7915d6521571262cd5b60dc1c677bb80fdf2008e066a9d6f 252:3    0   10G  0 dm   /var/lib/docker/devicemapper/mnt/efbc893b77ea9e6e7915d6521571262cd5b60dc1c677bb80fdf2008e066a9d6f
│   ├─docker-202:2-2837443-0ddafb3255270634fdb707634bf2a0a73929abcb28bad416a34fc56e66957c0e 252:4    0   10G  0 dm   /var/lib/docker/devicemapper/mnt/0ddafb3255270634fdb707634bf2a0a73929abcb28bad416a34fc56e66957c0e
│   └─docker-202:2-2837443-dba4634303d2601fd29a183de0db3d44064cdce46ea7a86c9007ef513032f6c8 252:5    0   10G  0 dm   /var/lib/docker/devicemapper/mnt/dba4634303d2601fd29a183de0db3d44064cdce46ea7a86c9007ef513032f6c8
└─docker-thinpool_tdata                                                                     252:1    0   95G  0 lvm  
  └─docker-thinpool                                                                         252:2    0   95G  0 lvm  
    ├─docker-202:2-2837443-efbc893b77ea9e6e7915d6521571262cd5b60dc1c677bb80fdf2008e066a9d6f 252:3    0   10G  0 dm   /var/lib/docker/devicemapper/mnt/efbc893b77ea9e6e7915d6521571262cd5b60dc1c677bb80fdf2008e066a9d6f
    ├─docker-202:2-2837443-0ddafb3255270634fdb707634bf2a0a73929abcb28bad416a34fc56e66957c0e 252:4    0   10G  0 dm   /var/lib/docker/devicemapper/mnt/0ddafb3255270634fdb707634bf2a0a73929abcb28bad416a34fc56e66957c0e
    └─docker-202:2-2837443-dba4634303d2601fd29a183de0db3d44064cdce46ea7a86c9007ef513032f6c8 252:5    0   10G  0 dm   /var/lib/docker/devicemapper/mnt/dba4634303d2601fd29a183de0db3d44064cdce46ea7a86c9007ef513032f6c8
loop0                                                                                         7:0    0 96.7G  0 loop 
loop1                                                                                         7:1    0   10G  0 loop 

Question: How do I properly clean this lvm thin pool setup if docker images & other docker commands report back nothing to cleanup?

Sorry if this is something that others have asked before however I'm not sure how to take a stab at this without taking a shotgun approach by rm -rf /var/lib/docker/devicemapper/mnt/*

Thanks,

-Abe.

Rhodolite answered 17/1, 2017 at 23:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.