SSD TRIM
TRIM lets an SSD know which blocks are no longer in use, so the controller can erase them in advance instead of during a later write. Without it, write performance degrades over time as the drive runs out of pre-erased blocks.
There are two ways to issue TRIM commands, and you only need one of them.
| Method | How it works | Status on ParrotOS |
|---|---|---|
Periodic (fstrim.timer) |
A weekly systemd timer trims all mounted filesystems at once | Enabled by default |
Continuous (discard) |
The kernel sends a TRIM command on every file deletion | Off by default |
Periodic TRIM is the recommended approach and is already active, so in most cases there is nothing to configure. Continuous TRIM adds latency to every delete operation and, on some older drives, degrades performance instead of improving it.
Check That Your Drive Supports TRIM
Section titled “Check That Your Drive Supports TRIM”List your drives and their discard capabilities:
lsblk --discardIf the DISC-GRAN and DISC-MAX columns show non-zero values, the device supports TRIM:
NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZEROnvme0n1 0 512B 2T 0├─nvme0n1p1 0 512B 2T 0└─nvme0n1p2 0 512B 2T 0A value of 0B in both columns means the drive does not advertise TRIM support, and neither method below will have any effect.
Periodic TRIM (Recommended)
Section titled “Periodic TRIM (Recommended)”Check that the timer is active:
systemctl status fstrim.timerIf it is not enabled, enable it:
sudo systemctl enable --now fstrim.timerYou can inspect when it last ran and when it will run next:
systemctl list-timers fstrim.timerTo trim every mounted filesystem immediately, without waiting for the timer:
sudo fstrim --all --verboseContinuous TRIM (Optional)
Section titled “Continuous TRIM (Optional)”Only configure this if you have a specific reason to prefer it over the timer. Do not enable both: running discard alongside fstrim.timer provides no benefit.
sudo cp /etc/fstab /etc/fstab.bakOpen the file:
sudo nano /etc/fstabLocate the line for the filesystem you want to trim. A root ext4 entry looks like this:
UUID=1cd2fc4f-7d99-4c7a-8ea7-6f9a2d5e5960 / ext4 errors=remount-ro 0 1Add discard to the comma-separated options field, keeping every other option intact:
UUID=1cd2fc4f-7d99-4c7a-8ea7-6f9a2d5e5960 / ext4 discard,errors=remount-ro 0 1Verify that the file still parses correctly before rebooting:
sudo findmnt --verify --verboseApply the new options without a reboot:
sudo mount -o remount /If fstrim.timer is enabled, disable it now that TRIM is handled at mount level:
sudo systemctl disable --now fstrim.timer