Last active
February 17, 2017 07:06
-
-
Save sandys/0d336091490dacc5e1f1 to your computer and use it in GitHub Desktop.
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
[default] | |
region = ap-southeast-1 | |
s3 = | |
max_concurrent_requests = 20 | |
max_queue_size = 10000 | |
multipart_threshold = 64MB | |
multipart_chunksize = 16MB | |
use_accelerate_endpoint = true | |
#aws configure | |
#aws s3 sync s3://bucket-name dest |
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
#check partitions | |
cat /proc/partitions | |
apt update | |
apt install parted xfsprogs | |
create a xfs disk as a raw disk | |
add it to the configuration profile | |
sudo parted -s /dev/xvdb mklabel gpt | |
sudo parted -s /dev/xvdb mkpart build1 xfs 1M 100% | |
#parted -s /dev/sdb mklabel gpt mkpart primary ext4 0% 100% | |
sudo mkfs.xfs -d su=64k,sw=3 /dev/xvdb1 | |
#mkfs.ext4 -L docker /dev/sdb1 | |
#change fstab. most likely the swap NEEDs to be on sdb | |
#/dev/sda / ext4 noatime,errors=remount-ro 0 1 | |
#/dev/sdc none swap sw | |
#/dev/xvdb1 /docker xfs rw,relatime,attr2,inode64,noquota 0 1 | |
#move /var to the new partition | |
#http://unix.stackexchange.com/questions/131311/moving-var-home-to-separate-partition | |
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D | |
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list | |
sudo apt-get update | |
sudo apt-get install docker-engine | |
cd /var | |
cp -ax * /data | |
cd / | |
mv var var.old | |
umount /dev/sdb1 | |
mkdir /var | |
mount /dev/sdb1 /var | |
#edit fstab | |
### DIRECT LVM | |
apt-get install lvm2 | |
parted -s /dev/sdb mklabel gpt | |
parted -s /dev/sdb mklabel gpt mkpart primary ext4 0% 100% | |
pvcreate /dev/sdb1 | |
vgcreate direct-lvm /dev/sdb1 | |
lvcreate --wipesignatures y -n homedata direct-lvm -l 50%VG | |
#lvcreate --wipesignatures y -n data direct-lvm -l 45%VG | |
sudo lvcreate --wipesignatures y -l 45%VG --thinpool data direct-lvm | |
#lvcreate --wipesignatures y -n metadata direct-lvm -l 5%VG | |
lvreduce --size 12G direct-lvm/metadata | |
dd if=/dev/zero of=/dev/direct-lvm/metadata bs=1M count=10 | |
#install docker normally | |
#systemctl status docker to get location of docker.service | |
ExecStart=/usr/bin/docker daemon -H fd:// \ | |
--storage-opt dm.fs=ext4 \ | |
--storage-opt dm.datadev=/dev/direct-lvm/data \ | |
--storage-opt dm.metadatadev=/dev/direct-lvm/metadata | |
systemctl stop docker.service | |
systemctl daemon-reload | |
systemctl start docker | |
#/etc/systemd/system/docker.service.d/override.conf | |
[Service] | |
EnvironmentFile=-/etc/default/docker | |
ExecStart=/usr/bin/docker -d $DOCKER_OPTS -H fd:// | |
MountFlags=slave | |
LimitNOFILE=1048576 | |
LimitNPROC=1048576 | |
LimitCORE=infinity | |
DOCKER_OPTS="--storage-driver=overlay" in /etc/default/docker | |
sudo iptables -t filter -F DOCKER-ISOLATION | |
ExecStart=/usr/bin/docker daemon -l debug -H fd:// --storage-driver=devicemapper --storage-opt dm.fs=xfs --storage-opt dm.thinpooldev=direct--lvm-data-tpool --userland-proxy=false | |
#the name of the pool is under ls /dev/mapper | |
#/lib/systemd/system/docker.service | |
# sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual | |
ExecStart=/usr/bin/dockerd -H fd:// --storage-driver=overlay --graph="/docker" | |
#reboot |
when moving from one aws to another.
sudo dmsetup ls
sudo lvscan
ACTIVE '/dev/direct-lvm/homedata' [256.00 GiB] inherit
inactive '/dev/direct-lvm/data' [230.39 GiB] inherit
sudo vgchange -ay direct-lvm
sudo lvchange -a y /dev/direct-lvm/data
sudo lvconvert --repair direct-lvm/data
[Service]
Type=notify
ExecStart=/usr/bin/docker daemon -l debug -H fd:// --storage-driver=devicemapper --storage-opt dm.fs=xfs --storage-opt dm.thinpooldev=/dev/mapper/direct--lvm-data-tpool --userland-proxy=false
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0
sudo mkdir /homedata
sudo mount /dev/direct-lvm/homedata /homedata
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
recover from errors like
Error starting daemon: error initializing graphdriver: devmapper: Unable to take ownership of thin-pool (direct--lvm-data-tpool) that already has used data blocks
"devmapper: Unknown device"
etc. and creating a proper thinpool
sudo apt-get remove docker-engine
sudo rm -rf /var/lib/docker
sudo lvremove -f direct-lvm/data
sudo lvcreate --wipesignatures y -n data direct-lvm -l 45%VG
sudo lvcreate --wipesignatures y -n metadata direct-lvm -L 12G #limited to 16GB
sudo lvconvert --type thin-pool --poolmetadata direct-lvm/metadata direct-lvm/data
admin@ip-172-31-22-199:~/docker-setup$ sudo dmsetup status
direct--lvm-data-tpool: 0 483172352 thin-pool 1 435/3145728 179/3774784 - rw no_discard_passdown queue_if_no_space
direct--lvm-data_tdata: 0 483172352 linear
direct--lvm-data_tmeta: 0 25165824 linear
direct--lvm-data: 0 483172352 linear
direct--lvm-homedata: 0 536862720 linear
direct--lvm-data-tpool is your thinpool
sudo apt-get install docker-engine
change your service file