xref: /freebsd/sys/contrib/openzfs/man/man8/zpool-trim.8 (revision eda14cbc264d6969b02f2b1994cef11148e914f1)
1*eda14cbcSMatt Macy.\"
2*eda14cbcSMatt Macy.\" CDDL HEADER START
3*eda14cbcSMatt Macy.\"
4*eda14cbcSMatt Macy.\" The contents of this file are subject to the terms of the
5*eda14cbcSMatt Macy.\" Common Development and Distribution License (the "License").
6*eda14cbcSMatt Macy.\" You may not use this file except in compliance with the License.
7*eda14cbcSMatt Macy.\"
8*eda14cbcSMatt Macy.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*eda14cbcSMatt Macy.\" or http://www.opensolaris.org/os/licensing.
10*eda14cbcSMatt Macy.\" See the License for the specific language governing permissions
11*eda14cbcSMatt Macy.\" and limitations under the License.
12*eda14cbcSMatt Macy.\"
13*eda14cbcSMatt Macy.\" When distributing Covered Code, include this CDDL HEADER in each
14*eda14cbcSMatt Macy.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*eda14cbcSMatt Macy.\" If applicable, add the following below this CDDL HEADER, with the
16*eda14cbcSMatt Macy.\" fields enclosed by brackets "[]" replaced with your own identifying
17*eda14cbcSMatt Macy.\" information: Portions Copyright [yyyy] [name of copyright owner]
18*eda14cbcSMatt Macy.\"
19*eda14cbcSMatt Macy.\" CDDL HEADER END
20*eda14cbcSMatt Macy.\"
21*eda14cbcSMatt Macy.\"
22*eda14cbcSMatt Macy.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
23*eda14cbcSMatt Macy.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
24*eda14cbcSMatt Macy.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
25*eda14cbcSMatt Macy.\" Copyright (c) 2017 Datto Inc.
26*eda14cbcSMatt Macy.\" Copyright (c) 2018 George Melikov. All Rights Reserved.
27*eda14cbcSMatt Macy.\" Copyright 2017 Nexenta Systems, Inc.
28*eda14cbcSMatt Macy.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
29*eda14cbcSMatt Macy.\"
30*eda14cbcSMatt Macy.Dd February 25, 2020
31*eda14cbcSMatt Macy.Dt ZPOOL-TRIM 8
32*eda14cbcSMatt Macy.Os
33*eda14cbcSMatt Macy.Sh NAME
34*eda14cbcSMatt Macy.Nm zpool Ns Pf - Cm trim
35*eda14cbcSMatt Macy.Nd Initiate immediate TRIM operations for all free space in a ZFS storage pool
36*eda14cbcSMatt Macy.Sh SYNOPSIS
37*eda14cbcSMatt Macy.Nm
38*eda14cbcSMatt Macy.Cm trim
39*eda14cbcSMatt Macy.Op Fl dw
40*eda14cbcSMatt Macy.Op Fl r Ar rate
41*eda14cbcSMatt Macy.Op Fl c | Fl s
42*eda14cbcSMatt Macy.Ar pool
43*eda14cbcSMatt Macy.Op Ar device Ns ...
44*eda14cbcSMatt Macy.Sh DESCRIPTION
45*eda14cbcSMatt Macy.Bl -tag -width Ds
46*eda14cbcSMatt Macy.It Xo
47*eda14cbcSMatt Macy.Nm
48*eda14cbcSMatt Macy.Cm trim
49*eda14cbcSMatt Macy.Op Fl dw
50*eda14cbcSMatt Macy.Op Fl c | Fl s
51*eda14cbcSMatt Macy.Ar pool
52*eda14cbcSMatt Macy.Op Ar device Ns ...
53*eda14cbcSMatt Macy.Xc
54*eda14cbcSMatt MacyInitiates an immediate on-demand TRIM operation for all of the free space in
55*eda14cbcSMatt Macya pool.  This operation informs the underlying storage devices of all blocks
56*eda14cbcSMatt Macyin the pool which are no longer allocated and allows thinly provisioned
57*eda14cbcSMatt Macydevices to reclaim the space.
58*eda14cbcSMatt Macy.Pp
59*eda14cbcSMatt MacyA manual on-demand TRIM operation can be initiated irrespective of the
60*eda14cbcSMatt Macy.Sy autotrim
61*eda14cbcSMatt Macypool property setting.  See the documentation for the
62*eda14cbcSMatt Macy.Sy autotrim
63*eda14cbcSMatt Macyproperty above for the types of vdev devices which can be trimmed.
64*eda14cbcSMatt Macy.Bl -tag -width Ds
65*eda14cbcSMatt Macy.It Fl d -secure
66*eda14cbcSMatt MacyCauses a secure TRIM to be initiated.  When performing a secure TRIM, the
67*eda14cbcSMatt Macydevice guarantees that data stored on the trimmed blocks has been erased.
68*eda14cbcSMatt MacyThis requires support from the device and is not supported by all SSDs.
69*eda14cbcSMatt Macy.It Fl r -rate Ar rate
70*eda14cbcSMatt MacyControls the rate at which the TRIM operation progresses.  Without this
71*eda14cbcSMatt Macyoption TRIM is executed as quickly as possible. The rate, expressed in bytes
72*eda14cbcSMatt Macyper second, is applied on a per-vdev basis and may be set differently for
73*eda14cbcSMatt Macyeach leaf vdev.
74*eda14cbcSMatt Macy.It Fl c, -cancel
75*eda14cbcSMatt MacyCancel trimming on the specified devices, or all eligible devices if none
76*eda14cbcSMatt Macyare specified.
77*eda14cbcSMatt MacyIf one or more target devices are invalid or are not currently being
78*eda14cbcSMatt Macytrimmed, the command will fail and no cancellation will occur on any device.
79*eda14cbcSMatt Macy.It Fl s -suspend
80*eda14cbcSMatt MacySuspend trimming on the specified devices, or all eligible devices if none
81*eda14cbcSMatt Macyare specified.
82*eda14cbcSMatt MacyIf one or more target devices are invalid or are not currently being
83*eda14cbcSMatt Macytrimmed, the command will fail and no suspension will occur on any device.
84*eda14cbcSMatt MacyTrimming can then be resumed by running
85*eda14cbcSMatt Macy.Nm zpool Cm trim
86*eda14cbcSMatt Macywith no flags on the relevant target devices.
87*eda14cbcSMatt Macy.It Fl w -wait
88*eda14cbcSMatt MacyWait until the devices are done being trimmed before returning.
89*eda14cbcSMatt Macy.El
90*eda14cbcSMatt Macy.El
91*eda14cbcSMatt Macy.Sh SEE ALSO
92*eda14cbcSMatt Macy.Xr zpool-initialize 8 ,
93*eda14cbcSMatt Macy.Xr zpool-wait 8 ,
94*eda14cbcSMatt Macy.Xr zpoolprops 8
95