From 3b887e485ccc70b34baf02bd229f1808aa01ef14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Wed, 16 Mar 2022 18:48:01 +0100 Subject: [PATCH] man: zfs-destroy.8: import examples from zfs.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia ZiemiaƄska Closes #13228 --- man/man8/zfs-destroy.8 | 50 +++++++++++++++++++++++++++++++++++++++++- man/man8/zfs.8 | 3 ++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/man/man8/zfs-destroy.8 b/man/man8/zfs-destroy.8 index 51d9b7ab8e..26926d8dcb 100644 --- a/man/man8/zfs-destroy.8 +++ b/man/man8/zfs-destroy.8 @@ -29,7 +29,7 @@ .\" Copyright 2018 Nexenta Systems, Inc. .\" Copyright 2019 Joyent, Inc. .\" -.Dd June 30, 2019 +.Dd March 16, 2022 .Dt ZFS-DESTROY 8 .Os . @@ -173,6 +173,54 @@ behavior for mounted file systems in use. The given bookmark is destroyed. .El . +.Sh EXAMPLES +.\" These are, respectively, examples 3, 10, 15 from zfs.8 +.\" Make sure to update them bidirectionally +.Ss Example 1 : No Creating and Destroying Multiple Snapshots +The following command creates snapshots named +.Ar yesterday No of Ar pool/home +and all of its descendent file systems. +Each snapshot is mounted on demand in the +.Pa .zfs/snapshot +directory at the root of its file system. +The second command destroys the newly created snapshots. +.Dl # Nm zfs Cm snapshot Fl r Ar pool/home Ns @ Ns Ar yesterday +.Dl # Nm zfs Cm destroy Fl r Ar pool/home Ns @ Ns Ar yesterday +. +.Ss Example 2 : No Promoting a ZFS Clone +The following commands illustrate how to test out changes to a file system, and +then replace the original file system with the changed one, using clones, clone +promotion, and renaming: +.Bd -literal -compact -offset Ds +.No # Nm zfs Cm create Ar pool/project/production + populate /pool/project/production with data +.No # Nm zfs Cm snapshot Ar pool/project/production Ns @ Ns Ar today +.No # Nm zfs Cm clone Ar pool/project/production@today pool/project/beta + make changes to /pool/project/beta and test them +.No # Nm zfs Cm promote Ar pool/project/beta +.No # Nm zfs Cm rename Ar pool/project/production pool/project/legacy +.No # Nm zfs Cm rename Ar pool/project/beta pool/project/production + once the legacy version is no longer needed, it can be destroyed +.No # Nm zfs Cm destroy Ar pool/project/legacy +.Ed +. +.Ss Example 3 : No Performing a Rolling Snapshot +The following example shows how to maintain a history of snapshots with a +consistent naming scheme. +To keep a week's worth of snapshots, the user destroys the oldest snapshot, +renames the remaining snapshots, and then creates a new snapshot, as follows: +.Bd -literal -compact -offset Ds +.No # Nm zfs Cm destroy Fl r Ar pool/users@7daysago +.No # Nm zfs Cm rename Fl r Ar pool/users@6daysago No @ Ns Ar 7daysago +.No # Nm zfs Cm rename Fl r Ar pool/users@5daysago No @ Ns Ar 6daysago +.No # Nm zfs Cm rename Fl r Ar pool/users@4daysago No @ Ns Ar 5daysago +.No # Nm zfs Cm rename Fl r Ar pool/users@3daysago No @ Ns Ar 4daysago +.No # Nm zfs Cm rename Fl r Ar pool/users@2daysago No @ Ns Ar 3daysago +.No # Nm zfs Cm rename Fl r Ar pool/users@yesterday No @ Ns Ar 2daysago +.No # Nm zfs Cm rename Fl r Ar pool/users@today No @ Ns Ar yesterday +.No # Nm zfs Cm snapshot Fl r Ar pool/users Ns @ Ns Ar today +.Ed +. .Sh SEE ALSO .Xr zfs-create 8 , .Xr zfs-hold 8 diff --git a/man/man8/zfs.8 b/man/man8/zfs.8 index f103278a01..570899121e 100644 --- a/man/man8/zfs.8 +++ b/man/man8/zfs.8 @@ -299,7 +299,8 @@ if an error occurs, and if invalid command line options were specified. . .Sh EXAMPLES -.\" Examples 1, 4, 6, 14, 16 are shared with zfs-set.8. +.\" Examples 1, 4, 6, 7, 11, 14, 16 are shared with zfs-set.8. +.\" Examples 3, 10, 15 are shared with zfs-destroy.8. .\" Examples 5 are shared with zfs-list.8. .\" Examples 8 are shared with zfs-rollback.8. .\" Examples 9, 10 are shared with zfs-clone.8.