1eda14cbcSMatt Macy.\" 2eda14cbcSMatt Macy.\" CDDL HEADER START 3eda14cbcSMatt Macy.\" 4eda14cbcSMatt Macy.\" The contents of this file are subject to the terms of the 5eda14cbcSMatt Macy.\" Common Development and Distribution License (the "License"). 6eda14cbcSMatt Macy.\" You may not use this file except in compliance with the License. 7eda14cbcSMatt Macy.\" 8eda14cbcSMatt Macy.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*271171e0SMartin Matuska.\" or https://opensource.org/licenses/CDDL-1.0. 10eda14cbcSMatt Macy.\" See the License for the specific language governing permissions 11eda14cbcSMatt Macy.\" and limitations under the License. 12eda14cbcSMatt Macy.\" 13eda14cbcSMatt Macy.\" When distributing Covered Code, include this CDDL HEADER in each 14eda14cbcSMatt Macy.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15eda14cbcSMatt Macy.\" If applicable, add the following below this CDDL HEADER, with the 16eda14cbcSMatt Macy.\" fields enclosed by brackets "[]" replaced with your own identifying 17eda14cbcSMatt Macy.\" information: Portions Copyright [yyyy] [name of copyright owner] 18eda14cbcSMatt Macy.\" 19eda14cbcSMatt Macy.\" CDDL HEADER END 20eda14cbcSMatt Macy.\" 21eda14cbcSMatt Macy.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. 22eda14cbcSMatt Macy.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved. 23eda14cbcSMatt Macy.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved. 24eda14cbcSMatt Macy.\" Copyright (c) 2017 Datto Inc. 25eda14cbcSMatt Macy.\" Copyright (c) 2018 George Melikov. All Rights Reserved. 26eda14cbcSMatt Macy.\" Copyright 2017 Nexenta Systems, Inc. 27eda14cbcSMatt Macy.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved. 28eda14cbcSMatt Macy.\" 2916038816SMartin Matuska.Dd May 27, 2021 30eda14cbcSMatt Macy.Dt ZPOOL-TRIM 8 31eda14cbcSMatt Macy.Os 3216038816SMartin Matuska. 33eda14cbcSMatt Macy.Sh NAME 347877fdebSMatt Macy.Nm zpool-trim 3516038816SMartin Matuska.Nd initiate TRIM of free space in ZFS storage pool 36eda14cbcSMatt Macy.Sh SYNOPSIS 377877fdebSMatt Macy.Nm zpool 38eda14cbcSMatt Macy.Cm trim 39eda14cbcSMatt Macy.Op Fl dw 40eda14cbcSMatt Macy.Op Fl r Ar rate 4116038816SMartin Matuska.Op Fl c Ns | Ns Fl s 42eda14cbcSMatt Macy.Ar pool 4316038816SMartin Matuska.Oo Ar device Ns Oc Ns … 4416038816SMartin Matuska. 45eda14cbcSMatt Macy.Sh DESCRIPTION 46eda14cbcSMatt MacyInitiates an immediate on-demand TRIM operation for all of the free space in 4716038816SMartin Matuskaa pool. 4816038816SMartin MatuskaThis operation informs the underlying storage devices of all blocks 49eda14cbcSMatt Macyin the pool which are no longer allocated and allows thinly provisioned 50eda14cbcSMatt Macydevices to reclaim the space. 51eda14cbcSMatt Macy.Pp 52eda14cbcSMatt MacyA manual on-demand TRIM operation can be initiated irrespective of the 53eda14cbcSMatt Macy.Sy autotrim 5416038816SMartin Matuskapool property setting. 5516038816SMartin MatuskaSee the documentation for the 56eda14cbcSMatt Macy.Sy autotrim 57eda14cbcSMatt Macyproperty above for the types of vdev devices which can be trimmed. 58eda14cbcSMatt Macy.Bl -tag -width Ds 5916038816SMartin Matuska.It Fl d , -secure 6016038816SMartin MatuskaCauses a secure TRIM to be initiated. 6116038816SMartin MatuskaWhen performing a secure TRIM, the 62eda14cbcSMatt Macydevice guarantees that data stored on the trimmed blocks has been erased. 63eda14cbcSMatt MacyThis requires support from the device and is not supported by all SSDs. 6416038816SMartin Matuska.It Fl r , -rate Ar rate 6516038816SMartin MatuskaControls the rate at which the TRIM operation progresses. 6616038816SMartin MatuskaWithout this 6716038816SMartin Matuskaoption TRIM is executed as quickly as possible. 6816038816SMartin MatuskaThe rate, expressed in bytes 69eda14cbcSMatt Macyper second, is applied on a per-vdev basis and may be set differently for 70eda14cbcSMatt Macyeach leaf vdev. 71eda14cbcSMatt Macy.It Fl c , -cancel 72eda14cbcSMatt MacyCancel trimming on the specified devices, or all eligible devices if none 73eda14cbcSMatt Macyare specified. 74eda14cbcSMatt MacyIf one or more target devices are invalid or are not currently being 75eda14cbcSMatt Macytrimmed, the command will fail and no cancellation will occur on any device. 7616038816SMartin Matuska.It Fl s , -suspend 77eda14cbcSMatt MacySuspend trimming on the specified devices, or all eligible devices if none 78eda14cbcSMatt Macyare specified. 79eda14cbcSMatt MacyIf one or more target devices are invalid or are not currently being 80eda14cbcSMatt Macytrimmed, the command will fail and no suspension will occur on any device. 81eda14cbcSMatt MacyTrimming can then be resumed by running 82eda14cbcSMatt Macy.Nm zpool Cm trim 83eda14cbcSMatt Macywith no flags on the relevant target devices. 8416038816SMartin Matuska.It Fl w , -wait 85eda14cbcSMatt MacyWait until the devices are done being trimmed before returning. 86eda14cbcSMatt Macy.El 871f1e2261SMartin Matuska.Sh PERIODIC TRIM 881f1e2261SMartin MatuskaOn machines using systemd, trim timers can be enabled on a per-pool basis. 891f1e2261SMartin Matuska.Nm weekly 901f1e2261SMartin Matuskaand 911f1e2261SMartin Matuska.Nm monthly 921f1e2261SMartin Matuskatimer units are provided. 931f1e2261SMartin Matuska.Bl -tag -width Ds 941f1e2261SMartin Matuska.It Xo 951f1e2261SMartin Matuska.Xc 961f1e2261SMartin Matuska.Nm systemctl 971f1e2261SMartin Matuska.Cm enable 981f1e2261SMartin Matuska.Cm zfs-trim-\fIweekly\fB@\fIrpool\fB.timer 991f1e2261SMartin Matuska.Cm --now 1001f1e2261SMartin Matuska.It Xo 1011f1e2261SMartin Matuska.Xc 1021f1e2261SMartin Matuska.Nm systemctl 1031f1e2261SMartin Matuska.Cm enable 1041f1e2261SMartin Matuska.Cm zfs-trim-\fImonthly\fB@\fIotherpool\fB.timer 1051f1e2261SMartin Matuska.Cm --now 1061f1e2261SMartin Matuska.El 10716038816SMartin Matuska. 108eda14cbcSMatt Macy.Sh SEE ALSO 1091f1e2261SMartin Matuska.Xr systemd.timer 5 , 1103ff01b23SMartin Matuska.Xr zpoolprops 7 , 111eda14cbcSMatt Macy.Xr zpool-initialize 8 , 1123ff01b23SMartin Matuska.Xr zpool-wait 8 113