3.8. Managing thin provisioning with Virtual Data Optimizer
It is possible to configure a thin-provisioned VDO volume to prepare for future expansion of the physical space, in order to address a condition where the physical space usage of the 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. This procedure describes how 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 a 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 a VDO volume can only be grown to 8192 slabs that is 16 TB for a VDO volume with the default slab size of 2 GB, or 256 TB for a 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 VDO name respectively.
Conditions préalables
- Install the VDO software. For more information, see Installing VDO.
- An LVM volume group with free storage capacity exists on your system.
-
A thin-provisioned VDO volume using the
lvcreate --type vdo --name myvdo myvg -L logical-size-of-pool --virtualsize virtual-size-of-vdo
command. For more information, see Creating an LVM-VDO volume.
Procédure
Determine the optimal logical size for a thin-provisioned 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 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.
-
there is approximately a
Monitor the free physical space in a VDO volume:
# vdostats myvg-vpool0-vpool
This command can be executed periodically to provide monitoring of the used and free physical space of the VDO volume.
Optional: View the warnings on physical space usage on a 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
When creating a VDO volume, the
dmeventd
monitoring service monitors the usage of physical space in a VDO volume. This is enabled by default when a VDO volume is created or started.Use the
journalctl
command to view the output ofdmeventd
in the logs while monitoring a 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.
Remediate VDO volumes that are almost out of available physical space. When it is possible to add a physical space to a 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 VDO volume myvdo contains a file system mounted on the /users/homeDir path:
Freeze the filesystem:
# xfs_freeze -f /users/homeDir # vgextend myvg /dev/vdc2 # lvextend -l new_size myvg/vpool0-name # xfs_freeze -u /users/homeDir
Unmount the filesystem:
# umount /users/homeDir # vgextend myvg /dev/vdc2 # lvextend -l new_size myvg/vpool0-name # mount -o discard /dev/myvg/myvdo /users/homeDir
NoteUnmounting or freezing a filesystem with cached data will incur a write of the cached data, which may fill the physical space of the VDO volume. Consider the maximum amount of cached filesystem data when setting a monitoring threshold for free physical space on a VDO volume.
Blocks that are no longer used by a file system can be cleaned up by using the
fstrim
utility. Executingfstrim
against a mounted file system on top of a VDO volume may result in increased free physical space for that volume. Thefstrim
utility will send discards to the 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.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%
Discard unused blocks:
# fstrim /users/homeDir
View the free physical space of the 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 65G of physical space to use in the VDO volume.NoteDiscarding 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 may potentially require a more extensive cleanup to reclaim physical space than just simply discarding already unused blocks.