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

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
No edit summary
 
(40 intermediate revisions by the same user not shown)
Line 9: Line 9:
Provision an unformatted block device. For this example, it will be referred to as /dev/sdb.
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 [[Fdisk#Create_a_Partition_that_Spans_the_Entire_Device|is created with fdisk]].


The procedure will create a /dev/sdb1 partition.


[[Wipefs#Erase_all_Signatures|Erase all signatures]] from the partition:


<pre>
wipefs -a /dev/sdb1
</pre>
[[pvcreate#Initialize_Partition_for_use_by_LVM|Initialize the partition for use by LVM]] by creating a physical volume:
<pre>
pvcreate /dev/sdb1
</pre>
[[Vgcreate#Create_a_Volume_Group|Create the volume group]], conventionally named "docker_vg", using the partition prepared by the previous steps /dev/sdb1:
<pre>
vgcreate docker_vg /dev/sdb1
</pre>
[[lvcreate#Create_a_Thin_Pool_Logical_Volume|Crate the LVM thin pool]]:
<pre>
lvcreate -y --type thin-pool --zero n -c 512K --poolmetadatasize 1041s -L 500M -n docker-pool docker_vg
</pre>


[[lvchange#Enable_Logical_Volume_Auto-Extension|Enable auto-extension]] (optional):


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


<pre>
<pre>
# cat /etc/sysconfig/docker-storage
activation {
DOCKER_STORAGE_OPTIONS=--storage-opt dm.fs=xfs --storage-opt
thin_pool_autoextend_threshold=60
dm.thinpooldev=/dev/mapper/docker--vg-docker--pool
thin_pool_autoextend_percent=20


# 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
</pre>
</pre>


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.
in /etc/lvm/profile/docker_vg--docker-pool-extend.profile and then:
 
<pre>
lvchange --metadataprofile docker_vg--docker-pool-extend  docker_vg/docker-pool
</pre>
 
Verify that the LV is correctly created:
 
<pre>
#lvs
 
  LV          VG        Attr      LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  docker-pool docker_vg twi-a-t--- 500.00m            0.00  0.88
  root        main_vg  -wi-ao----  7.00g
</pre>
 
Write /etc/sysconfig/docker-storage:
 
<pre>
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"
</pre>

Latest revision as of 18:40, 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:

lvcreate -y --type thin-pool --zero n -c 512K --poolmetadatasize 1041s -L 500M -n docker-pool docker_vg

Enable auto-extension (optional):

Store:

activation {
	thin_pool_autoextend_threshold=60
	thin_pool_autoextend_percent=20

}

in /etc/lvm/profile/docker_vg--docker-pool-extend.profile and then:

lvchange --metadataprofile docker_vg--docker-pool-extend  docker_vg/docker-pool

Verify that the LV is correctly created:

#lvs

  LV          VG        Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  docker-pool docker_vg twi-a-t--- 500.00m             0.00   0.88
  root        main_vg   -wi-ao----   7.00g

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"