How to Enable 'Discard/TRIM' in Openstack Instance ?

Problem

  • How do I enable TRIM (Discard) in a OpenStack KVM instance?

Environment

  • Platform9 Managed OpenStack - v5.4 and Higher

Cause

  • The default disk driver for KVM images is virtio. This driver does not supports / implements the fitrim IOCTL. Thus, it is needed to use virtio-scsi, which supports FITRIM.

Resolution

  • Create or modify a glance image adding the virtio-scsi disk bus property:

# glance image-update --property hw_scsi_model=virtio-scsi --property hw_disk_bus=scsi <image>

Or

# openstack image set --property hw_scsi_model=virtio-scsi --property hw_disk_bus=scsi <image>

Last updated