Docker with direct-lvm devicemapper newbie questions

hi guys,
i was trying to setup in the correct way a docker host for my devs…
i have got some difficulties on configuring the device mapper in direct-lvm so i want to ask you if you can give me a smart answer, because i havent found it in the docs or the forum.

this is my daemon.json:
{
“storage-driver”: “devicemapper”,
“storage-opts”: [
“dm.directlvm_device=/dev/docker-pool/docker0”,
“dm.use_deferred_removal=true”,
“dm.use_deferred_deletion=false”,
“dm.directlvm_device_force=false”
],
“log-driver”: “json-file”,
“log-opts”: {
“max-size”: “100m”,
“max-file”: “5”
},
“bip”: “172.10.0.1/24”,
“debug”: false
}

this is my docker info:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 17.06.2-ce
Storage Driver: devicemapper
Pool Name: docker-thinpool
Pool Blocksize: 524.3kB
Base Device Size: 10.74GB
Backing Filesystem: xfs
Data file:
Metadata file:
Data Space Used: 19.92MB
Data Space Total: 24.47GB
Data Space Available: 24.45GB
Metadata Space Used: 61.44kB
Metadata Space Total: 255.9MB
Metadata Space Available: 255.8MB
Thin Pool Minimum Free Space: 2.447GB
Udev Sync Supported: true
Deferred Removal Enabled: true
Deferred Deletion Enabled: false
Deferred Deleted Device Count: 0
Library Version: 1.02.135-RHEL7 (2016-11-16)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 6e23458c129b551d5c9871e5174f6b1b7f6d1170
runc version: 810190ceaa507aa2727d7ae6f4790c76ec150bd2
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-514.26.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.388GiB
Name: dev-docker01
ID: DGBF:KI3D:PEU7:JOXN:IT3X:AU3T:XVNO:MWXY:LR74:W24Q:HNXL:AARV
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

this is my devicemapper device:
/dev/docker-pool/docker0

output of ssm list:

Device Free Used Total Pool Mount point

/dev/dm-0 744.00 MB 23.27 GB 24.00 GB docker
/dev/xvda 30.00 GB PARTITIONED
/dev/xvda1 30.00 GB /
/dev/xvdb 6.00 GB 24.00 GB 30.00 GB docker-pool


Pool Type Devices Free Used Total Parent

docker lvm 1 744.00 MB 23.27 GB 23.99 GB
docker-pool lvm 1 6.00 GB 24.00 GB 30.00 GB
thinpool thin 1 22.77 GB 18.67 MB 22.79 GB docker


Volume Pool Volume size FS FS size Free Type Mount point

/dev/docker-pool/docker0 docker-pool 24.00 GB linear
/dev/xvda1 30.00 GB xfs 29.99 GB 27.26 GB part /

output from: lsblk:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 30G 0 disk
└─xvda1 202:1 0 30G 0 part /
xvdb 202:16 0 30G 0 disk
└─docker–pool-docker0 253:0 0 24G 0 lvm
├─docker-thinpool_tmeta 253:1 0 244M 0 lvm
│ └─docker-thinpool 253:3 0 22.8G 0 lvm
└─docker-thinpool_tdata 253:2 0 22.8G 0 lvm
└─docker-thinpool 253:3 0 22.8G 0 lvm

now the questions are:

  • why in the docker info i have a devicemapper name: docker-thinpool ???

  • why compared thinpool ??? i havent created it

is it normal i dont see the devicemapper in the mount ??? and i see in the mount only the xvda1 under: /var/lib/docker/devicemapper ???

is the data written on my deicemapper or on the xvda1 ???

kind regards,
Luca

With 17.06, Docker is configuring the lvm automatically with some volumes for snapshots etc. But your data is written to the xvda1 disk.

What you can do is executing lvs, it shows you how much data is used.
This is what mine looks like:

[root@vserver-202 ~]# lvs
  LV       VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  thinpool docker twi-aot---   9.50g             12.58  0.33

Are you saying that even though docker is on a different disk(xvdb) the data is still written on xvda1?

I am also struggling on how to set up the direct-lvm in CentOS , the doc is not well explained …

1 Like