Thin Provisioning
LVM thin provisioning allows you to over-provision the physical storage. You can create file systems that are larger than the available physical storage. LVM thin provisioning allows you to create virtual disks inside a thin pool. The size of the virtual disk can be greater than the available space in the thin pool. You must monitor the thin pool and add more capacity when it starts to become full.
#
Configuring ThinProvision VolumeFor creating a thin-provisioned volume, use the thinProvision parameter in storage class. Its allowed values are: "yes" and "no". If we do not use this parameter by default its value will be "no" and it will work as thick provisioned volumes.
Before creating a thin provision volume, make sure that the required thin provisioning kernel module dm_thin_pool
is loaded on all the nodes.
To verify if the modules are loaded, run:
If modules are not loaded, then execute the following command to load the modules:
#
Extend the Thin Pool SizeThin pools are just logical volumes, so if we need to extend the size of thin-pool we can use the same command like, we have used for logical volumes extend, but we can not reduce the size of thin pool.
#
Configure Auto Extending of the Thin Pool (Configure Over-Provisioning protection)important
The provisioner does not automatically enable monitoring (auto-extend) on the thin pool, as not all use cases necessitate auto-extension. In certain configurations, a thin pool may be required to extend, but not exceeding a certain limit. However, the lvm configuration does not offer a method to restrict the extension limit. Hence, it is left to the user to configure thin pool auto-extend as needed.
Since we automatically create a thin pool as part of first the thin volume provisioning, we need to enable the monitoring using
lvchange
command on all thin pools across the nodes to use the auto extend threshold feature.To Ensure monitoring of the logical volume is enabled.
If the output in the Monitor column reports, as above, that the volume is not monitored,
then monitoring needs to be explicitly enabled. Without this step, an automatic extension of
the logical thin pool will not occur, regardless of any settings in the lvm.conf
.
Editing the settings in the
/etc/lvm/lvm.conf
can allow auto-growth of the thin pool when required. By default, the threshold is 100% which means that the pool will not grow. If we set this to, 75%, the Thin Pool will autoextend when the pool is 75% full. It will increase by the default percentage of 20% if the value is not changed. We can see these settings using the command grep against the file.