fstrim

Discard unused blocks on a mounted filesystem. Only supported by flash memory devices such as SSDs and microSD cards. More information: <https://manned.org/fstrim>.

Install

All systems
curl cmd.cat/fstrim.sh
Debian Debian
apt-get install util-linux
Ubuntu
apt-get install util-linux
Alpine
apk add util-linux
Arch Arch Linux
pacman -S util-linux
image/svg+xml Kali Linux
apt-get install util-linux
CentOS
yum install util-linux
Fedora
dnf install util-linux
Windows (WSL2)
sudo apt-get update sudo apt-get install util-linux
OS X
brew install util-linux
Raspbian
apt-get install util-linux
Docker
docker run cmd.cat/fstrim fstrim powered by Commando

Discard unused blocks on a mounted filesystem. Only supported by flash memory devices such as SSDs and microSD cards. More information: <https://manned.org/fstrim>.

  • Trim unused blocks on all mounted partitions that support it:
    sudo fstrim --all
  • Trim unused blocks on a specified partition:
    sudo fstrim /
  • Display statistics after trimming:
    sudo fstrim --verbose /

© tl;dr; authors and contributors