How to create an LVM thin pool

A thin pool lets LVM hand out thin logical volumes from shared physical space instead of reserving the full virtual size of every future volume. Create the pool before provisioning thin volumes so the storage boundary, metadata area, and pool usage counters exist before applications receive block devices.

A thin pool is a special logical volume, not a filesystem target or mountable data volume. LVM creates hidden data and metadata LVs behind the pool name, then later thin volumes reference that pool and consume blocks only as data is written.

Thin provisioning can overcommit storage, so the pool needs free space in the volume group and ongoing attention to Data% and Meta%. Leave unallocated VG space for pool extension, snapshots, or emergency recovery instead of assigning every free extent to the initial pool.

Steps to create an LVM thin pool:

  1. Check free space in the target volume group.
    $ sudo vgs vgdata
      VG     #PV #LV #SN Attr   VSize    VFree  
      vgdata   2   0   0 wz--n- 200.00g 120.00g

    Replace vgdata with the volume group that should hold the thin pool. The VFree column must cover the pool size and still leave space for future pool growth.

  2. Create the thin pool.
    $ sudo lvcreate --type thin-pool --size 80G --name thinpool vgdata
      Thin pool volume with chunk size 64.00 KiB can address at most <15.88 TiB of data.
      Logical volume "thinpool" created.

    The pool size reserves physical space from the volume group. Thin volumes created later can have larger virtual sizes, so monitor the pool before Data% or Meta% reaches 100%.

  3. Verify the pool segment type and usage counters.
    $ sudo lvs --options lv_name,vg_name,segtype,lv_size,data_percent,metadata_percent,lv_attr vgdata/thinpool
      LV       VG     Type      LSize  Data%  Meta%  Attr      
      thinpool vgdata thin-pool 80.00g 0.00   0.12   twi-a-tz--

    The Type value should be thin-pool. Data% tracks allocated data blocks, and Meta% tracks the metadata space used to map thin-volume blocks.

  4. Inspect the hidden pool components.
    $ sudo lvs --all --options lv_name,vg_name,segtype,lv_size,origin,pool_lv,lv_attr vgdata
      LV               VG     Type      LSize  Origin Pool Attr      
      [lvol0_pmspare]  vgdata linear    84.00m             ewi-------
      thinpool         vgdata thin-pool 80.00g             twi-a-tz--
      [thinpool_tdata] vgdata linear    80.00g             Twi-ao----
      [thinpool_tmeta] vgdata linear    84.00m             ewi-ao----

    The bracketed _tdata and _tmeta LVs belong to the pool and should not be formatted, mounted, or handed directly to applications. Create thin LVs from the pool instead.
    Related: How to create an LVM thin volume