Docker 中direct-lvm配置:
[root@k8s-slave ~]
Disk /dev/vdb: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x73fcd4fb
Device Boot Start End Blocks Id System
-----------------------------------------------------
[root@k8s-slave ~]
Physical volume "/dev/vdb" successfully created.
[root@k8s-slave ~]
PV VG Fmt Attr PSize PFree
/dev/vda2 cl lvm2 a-- 49.00g 0
/dev/vdb docker lvm2 a-- 200.00g 200.00g
[root@k8s-slave ~]
--- Physical volume ---
PV Name /dev/vdb
VG Name docker
PV Size 200.00 GiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 51199
Free PE 51199
Allocated PE 0
PV UUID 7pvAKx-kbEL-DKGL-VT5P-hz30-S6KF-MYHaHU
-----------------------------------------------------
[root@k8s-slave ~]
Volume group "docker" successfully created
[root@k8s-slave ~]
VG
cl 1 2 0 wz--n- 49.00g 0
docker 1 0 0 wz--n- 200.00g 200.00g
[root@k8s-slave ~]
--- Volume group ---
VG Name docker
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 200.00 GiB
PE Size 4.00 MiB
Total PE 51199
Alloc PE / Size 0 / 0
Free PE / Size 51199 / 200.00 GiB
VG UUID pasYCH-DcL1-ZYRd-GuVH-dXFZ-p2c2-ksLBLQ
-----------------------------------------------------
创建pool
[root@k8s-slave ~]
Logical volume "thinpool" created.
[root@k8s-slave ~]
Logical volume "thinpoolmeta" created.
=== 数据LV大小为VG的95%,元数据为1%,剩余用来自动扩展 ===
将pool转换为thinpool
[root@k8s-slave ~]
WARNING: Converting logical volume docker/thinpool and docker/thinpoolmeta to thin pool's data and metadata volumes with metadata wiping.
THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)
Converted docker/thinpool to thin pool.
------------------------------------------------------
[root@k8s-slave ~]
activation {
thin_pool_autoextend_threshold=80
thin_pool_autoextend_percent=20
}
------------------------------------------------------
[root@k8s-slave ~]
Logical volume docker/thinpool changed.
------------------------------------------------------
[root@k8s-slave ~]
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Monitor
thinpool docker twi-a-t--- 190.00g 0.00 0.01 monitored
------------------------------------------------------
[root@k8s-slave ~]
{
"storage-driver": "devicemapper",
"storage-opts": [
"dm.thinpooldev=/dev/mapper/docker-thinpool",
"dm.use_deferred_removal=true",
"dm.use_deferred_deletion=true"
]
}
[root@sjt-test5-t6 alauda]
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 1.12.6
Storage Driver: devicemapper
Pool Name: docker-thinpool
Pool Blocksize: 524.3 kB
Base Device Size: 10.74 GB
Backing Filesystem: xfs
Data file:
Metadata file:
Data Space Used: 20.45 MB
Data Space Total: 204 GB
Data Space Available: 204 GB
Metadata Space Used: 266.2 kB
Metadata Space Total: 2.143 GB
Metadata Space Available: 2.143 GB
Thin Pool Minimum Free Space: 20.4 GB
Udev Sync Supported: true
Deferred Removal Enabled: true
Deferred Deletion Enabled: true
Deferred Deleted Device Count: 0
Library Version: 1.02.135-RHEL7 (2016-11-16)
Logging Driver: journald
Cgroup Driver: systemd
Plugins:
Volume: local
Network: host bridge null overlay
Swarm: inactive
Runtimes: docker-runc runc
Default Runtime: docker-runc
Security Options: seccomp selinux
Kernel Version: 3.10.0-514.26.2.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
Number of Docker Hooks: 3
CPUs: 4
Total Memory: 13.69 GiB
Name: sjt-test5-t6
ID: CLHX:NWJH:MWKW:GTW3:SAQ6:CYIA:7WPC:DTID:VYZQ:THH6:UQW2:RLR5
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
127.0.0.0/8
Registries: docker.io (secure)