Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Hugo Mills <hugo@carfax.org.uk>
To: Justin Maggard <jmaggard10@gmail.com>
Cc: Qu Wenruo <quwenruo@cn.fujitsu.com>,
	russell@coker.com.au, BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: snapshot space use
Date: Thu, 9 Apr 2015 22:24:21 +0000	[thread overview]
Message-ID: <20150409222421.GW13864@carfax.org.uk> (raw)
In-Reply-To: <CAKgsxVQ8=Y43DbJ+cNJSt6sb9uPKSfNx+HxErnVMvA6grBCVyg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3224 bytes --]

On Thu, Apr 09, 2015 at 03:01:55PM -0700, Justin Maggard wrote:
> On Wed, Apr 8, 2015 at 5:45 PM, Qu Wenruo <quwenruo@cn.fujitsu.com> wrote:
> > Hi,
> >
> > You can use btrfs quota feature to do it.
> > Like this:
> >
> > # btrfs quota enable <MNT_POINT>
> > # btrfs quota rescan -w <MNT_POINT>
> > # btrfs qgroup show -prce <MNT_POINT>
> > qgroupid rfer    excl    max_rfer max_excl parent  child
> > -------- ----    ----    -------- -------- ------  -----
> > 0/5      2248704 12288   0        0        ---     ---
> > 0/256    5509120 3272704 0        0        ---     ---
> >
> >
> > rfer is all the space the subvolume takes.
> > excl is the exclusive space the subvolume takes.
> >
> 
> Yes, but this isn't as useful as it sounds if you have more than one
> snapshot.  Because if a file is included in at least two snapshots,
> it's no longer exclusive.  So AFAICT even with btrfs qgroups, you
> still cannot answer the question "How much space are my snapshots
> using?" for a given subvolume, unless you have only one snapshot.  But
> I'd be happy to be informed otherwise. :-)

   There are basically two useful answers to that question, depending
on how the question is specified, exactly:

1) How much space would I use if I copied this subvolume to a
   different filesystem?

2) How much space would I free up if I deleted this subvolume?

   Part 1 is the rfer answer. Part 2 is the excl answer.

   Which of these do you mean by "How much space are my snapshots
using?". The question as posed is highly ambiguous, and needs
considerably more precision before it can be answered.

   If you can pose the question more precisely, you might wish to ask
one of those questions about N subvolumes as a group -- this is
where(*) you would define a qgroup covering the subvols you're
interested in, and then use the above interface to ask the question
for the group of subvols as a whole.

   Hugo.

(*) I'm not an expert in qgroups. I may have the idea completely
wrong, but I think this is the right kind of approach.


> -Justin
> 
> > You can also refer to 'btrfs-quota'(8) and 'btrfs-qgroup'(8),
> > Also the following wiki can help:
> > https://btrfs.wiki.kernel.org/index.php/Quota_support
> >
> > NOTE: quota is not so stable and has some problem, but should give
> > you enough info.
> >
> > Thanks,
> > Qu
> >
> >> # zfs list -t snapshot
> >> NAME                        USED  AVAIL  REFER  MOUNTPOINT
> >> hetz0/be0-mail@2015-03-10  2.88G      -   387G  -
> >> hetz0/be0-mail@2015-03-11  1.12G      -   388G  -
> >> hetz0/be0-mail@2015-03-12  1.11G      -   388G  -
> >> hetz0/be0-mail@2015-03-13  1.19G      -   388G  -
> >> hetz0/be0-mail@2015-03-14  1.02G      -   388G  -
> >> hetz0/be0-mail@2015-03-15   989M      -   386G  -
> >>
> >> Is there any way to do something similar to the above ZFS command?  It's
> >> handy
> >> to know which snapshots are taking up the most space, especially when
> >> multiple
> >> subvols are being snapshotted.
> >>

-- 
Hugo Mills             | You've read the project plan. Forget that. We're
hugo@... carfax.org.uk | going to Do Stuff and Have Fun doing it.
http://carfax.org.uk/  |
PGP: E2AB1DE4          |                                           Jeremy Frey

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2015-04-09 22:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-09  0:39 snapshot space use Russell Coker
2015-04-09  0:45 ` Qu Wenruo
2015-04-09  9:02   ` Piotr Szymaniak
2015-04-09  9:26     ` Qu Wenruo
2015-04-09 22:01   ` Justin Maggard
2015-04-09 22:24     ` Hugo Mills [this message]
2015-04-09 23:27       ` Justin Maggard
2015-04-09 23:39         ` Hugo Mills
2015-04-10  0:32           ` Dongsheng Yang
2015-04-10  0:40             ` Justin Maggard
2015-04-10  0:48               ` Qu Wenruo
2015-04-10  7:55 ` Russell Coker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150409222421.GW13864@carfax.org.uk \
    --to=hugo@carfax.org.uk \
    --cc=jmaggard10@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo@cn.fujitsu.com \
    --cc=russell@coker.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox