Wednesday, January 21, 2026

Force an immediate retrim of your SSD


The current episode of Security Now podcast # 1061 discuses the automated trim command on your SSD drives which is run on your behalf by Windows. I run Lubuntu 20.04 and was curious how it is run on my O/S.

To force an immediate retrim of your SSD on Lubuntu 24.04, you can use the fstrim command in your terminal. This will manually discard all unused blocks on your mounted filesystems.1

The Command

Open your terminal (usually Ctrl+Alt+T) and run:

Bash
sudo fstrim -av

Breakdown of Flags

  • sudo: Grants the necessary administrative privileges to communicate with the hardware.

  • -a (all): Tells the command to check and trim all mounted filesystems that support the operation (e.g., your root / and /home partitions).

  • -v (verbose): Forces the command to print the results to the screen, showing you exactly how many bytes were trimmed.

Interpreting the Output

If the operation is successful, you will see output similar to this:

Plaintext
/boot/efi: 10 MiB (10485760 bytes) trimmed
/: 15 GiB (16106127360 bytes) trimmed
  • If you see a byte count: The trim was successful.

  • If you see "0 bytes trimmed": The drive was likely already trimmed recently (either by the automatic timer or a previous manual run).

  • If you see "the discard operation is not supported": Your SSD controller may not support TRIM, or it might be disabled at the kernel/hardware level.

Standard Automation (Good to Know)

Lubuntu 24.04 typically handles this automatically using a background timer. You generally do not need to run the manual command often.

To check if your automatic schedule is active, run:

Bash
systemctl status fstrim.timer

You should see Active: active (waiting) with a green dot, indicating it is scheduled to run weekly.


YouTube Resource

For a visual walkthrough on enabling and understanding TRIM operations in Linux, you can watch this video:

How to Enable Trim in Linux for SSDs

This video provides a straightforward guide on using the terminal to manage SSD trim settings, relevant for confirming your configuration.

No comments:

Post a Comment