Skip to content

Instantly share code, notes, and snippets.

@mountkin
Created November 14, 2016 02:52
Show Gist options
  • Save mountkin/6674fe72a2467fc6d358b8d4a6d140f0 to your computer and use it in GitHub Desktop.
Save mountkin/6674fe72a2467fc6d358b8d4a6d140f0 to your computer and use it in GitHub Desktop.
#!/bin/bash
yum install -y lvm2
pvcreate /dev/sdc
vgcreate docker /dev/sdc
lvcreate --wipesignatures y -n thinpool docker -l 95%VG
lvcreate --wipesignatures y -n thinpoolmeta docker -l 1%VG
lvconvert -y --zero n -c 512K --thinpool docker/thinpool --poolmetadata docker/thinpoolmeta
cat<<-EOS>/etc/lvm/profile/docker-thinpool.profile
activation {
thin_pool_autoextend_threshold = 80
thin_pool_autoextend_percent = 20
}
EOS
lvchange --metadataprofile docker-thinpool docker/thinpool
lvs -o+seg_monitor
cat <<-EOS>/etc/docker/daemon.json
{
"storage-driver": "devicemapper",
"storage-opts": [
"dm.thinpooldev=/dev/mapper/docker-thinpool",
"dm.use_deferred_removal=true",
"dm.use_deferred_deletion=true"
]
}
EOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment