I'm working with a linux server and wanted to know if there is a way that I can find out that my SSD supports fstrim or not. I tried hdparm -I /dev/sda, but it's not available and I can't install it. Is there any other way I can do it? Any help is appreciated. Thanks!

I'm also curious to know what happens if I run fstrim on a device that doesn't support trim? Does it result in a no-op?

3 Answers 3


You may also try lsblk --discard

Non-zero values under DISC-GRAN and DISC-MAX indicate trim support.

$ lsblk --discard
nvme0n1              0      512B       2T         0
├─nvme0n1p1          0      512B       2T         0
├─nvme0n1p2          0      512B       2T         0
├─nvme0n1p3          0      512B       2T         0
└─nvme0n1p4          0      512B       2T         0
  └─cryptswap        0        0B       0B         0

Ensure your disk is trim compatible before running fstrim. Running fstrim on an SSD that does not provide trim support can result in data loss. For reference, see the Arch Wiki.



find /sys/devices -name trim -exec head {} +

==> /sys/devices/pci0000:00/0000:00:11.0/ata3/link3/dev3.0/ata_device/dev3.0/trim <==

Every SSD made in the past decade supports trim/discard. If it isn't supported, the command should just fail and not do anything. I say "should" because if you really have an SSD without trim it is of such poor branding lineage that the disk firmware quality is an extreme unknown quantity.

  • If connected through a raid controller, it may hide this capability. So it is useful to know for sure. Mar 19 at 23:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .