Redpanda Guidance for using NVME/SSD Storage Devices and Block Discarding/TRIM
Last updated: August 11, 2026
The Importance of Block Discarding
NVME and SSD storage hardware support a mechanism called block discarding. This is also known as TRIM support. This device feature is a maintenance operation that helps with long-term performance and wear-leveling of flash storage devices, and helps prevent block fragmentation and write-amplification. The TRIM operation is an OS-level hint to the physical device on how to manage blocks that have been deleted and marked free at the filesystem level.
TRIM support requires the devices, device driver, and filesystem to support the TRIM operation. Redpanda encourages you to review your hardware and operating system vendor support to determine if TRIM is available to you.
Enabling TRIM support on XFS
There are multiple methods for trimming blocks in Linux.
- Batch or Periodic discard
- Online or Continuous discard
Enabling Batch or Periodic Discard
This mode uses the fstrim command. The fstrim is triggered manually by the administrator or on a specified period of time through a tool such as Cron or the Systemd fstrim.service/fstrim.timer services. This command would be run for every filesystem using NVME or SSD for Redpanda data storage.
If you’re running a Systemd-based operating system, these two services may already be enabled on your behalf.
Refer to your operating system vendor for specific instructions for enabling batch discards or checking its configuration status.
| Important: |
|
Because fstrim can have a high storage I/O impact, you should consider running it during off-peak periods for your Redpanda cluster, or running it more infrequently and keeping a sufficient amount of free capacity for the filesystem to work with. Additionally, take care to ensure that the fstrim operations on your Redpanda nodes do not overlap, as this may induce additional performance impact across your cluster. For example, if you have a three node cluster doing a weekly fstrim, consider having each node run the operation on a different day. |
Enabling Online or Continuous Discard
Online or continuous discard requires filesystem support. This is enabled through a mount-time option called discard. This option would be added to every filesystem using NVME or SSD for Redpanda data storage.
If using discard on XFS, you will want to be at least on a 4.7 Linux kernel or later to incorporate newer asynchronous discard operation with this filesystem.
Refer to your operating system vendor for specific instructions on enabling the discard feature on your filesystem.
| Important: |
|
Using the discard file system mount option can have its own performance impact. Older devices may not support queuing TRIM commands, which has been known to cause system hangs while the TRIM operation completes. In those cases, batch TRIM is advisable. Redpanda recommends you test and validate the online discard operations with your operating system and hardware vendor before putting this configuration into production. |
More Information on TRIM
Red Hat 8: Discarding unused blocks
Frequently Asked Questions
Why do I see a latency spike in Redpanda publish/consume operations when fstrim runs?
The fstrim process iterates through all blocks in a mounted filesystem to determine which blocks the filesystem has freed and marked as unused. fstrim uses this as a signal to the underlying device to trigger the TRIM command on the physical blocks, freeing the device to re-use them in future write requests. Because this walks the block list for each configured filesystem, this can cause a high storage I/O load.
If the fstrim operation is causing significant impact, you may want to consider switching to the online discard support for your filesystem. This will help amortize the impact of the TRIM over time by allowing the TRIMs to happen as the blocks are freed in the filesystem when files are removed.
How frequently should I run TRIM?
This will depend on the churn rate of data written to disk, and how much free capacity there is on the device. When we talk about the churn rate, we mean the frequency at which data is written to and deleted from disk. Additionally, the amount of free space on the device can impact how frequently the TRIM operation is required. If the disk is consistently full or you are consistently churning large volumes of data, you may need to run the TRIM operation more frequently.
If using the batch or periodic TRIM operation with fstrim, start with a weekly cycle and move to a shorter time frame as necessary.
Refer to your operating system vendor for more specific information.
When should I choose a batch over an online discard configuration?
The choice will depend upon things such as local administrative policy, OS and filesystem support, hardware support, and where your tolerance for disk impact lies.
Start with using batch discarding with fstrim and consider switching to using online discard if the latency impact of the fstrim is too great.
How much latency impact is there to Redpanda?
It will depend entirely on the customer use case. We’ve seen publish/consume latencies spike going from tens of milliseconds, to upwards of several hundred milliseconds during the period where fstrim was running on a node.
Will this also affect containers or VMs?
In all likelihood, yes. We are still researching this.
You should refer to your hypervisor or container vendor about the impact of TRIM operations on SSD or NVME used within those environments.
Do I need this on my AWS EC2 instances with local NVME storage?
AWS guidance is that the user is responsible for issuing TRIM commands for NVME instance storage, either through fstrim or the discard mount option for your filesystems.
Redpanda recommends you enable one of the batch or online discard mechanisms as there may be other unforeseen
I’m using LVM, dm-crypt, or other Linux Software RAID. Should I enable discarding?
These features abstract access to the underlying hardware. There may be additional steps for working with discard support in these specific configurations. In some cases, you may not want to enable discarding blocks when encrypting the whole filesystem.
Check with your operating system vendor for specifics to ensure that TRIM operations are correctly passed down to the underlying hardware.