Lightbits TRIM Support

The Lightbits TRIM feature allows filesystems to reclaim unused storage space by issuing commands to the storage system (called trim/discard operations). Lightbits handles trim/discard operations issued by the filesystem on its volumes. Combined with Lightbits’ thin provisioning capabilities, this improves storage performance and capacity efficiency.

For instance, the 'fstrim' operation on an XFS filesystem mounted on a Lightbits volume can reduce storage utilization (reduce volume usage size), when invoked with the TRIM feature enabled.

Lightbits has implemented the NVMe deallocate as specified in the NVMe command set specification, to improve capacity utilization and planning. This capability works with the TRIM command, allowing the operating system to inform Lightbits about unused data blocks. For more information, refer to sections 3.3.3 and 3.3.3.2.1 of the NVMe command set specification.

When the OS deletes a file and sends a TRIM command, it is translated to an NVMe dataset management deallocate command on the client side. Lightbits receives this deallocate command and manages the information internally within its software, behaving as if the data was deallocated. This approach enables more efficient capacity utilization and garbage collection - and improves write performance and endurance.

High-Level Workflow

Configuring the TRIM Feature on the Lightbits Cluster

The TRIM feature must be enabled for 3.16 installations. For existing deployments, upgrade to 3.16 and perform the following steps to enable the TRIM feature.

Once enabled, this feature cannot be disabled.

Enable the feature with this command:

Bash
Copy
  • Enabling TRIM does not automatically reclaim space from previously deleted data on existing volumes. To initiate space reclamation on existing volumes after enabling TRIM, refer to the instructions in the Best Practices section below.
  • It is not necessary to restart Node Manager. The feature can be enabled by invoking an API (after the upgrade).
  • In version 3.16.1, lbcli list feature-flags will always show trim as false. Use lbcli list cluster-config to get its status.

Viewing Reduced Storage Using TRIM

This example details the complete process of enabling TRIM, creating and deleting files, and viewing its effects on storage usage.

  1. Create a Lightbits volume and set up the filesystem:
Bash
Copy
  1. Check the initial storage usage:
Bash
Copy
  1. Use the dd command to create a ~0.5GB file (or 0.5GB per replica/node):
Bash
Copy
  1. Wait approximately one minute, and then check the storage usage:
Bash
Copy

Note the increase in used storage.

  1. Delete the file:
Bash
Copy
  1. Check the storage usage again:
Bash
Copy

Note that the used storage has not decreased yet.

  1. Enable the TRIM feature on the Lightbits cluster:
Bash
Copy
  1. Verify that the TRIM feature is set to “true”:
Bash
Copy
  1. Set up and run fstrim.timer on the client machine:
Bash
Copy
  1. Manually trigger a TRIM operation to see its immediate effects:
Bash
Copy
  1. Wait approximately one minute, and then check the updated storage usage:
Bash
Copy

You should now see a reduction in the "used" storage, indicating that the TRIM operations have successfully reclaimed space.

Example Output:

Bash
Copy
  1. To verify that TRIM is working on an ongoing basis:

Create another test file:

Bash
Copy

Check the storage usage:

Bash
Copy

Delete the file:

Bash
Copy

Wait for the next scheduled TRIM operation (or trigger it manually), and then check the storage usage again:

Bash
Copy

TRIM Operations - Best Practices

Initial Setup After Enabling TRIM

  1. Enable TRIM on the Lightbits cluster:
Bash
Copy
  1. On each client machine, set up fstrim.timer:
Bash
Copy
  1. Verify the timer status:
Bash
Copy
  1. Run an initial manual TRIM to reclaim space from previously-deleted data:
Bash
Copy

Regular Maintenance

  1. Periodically check the status of fstrim.timer:
Bash
Copy
  1. Monitor the storage usage after TRIM operations:
Bash
Copy
  1. If the storage is not being reclaimed as expected, manually trigger TRIM:
Bash
Copy

Customizing the TRIM Schedule

If a weekly schedule is not suitable, customize the TRIM schedule as follows on every client machine.

  1. Create a custom timer file:
Bash
Copy
  1. Add your custom schedule. For example, to run it daily:
Bash
Copy
  1. Save the file and reload the systemd daemon:
Bash
Copy
  1. Restart the timer:
Bash
Copy

Avoiding Continuous TRIM

Do not use the -o discard mount option for filesystems on Linux, as it can significantly impact filesystem performance.

Red Hat does not recommend using Continuous TRIM. See the relevant Red Hat documentation for additional information.

TRIM Troubleshooting

If TRIM is not working:

Verify that it is enabled on the Lightbits cluster:

Bash
Copy

Check the fstrim.timer status on the client:

Bash
Copy

Review the system logs for any TRIM-related errors:

Bash
Copy

If these or other issues persist, contact Lightbits Customer Success for assistance.

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard