Chapter 4. Trim options on an LVM-VDO volume
LVM-VDO volumes offer two trim options. discard performs online block discard to automatically free unused blocks (use mount -o discard for immediate effect). fstrim does periodic discards that require the admin to schedule and monitor the process.
Use the fstrim application to discard unused blocks rather than the discard mount option. The performance impact of this option can be quite severe. For this reason, nodiscard is the default.
4.1. Enabling discard mount option on an LVM-VDO volume Copy linkLink copied to clipboard!
You can enable the discard option on your LVM-VDO volume.
Prerequisites
- An LVM-VDO volume exists on your system.
Procedure
Enable the
discardoption on your volume:# mount -o discard /dev/<vg_name>/<vdo_name> <mount_point>
4.2. Setting up periodic TRIM operation Copy linkLink copied to clipboard!
You can enable a scheduled TRIM operation on your system.
Prerequisites
- An LVM-VDO volume exists on your system.
Procedure
Enable and start the timer:
# systemctl enable --now fstrim.timer
Verification
Verify that the timer is enabled:
# systemctl list-timers fstrim.timerNEXT LEFT LAST PASSED UNIT ACTIVATES Mon 2021-05-10 00:00:00 EDT 5 days left n/a n/a fstrim.timer fstrim.serviceNoteYou will not see any reference to a VDO volume, because the
fstrim.timerruns across all mounted file systems.