Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save swamibluedata/0ee950d1ec7f5fca66772deccc74cb2a to your computer and use it in GitHub Desktop.
Save swamibluedata/0ee950d1ec7f5fca66772deccc74cb2a to your computer and use it in GitHub Desktop.
# Install docker
# Stop docker services and wipe out /var/lib/docker
service docker stop
rm -rf /var/lib/docker
# Create pv, lv. Following uses /dev/sdb1, add more partitions or disks here
pvcreate /dev/sdb1
# Create docker VG using the above created pvs
vgcreate docker /dev/sdb1
# Create lvs for docker
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
# Setup automatic pool expansion
cat > /etc/lvm/profile/docker-thinpool.profile <<EOF
activation {
thin_pool_autoextend_threshold=80
thin_pool_autoextend_percent=20
}
EOF
# Apply the new profile
lvchange --metadataprofile docker-thinpool docker/thinpool
# Setup other_args for docker to use the new profile
cat > /etc/sysconfig/docker <<EOF
other_args='-d -s devicemapper --storage-opt=dm.basesize=20G --storage-opt=dm.thinpooldev=/dev/mapper/docker-thinpool --storage-opt=dm.use_deferred_removal=true'
EOF
# For CentOS 7.0
cat > /etc/docker/daemon.json <<EOF
{
"storage-driver": "devicemapper",
"storage-opts": [
"dm.thinpooldev=/dev/mapper/docker-thinpool",
"dm.basesize=30G"
]
}
EOF
# Restart docker
service docker start
# For verification
docker info
# Pull our image
docker pull bluedata/centos6
# Launch a node
docker run -d --name test bluedata/centos6
# exec bash into the container
docker exec -it test /bin/bash
@kcsraju
Copy link

kcsraju commented Jul 11, 2016

To manually create an LV with stripeing.

$> lvcreate --size 10737418240b  --name test --stripes 3 --stripesize 64 VolBDSCStore 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment