Provision Docker Storage on a Dedicated Block Device: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 31: Line 31:
</pre>
</pre>


[[lvcreate#Create_a_Thin_Pool_Logical_Volume|Crate the LVM thin pool]].
[[lvcreate#Create_a_Thin_Pool_Logical_Volume|Crate the LVM thin pool]]:
 
<pre>
</pre>


This results in the following links in /dev/mapper:
This results in the following links in /dev/mapper:

Revision as of 18:11, 23 May 2017

Internal

Overview

Procedure

Provision an unformatted block device. For this example, it will be referred to as /dev/sdb.

Create one partition that spans the entire device. Either fdisk or sfdisk can be used. This is how the partition is created with fdisk.

The procedure will create a /dev/sdb1 partition.

Erase all signatures from the partition:

wipefs -a /dev/sdb1

Initialize the partition for use by LVM by creating a physical volume:

pvcreate /dev/sdb1

Create the volume group, conventionally named "docker_vg", using the partition prepared by the previous steps /dev/sdb1:

vgcreate docker_vg /dev/sdb1

Crate the LVM thin pool:


This results in the following links in /dev/mapper:

lrwxrwxrwx.  1 root root       7 May 23 10:51 docker_vg-docker--pool -> ../dm-3
lrwxrwxrwx.  1 root root       7 May 23 10:51 docker_vg-docker--pool_tdata -> ../dm-2
lrwxrwxrwx.  1 root root       7 May 23 10:51 docker_vg-docker--pool_tmeta -> ../dm-1

Write /etc/sysconfig/docker-storage:

DOCKER_STORAGE_OPTIONS="--storage-driver devicemapper --storage-opt dm.fs=xfs --storage-opt dm.thinpooldev=/dev/mapper/docker_vg-docker--pool --storage-opt dm.use_deferred_removal=true"





Continue with /Users/ovidiu/projects/openshift/docker-storage-setup, function: setup_storage()







Verify your configuration. You should have a dm.thinpooldev value in the /etc/sysconfig/docker-storage file and a docker-pool logical volume:

# cat /etc/sysconfig/docker-storage
DOCKER_STORAGE_OPTIONS=--storage-opt dm.fs=xfs --storage-opt
dm.thinpooldev=/dev/mapper/docker--vg-docker--pool

# lvs
  LV          VG   Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  docker-pool rhel twi-a-t---  9.29g             0.00   0.12

Before using Docker or OpenShift Container Platform, verify that the docker-pool logical volume is large enough to meet your needs. The docker-pool volume should be 60% of the available volume group and will grow to fill the volume group via LVM monitoring.