$linuxjunkies
>

discard

also: TRIM, ATA TRIM, NVMe Dataset Management

A storage optimization feature that tells SSDs and thin-provisioned storage devices which data blocks are no longer needed, allowing them to reclaim space and improve performance.

The discard operation, also called TRIM for SSDs, notifies storage devices when data blocks become unused—typically when files are deleted or partitions are unmounted. Without discard, the storage device doesn't know which blocks are actually free, so it can't optimize its internal management.

For SSDs, discard allows the controller to erase blocks more efficiently and maintain better performance over time. For thin-provisioned storage (like cloud volumes), it lets the storage system reclaim unused space and reduce billing. You enable discard on a filesystem mount using the discard option in /etc/fstab or with the -o discard flag.

Example: mount -o discard /dev/sda1 /mnt mounts the partition with discard enabled. Alternatively, fstrim performs a one-time discard operation on mounted filesystems.

Related terms