3.11. Managing thin-provisioned LVM-VDO volumes


It is possible to configure a thin-provisioned LVM-VDO volume to prepare for future expansion of the physical space, to address a condition where the physical space usage of the LVM-VDO volume is approaching 100%. Instead of using -l 100%FREE in the lvcreate operation, for example, use 95%FREE to ensure that there is some reserved space for recovery later on if needed. You can use the same method to resolve the following issues:

  • The volume runs out of space.
  • The file system enters read-only mode.
  • ENOSPC reported by the volume.
注意

The best way to address high physical space usage on an LVM-VDO volume is to delete unused files, and discard the blocks used by these unused files either by using online discard or the fstrim program. The physical space of an LVM-VDO volume can only be grown to 8192 slabs that is 16 TB for an LVM-VDO volume with the default slab size of 2 GB, or 256 TB for an LVM-VDO volume with the maximal slab size of 32 GB.

In all of the following steps, replace myvg and myvdo with the volume group and LVM-VDO name respectively.

Prerequisites

  1. Install the VDO software. For more information, see Installing VDO.
  2. An LVM volume group with free storage capacity exists on your system.
  3. A thin-provisioned LVM-VDO volume using the lvcreate --type vdo --name myvdo myvg -l <percentage_of_free_space_in_vg> --virtualsize <virtual_size_of_vdo> command. For more information, see Creating and mounting an LVM-VDO volume.

Procedure

  1. Determine the optimal logical size for a thin-provisioned LVM-VDO volume:

    # vdostats myvg-vpool0-vpool
    Device              1K-blocks  Used     Available  Use% Space saving%
    myvg-vpool0-vpool   104856576  29664088 75192488   28%   69%

    To calculate the space savings ratio, use the following formula:

    Savings ratio = 1 / (1 - Space saving%)

    In this example,

    • there is approximately a 3.22:1 space savings ratio on a data set of about 80 GB.
    • Multiplying the data set size by the ratio would yield a potential logical size of 256 GB if more data with the same space savings were written to the LVM-VDO volume.
    • Adjusting this number downward to 200 GB yields a logical size with a safe margin of free physical space, given the same space savings ratio.
  2. Monitor the free physical space in an LVM-VDO volume:

    # vdostats myvg-vpool0-vpool

    This command can be executed periodically to provide monitoring of the used and free physical space of the LVM-VDO volume.

  3. Optional: View the warnings on physical space usage on an LVM-VDO volume by using the available /usr/share/doc/vdo/examples/monitor/monitor_check_vdostats_physicalSpace.pl script:

    # /usr/share/doc/vdo/examples/monitor/monitor_check_vdostats_physicalSpace.pl myvg-vpool0-vpool
  4. When creating an LVM-VDO volume, the dmeventd monitoring service monitors the usage of physical space in an LVM-VDO volume. This is enabled by default when an LVM-VDO volume is created or started.

    Use the journalctl command to view the output of dmeventd in the logs while monitoring an LVM-VDO volume:

    lvm[8331]: Monitoring VDO pool myvg-vpool0-vpool.
    ...
    
    lvm[8331]: WARNING: VDO pool myvg-vpool0-vpool is now 84.63% full.
    lvm[8331]: WARNING: VDO pool myvg-vpool0-vpool is now 91.01% full.
    lvm[8331]: WARNING: VDO pool myvg-vpool0-vpool is now 97.34% full.
  5. Remediate LVM-VDO volumes that are almost out of available physical space. When it is possible to add a physical space to an LVM-VDO volume, but the volume space is full before it can be grown, it may be necessary to temporarily stop I/O to the volume.

    To temporarily stop I/O to the volume, execute the following steps, where LVM-VDO volume myvdo contains a file system mounted on the </users/homeDir> path:

    1. Freeze the file system:

      # xfs_freeze -f </users/homeDir>
      # vgextend myvg /dev/vdc2
      # lvextend -L <new_size> myvg/vpool0
      # xfs_freeze -u </users/homeDir>
    2. Unmount the file system:

      # umount </users/homeDir>
      # vgextend myvg /dev/vdc2
      # lvextend -L <new_size> myvg/vpool0
      # mount -o discard /dev/myvg/myvdo </users/homeDir>
      注意

      Unmounting or freezing a file system with cached data will incur a write of the cached data, which might fill the physical space of the LVM-VDO volume. Consider the maximum amount of cached file system data when setting a monitoring threshold for free physical space on an LVM-VDO volume.

  6. Blocks that are no longer used by a file system can be cleaned up by using the fstrim utility. Executing fstrim against a mounted file system on top of a VDO volume can result in increased free physical space for that volume. The fstrim utility will send discards to the LVM-VDO volume, which are then used to remove references to the previously used blocks. If any of those blocks are single-referenced, the physical space will be available to use.

    1. Check VDO stats to see what the current amount of free space is:

      # vdostats --human-readable myvg-vpool0-vpool
      Device             Size   Used  Available Use%  Space saving%
      myvg-vpool0-vpool  100.0G 95.0G 5.0G      95%   73%
    2. Discard unused blocks:

      # fstrim </users/homeDir>
    3. View the free physical space of the LVM-VDO volume:

      # vdostats --human-readable myvg-vpool0-vpool
      Device             Size     Used   Available Use%  Space saving%
      myvg-vpool0-vpool  100.0G   30.0G  70.0G     30%    43%

      In this example, after executing fstrim on the file system, the discards were able to return 65 G of physical space to use in the LVM-VDO volume.

      注意

      Discarding volumes with lower levels of deduplication and compression will have a possibility of reclaiming physical space than discarding volumes with higher levels of deduplication and compression. A volume that has high levels of deduplication and compression can potentially require a more extensive cleanup to reclaim physical space than just simply discarding already unused blocks.

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部