Created
February 18, 2017 05:52
-
-
Save udomsak/f8f2949f77234d209e7a7030eb1e4ee5 to your computer and use it in GitHub Desktop.
docker thinpool setup step - copy from - https://github.com/docker/docker/issues/21701
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pvcreate /dev/sdd | |
# create a volume group named 'docker' (replace /dev/sdd with your block device) | |
vgcreate docker /dev/sdd | |
# create a thin pool named 'thinpool'; in this example, the data LV is 95% of the 'docker' volume group size (leaving free space allows for auto expanding of either the data or metadata if space is runs low as a temporary stopgap) | |
lvcreate --wipesignatures y -n thinpool docker -l 95%VG | |
lvcreate --wipesignatures y -n thinpoolmeta docker -l 1%VG | |
# convert the pool to a thin-pool | |
lvconvert -y --zero n -c 512K --thinpool docker/thinpool --poolmetadata docker/thinpoolmeta | |
# configure autoextension of thin pools via a lvm profile | |
vi /etc/lvm/profile/docker-thinpool.profile | |
# specify the value for 'thin_pool_autoextend_threshold' (where the number is the % of space used before lvm attempts to autoextend the available space; 100 = disabled) | |
example: | |
thin_pool_autoextend_threshold = 80 | |
# modify the autoextend percentage for when thin pool autoextension occurs (where the number is the % of space to increase the thin pool; 100 = disabled) | |
example: | |
thin_pool_autoextend_percent = 20 | |
example /etc/lvm/profile/docker-thinpool.profile: | |
activation { | |
thin_pool_autoextend_threshold=80 | |
thin_pool_autoextend_percent=20 | |
} | |
# apply the lvm profile | |
lvchange --metadataprofile docker-thinpool docker/thinpool | |
# verified the lv is monitored | |
lvs -o+seg_monitor | |
# configure docker daemon with specific devicemapper options | |
--storage-driver=devicemapper --storage-opt=dm.thinpooldev=/dev/mapper/docker-thinpool --storage-opt dm.use_deferred_removal=true | |
also see `man docker daemon` for more detail on the devicemapper options used. | |
example daemon.json: | |
{ | |
"storage-driver": "devicemapper", | |
"storage-opts": [ | |
"dm.thinpooldev=/dev/mapper/docker-thinpool", | |
"dm.use_deferred_removal=true" | |
] | |
} | |
# if docker was previously started, clear your graph driver directory | |
rm -rf /var/lib/docker/* | |
# start docker | |
systemctl start docker | |
# make sure to monitor your thin pool and volume group free space! it will auto-extend but the volume group can still fill up | |
# monitor logical volumes | |
lvs | |
lvs -a (to see the data and metadata sizes) | |
# monitor volume group free space | |
vgs | |
# logs can show the auto-extension of the thin pool when it hits the threshold | |
journalctl -fu dm-event.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment