Automatically extend a thin pool

You can automate the expansion of your thin pool by enabling monitoring and setting the thin_pool_autoextend_threshold and the thin_pool_autoextend_percent configuration parameters.

Before you begin

  • Administrative access.

Procedure

  1. Check if the thin pool is monitored:
    # lvs -o lv_name,vg_name,seg_monitor
      LV                VG              Monitor
      ThinPoolName      VolumeGroupName not monitored
  2. Enable thin pool monitoring with the dmeventd daemon:
    # lvchange --monitor y VolumeGroupName/ThinPoolName

    Replace VolumeGroupName with the name of the volume group. Replace ThinPoolName with the name of the thin pool.

  3. Open the /etc/lvm/lvm.conf file in an editor of your choice.
  4. Uncomment the thin_pool_autoextend_threshold and thin_pool_autoextend_percent lines and set each parameter to a required value:
    thin_pool_autoextend_threshold = 70
    thin_pool_autoextend_percent = 20

    thin_pool_autoextend_threshold determines the percentage at which LVM starts to auto-extend the thin pool. For example, setting it to 70 means LVM will try to extend the thin pool when it reaches 70% capacity.

    thin_pool_autoextend_percent specifies by what percentage the thin pool should be extended when it reaches threshold. For example, setting it to 20 means the thin pool will be increased by 20% of its current size.

  5. Save the changes and exit the editor.
  6. Restart the lvm2-monitor:
    # systemctl restart lvm2-monitor