ZPOOL-TRIM(8)
π ZPOOL-TRIM π
okay bestie, welcome to zpool-trim β it's the System Manager's Manual page for the little command that starts a TRIM of free space in a ZFS storage pool. yes she's a real one. let's get into it β¨
π¦ NAME π¦
zpool-trim β initiate TRIM of free space in ZFS storage pool
πΈ SYNOPSIS πΈ
zpool trim [-dw] [-r rate] [-c|-s] -a|pool [device]β¦
β¨ DESCRIPTION β¨
So basically: this kicks off an immediate, on-demand TRIM operation across all the free space in a pool. what it's doing is telling the underlying storage devices about every single block in the pool that's no longer allocated anymore, which is literally how thinly provisioned devices get their space back. reclaiming, slay π
ngl the best part: you can run a manual on-demand TRIM whenever you want, totally regardless of the autotrim pool property setting. it does not care. it's not waiting for permission. fr fr. but do go read the docs for the autotrim property (up above) if you wanna know which types of vdev devices can actually be trimmed π
π OPTIONS π
-a,--allβ run the TRIM operation on all the pools. every last one π-d,--secureβ this one starts a secure TRIM. when it's a secure TRIM, the device pinky-promises that the data sitting on the trimmed blocks has actually been erased. this needs the device to support it, and not all SSDs do β so it's giving "results may vary" energy. no cap π-r,--raterate β controls how fast the TRIM operation moves along. if you don't pass this, TRIM just goes as quickly as it possibly can (main character energy, zero chill). the rate is in bytes per second, it applies per vdev, and it can be set differently for each leaf vdev π-c,--cancelβ cancels trimming on the devices you name, or on all eligible devices if you name none. β οΈ if one or more of the target devices is invalid or isn't currently being trimmed, the command fails and nothing gets cancelled on any device. it's all or nothing, bestie.-s,--suspendβ suspends trimming on the specified devices, or all eligible devices if you didn't specify any. same deal as cancel: if one or more targets is invalid or not currently being trimmed, the command fails and no suspension happens on any device. then you can resume by runningzpool trimwith no flags on the relevant target devices π«Ά-w,--waitβ hang around until the devices are done being trimmed before returning. patience is a virtue ig π§
π PERIODIC TRIM π
On machines running systemd, you can enable trim timers per-pool. there are weekly and monthly timer units already provided, icons π
systemctl enable zfs-trim-weekly@rpool.timer --now
systemctl enable zfs-trim-monthly@otherpool.timer --now
On Debian systems there's an extra little bonus: a periodic TRIM runs for all online pools on the first Sunday of each month, and you don't have to enable any per-pool timer for it to happen. whether a given pool actually gets trimmed is controlled by the org.debian:periodic-trim user property on that pool's root dataset β and it accepts exactly three values:
autoβ which is the default, and it's the same as unsetenabledisable
and here's the tea on auto: in that mode, only devices whose TRIM support is known to be safe get trimmed. check /usr/share/doc/zfsutils-linux/README.Debian for the device classification rules and all the other details π
π SEE ALSO π
systemd.timer(5), zpoolprops(7), zpool-initialize(8), zpool-wait(8)
okay that's the whole page, you ate that π this was OpenZFS, dated July 30, 2025 β go trim something, but like, responsibly πβ¨
π¦ where this page comes from
- ubuntu stonking: zfsutils-linux 2.4.4-1ubuntu4 Β· CDDL-1.0
- π the page's license: CDDL-1.0
- Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
- Copyright (c) 2012, 2018 by Delphix. All rights reserved
- Copyright (c) 2012 Cyril Plisko. All Rights Reserved
- Copyright (c) 2017 Datto Inc
- Copyright (c) 2018 George Melikov. All Rights Reserved
- Copyright 2017 Nexenta Systems, Inc
- Copyright (c) 2017 Open-E, Inc. All Rights Reserved
- Copyright (c) 2025 Hewlett Packard Enterprise Development LP
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms