19.3.5 Creating and Managing Thinly-Provisioned Logical Volumes

Thinly-provisioned logical volumes have virtual sizes that are typically greater than the physical storage on which you create them. You create thinly-provisioned logical volumes from storage that you have assigned to a special type of logical volume termed a thin pool. LVM assigns storage on demand from a thin pool to a thinly-provisioned logical volume as required by the applications that access the volume. You need to use the lvs command to monitor the usage of the thin pool so that you can increase its size if its available storage is in danger of being exhausted.

To create a thin pool, use the lvcreate command with the --thin option:

# lvcreate --size size --thin volume_group/thin_pool_name

For example, create the thin pool mytp of size 1 GB in the volume group myvg:

# lvcreate --size 1g --thin myvg/mytp
Logical volume "mytp" created

You can then use lvcreate with the --thin option to create a thinly-provisioned logical volume with a size specified by the --virtualsize option, for example:

# lvcreate --virtualsize size --thin volume_group/thin_pool_name \
  --name logical_volume

For example, create the thinly-provisioned logical volume mytv with a virtual size of 2 GB using the thin pool mytp, whose size is currently less than the size of the volume:

# lvcreate --virtualsize 2g --thin myvg/mytp --name mytv
Logical volume "mytv" created

If you create a thin snapshot of a thinly-provisioned logical volume, do not specify the size of the snapshot, for example:

# lvcreate --snapshot --name mytv-snapshot myvg/mytv
Logical volume “mytv-snapshot” created

If you were to specify a size for the thin snapshot, its storage would not be provisioned from the thin pool.

If there is sufficient space in the volume group, you can use the lvresize command to increase the size of a thin pool, for example:

# lvresize -L+1G myvg/mytp
  Extending logical volume mytp to 2 GiB
  Logical volume mytp successfully resized

For details of how to use the snapper command to create and manage thin snapshots, see Section 19.3.6, “Using snapper with Thinly-Provisioned Logical Volumes”.

For more information, see the lvcreate(8) and lvresize(8) manual pages.