Discard
A block-storage request indicating that specified logical ranges are no longer needed by the caller.
Linux discard is a storage-stack operation, not a synonym for one wire command. Filesystem-aware fstrim selects unused blocks; direct blkdiscard acts on device ranges and can destroy live data. [1] [2]
Process success alone is insufficient: --dry-run omits FITRIM; --all or --fstab silently ignore specified unsupported/read-only errors; --quiet-unsupported clears unsupported-filesystem failure status. A verbose fstrim byte count describes potential discard, not newly reclaimed physical space, and repeated runs can report the same ranges. With no_discard_passdown, dm-thin removes mappings without forwarding discards to the underlying data device; ignore_discard disables discard support instead. Passdown enabled at table load can be disabled if the backing device lacks support; inspect pool status. Mapping removal and physical-device deallocation are distinct outcomes. [1] [5]
Linux reports discard granularity and hardware/software request-size limits. Support at one layer is not proof that a request reaches the final device. Encrypted dm-crypt mappings ignore discard by default; allow_discards enables forwarding, which may reveal allocation patterns when discarded ranges remain identifiable. The documented warning concerns allocation-pattern leakage, not a general confidentiality guarantee. [6] [4]
Relations
- related
- TRIM, SCSI UNMAP, NVMe, UNMAP, Thin provisioning, Deallocated read behavior, dm-crypt, FITRIM
Advantages
- A minimum free-extent length can skip fragmented free space to reduce the work of a filesystem trim. [1]
Limitations
- Zero-filling and secure discard are separate blkdiscard operations; ordinary discard proves neither. [2]
Citations
- util-linux 2.41.2: fstrim manual, verbose output
- util-linux 2.41.2: blkdiscard manual
- Linux v6.12: dm-crypt, encryption target, integrity metadata and allow_discards
- Linux v6.12: thin provisioning, ignore_discard and no_discard_passdown
- Linux v6.12: stable sysfs block ABI, discard granularity and request limits