Forrest logo
back to the fstrim tool

fstrim:tldr:9bff1

fstrim: Trim unused blocks on all mounted partitions that support it.
$ sudo fstrim --all
try on your machine

The command sudo fstrim --all is used to trim unused blocks on all mounted file systems using the fstrim tool with superuser (root) privileges.

Here's a breakdown of the command:

  • sudo: It stands for "superuser do" and is used to run the subsequent command with administrative privileges. The sudo command provides access to perform tasks that require higher privileges than what your current user account possesses.
  • fstrim: It is a utility that allows you to discard unused blocks on a file system. This command is particularly useful for solid-state drives (SSDs) to improve performance and extend the drive's lifespan. fstrim communicates with the underlying storage device to release the blocks that are no longer in use.
  • --all: This option tells fstrim to trim all mounted file systems. It ensures that all relevant file systems, such as the root file system ("/") and additional mounted partitions (e.g., "/home" or "/var"), are trimmed.

By using sudo fstrim --all, you trigger the fstrim process for all mounted file systems, initiating the discarding of unused blocks and optimizing disk performance.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the fstrim tool