Docker LVM调整大小

时间:2018-02-05 20:41:56

标签: linux docker lvm

我已将 devicemapper 的配置设为described here 我创建了thinpool,profile和其他相关的东西 /etc/docker/daemon.json

{
    "storage-driver": "devicemapper",
    "storage-opts": [
        "dm.thinpooldev=/dev/mapper/userspace-thinpool",
        "dm.use_deferred_removal=true",
        "dm.use_deferred_deletion=true",
        "dm.basesize=1G",
        "dm.fs=ext4",
        "dm.libdm_log_level=6",
        "dm.min_free_space=10%"
    ]
}

/etc/lvm/profile/docker-thinpool.profile

activation {
    thin_pool_autoextend_threshold=50
    thin_pool_autoextend_percent=25
}

$ lvs -o + seg_monitor userspace / thinpool

File descriptor 8 (pipe:[2545597]) leaked on lvs invocation. Parent PID 5123: bash
  LV       VG        Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Monitor  
  thinpool userspace twi-aot--- 150.00g             2.86   0.23                             monitored

$ docker info

Containers: 8
 Running: 7
 Paused: 0
 Stopped: 1
Images: 26
Server Version: 17.12.0-ce
Storage Driver: devicemapper
 Pool Name: userspace-thinpool
 Pool Blocksize: 524.3kB
 Base Device Size: 1.074GB
 Backing Filesystem: ext4
 Udev Sync Supported: true
 Data Space Used: 4.614GB
 Data Space Total: 161.1GB
 Data Space Available: 156.4GB
 Metadata Space Used: 2.433MB
 Metadata Space Total: 1.074GB
 Metadata Space Available: 1.071GB
 Thin Pool Minimum Free Space: 16.11GB
 Deferred Removal Enabled: true
 Deferred Deletion Enabled: true
 Deferred Deleted Device Count: 0
 Library Version: 1.02.110 (2015-10-30)
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: 89623f28b87a6004d4b785663257362d1658a729
runc version: b2567b37d7b75eb4cf325b77297b140ea686ce8f
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.4.0-112-generic
Operating System: Linux Mint 18.1
OSType: linux
Architecture: x86_64

因此,当我运行新容器并使用容器中的所有空间(/)时,没有任何反应。我的期望:容器中根文件系统的大小自动扩展 25% 我是如何测试的:

docker run --rm -it alpine
cat /dev/urandom >> /1.spam.bin
  cat: write error: No space left on device
df -h /

及其组合。
如果我误解了官方指南,请告诉我。另外,我读了这个

  

监控精简池
  不要单独依赖LVM自动扩展。该   卷组自动扩展,但卷仍然可以填满。

0 个答案:

没有答案