Date: Wed, 26 Feb 2014 08:36:03 -0800 From: Matthew Ahrens <mahrens@delphix.com> To: Jason Breitman <jbreitman@zxcvm.com> Cc: fs@freebsd.org Subject: Re: Identify the ZFS Snapshot Disk Hog Message-ID: <CAJjvXiE8XreFmw4cakGTjM036CfaBLtQ5Ekscf08NjDag7s%2BUA@mail.gmail.com> In-Reply-To: <B5AC73B9-B7D1-4698-9CB8-1000C1AF472B@zxcvm.com> References: <B5AC73B9-B7D1-4698-9CB8-1000C1AF472B@zxcvm.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 26, 2014 at 7:38 AM, Jason Breitman <jbreitman@zxcvm.com> wrote: > What is my best tool or set of command line scripts to find the snapshot > or snapshots that are the disk hogs? > As you probably know, the problem is that the space "used" by a given snapshot only tells you how much space is unique to that snapshot (i.e. will be freed up when that snapshot is deleted, and is listed by the "zfs destroy -nv fs@snap" command). It doesn't tell you anything about how much space is shared between snapshots. One way to get a clue about this is the "written" property. (e.g "zfs list -r -o name,written -t snapshot ...") This tells you how much data was added in that snapshot. So deleting that snapshot and some immediately following might free up some space. The way to get a truly accurate view of the space shared by multiple snapshots is with an extension to the "zfs destroy -nv" command. You can list multiple snapshots, as described in the zfs manpage, below. This way you can see exactly how much space would be reclaimed, taking into account space that is shared among these snapshots. E.g. you could look at snapshots with a large "written" and then do "zfs destroy -nv fs@<snap_with_large_written>%<a_later_snap>", changing the later snap until you find a range that will free up enough space. zfs destroy [-dnpRrv] filesystem|volume@snap[%snap][,...] ... An inclusive range of snapshots may be specified by separating the first and last snapshots with a percent sign. The first and/or last snapshots may be left blank, in which case the filesystem's oldest or newest snapshot will be implied. Multiple snapshots (or ranges of snapshots) of the same filesystem or volume may be specified in a comma- separated list of snapshots. Only the snapshot's short name (the part after the @) should be specified when using a range or comma-separated list to identify multi- ple snapshots. > > I am familiar with the scripts > zfs list -r -o space,refer -t snapshot tank/username > > and with the command below to identify the estimated space savings > zfs destroy -nv tank/username@zfs-auto-snap_monthly-2013-11-01-03h00 > > When I go through and destroy the snapshots from oldest to the most > recent, I do not seem to reclaim any space and am forced to believe there > must be a better way. > If you don't reclaim any space even after deleting *all* snapshots of a given filesystem, then it wasn't the snapshots that were using space. You can determine this beforehand by looking at the "usedbysnapshots" property, e.g. in the output of "zfs list -o space" > The users in questions are developers so there is churn causing the > snapshots to be larger than an average user which means I will need to > create a process I can use on a regular basis. > I am using refquota for each user. > > OS: Freebsd 9.1 > I'm not sure if the "written" property and the "zfs destroy -nv <list of snaps>" are avilable in 9.1, you may need to upgrade to 9.2 to get them. --matt > > # zpool upgrade -v > This system is currently running ZFS pool version 28. > > The following versions are supported: > > VER DESCRIPTION > --- -------------------------------------------------------- > 1 Initial ZFS version > 2 Ditto blocks (replicated metadata) > 3 Hot spares and double parity RAID-Z > 4 zpool history > 5 Compression using the gzip algorithm > 6 bootfs pool property > 7 Separate intent log devices > 8 Delegated administration > 9 refquota and refreservation properties > 10 Cache devices > 11 Improved scrub performance > 12 Snapshot properties > 13 snapused property > 14 passthrough-x aclinherit > 15 user/group space accounting > 16 stmf property support > 17 Triple-parity RAID-Z > 18 Snapshot user holds > 19 Log device removal > 20 Compression using zle (zero-length encoding) > 21 Deduplication > 22 Received properties > 23 Slim ZIL > 24 System attributes > 25 Improved scrub stats > 26 Improved snapshot deletion performance > 27 Improved snapshot creation performance > 28 Multiple vdev replacements > > For more information on a particular version, including supported releases, > see the ZFS Administration Guide. > > # zfs upgrade -v > The following filesystem versions are supported: > > VER DESCRIPTION > --- -------------------------------------------------------- > 1 Initial ZFS filesystem version > 2 Enhanced directory entries > 3 Case insensitive and filesystem user identifier (FUID) > 4 userquota, groupquota properties > 5 System attributes > > For more information on a particular version, including supported releases, > see the ZFS Administration Guide. > > > > Jason Breitman > jbreitman@zxcvm.com > > > > > _______________________________________________ > freebsd-fs@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-fs > To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJjvXiE8XreFmw4cakGTjM036CfaBLtQ5Ekscf08NjDag7s%2BUA>