Pcornel
Storage · Physical Storage Media › SSD

Garbage Collection

Cheat sheet · https://pcornel.dk/topic.php?topic=3888

Back to the Topic

Answer

Garbage collection in an SSD moves still-valid pages out of partly used blocks and erases them, so new writes have empty blocks. TRIM and spare area make it more efficient and reduce write amplification.

Remember

  • GC frees blocks by moving valid pages.
  • TRIM helps GC.
  • Spare area reduces write amplification.

First checks

  • fio sustained random write — performance drop when GC active
  • nvme smart-log /dev/nvme0 — writes
  • iostat -x 1 — latency spikes

Verify in this order

stale pages → GC moves valid data → erase → free blocks

Where it usually breaks

First mismatch in media/firmware → device controller → interface/link → host driver → block device → upper storage layer; preserve identity/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=3888

Confirmation

Confirm action

Continue?