From owner-freebsd-fs@FreeBSD.ORG Wed Feb 26 16:36:03 2014 Return-Path: Delivered-To: fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CB668828 for ; Wed, 26 Feb 2014 16:36:03 +0000 (UTC) Received: from mail-pb0-x229.google.com (mail-pb0-x229.google.com [IPv6:2607:f8b0:400e:c01::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 96D811C86 for ; Wed, 26 Feb 2014 16:36:03 +0000 (UTC) Received: by mail-pb0-f41.google.com with SMTP id jt11so1219018pbb.0 for ; Wed, 26 Feb 2014 08:36:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=delphix.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=t9R7fl6ouVIBb5gAlVkmyl66ResJa7uNG6aF5zBHdhk=; b=YLHH9cPlgKs4hxGm+Jj6E+eTWd1YYfv1a/SX0+LpFt+kdpYDmYny+nu3ueK6A2/zuZ j9MKT1v5cUwVAItDhI5flnIBL5fhCI8mpJfMG+c7Zil3RbfMcZi8MKEwm0jCAAbE2RbC dw5FlXsUkUStcCq8oNKNRXPnf8YeZYQLVSjps= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=t9R7fl6ouVIBb5gAlVkmyl66ResJa7uNG6aF5zBHdhk=; b=a5HxKs6Qp897BcAsLnd5kQOp95yTHPbi5d8Na2zbAJXI3H6EmiaN/8a+5D/VIXwHNl /5HljiV0QNQhg2kkhsKKYn0YfU455t3w3P2LhkaIySUvKhJ3AO0FBCJoBVv1hO9lEhQG m4B1qN27nbvs9gvCKgig1RokgAHtl/IsGHuV2mv+MelqfZwvLepAeGuh9bH9t0d31vO/ mTiSal55/URf6zYmbfJhb3zbn2RYY5wlFdZl26+QGHtarBz9Ewfbvt66p+z4mxmPFdsu 7in8Wr692yry44FtvqmN/yZckQGMyMgGkPyUSLyWlmHJxVwMC1+GxrKh1xRqfoOa1mDk ymVw== X-Gm-Message-State: ALoCoQl2U/zWHvd/f2AvPwGBNlkhMzs0lt+QXTEpImno95PwO+XoI0mAOcr9VaKTTvQXCuVbi2bs MIME-Version: 1.0 X-Received: by 10.68.241.198 with SMTP id wk6mr7822009pbc.11.1393432563222; Wed, 26 Feb 2014 08:36:03 -0800 (PST) Received: by 10.70.58.41 with HTTP; Wed, 26 Feb 2014 08:36:03 -0800 (PST) In-Reply-To: References: Date: Wed, 26 Feb 2014 08:36:03 -0800 Message-ID: Subject: Re: Identify the ZFS Snapshot Disk Hog From: Matthew Ahrens To: Jason Breitman Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.17 Cc: fs@freebsd.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Feb 2014 16:36:04 -0000 On Wed, Feb 26, 2014 at 7:38 AM, Jason Breitman 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@%", 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 " 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" >