public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
To: linux-btrfs@vger.kernel.org
Subject: Re: test if a subvolume is a snapshot?
Date: Fri, 8 Sep 2017 20:41:57 +0200	[thread overview]
Message-ID: <20170908184157.GB7876@rus.uni-stuttgart.de> (raw)
In-Reply-To: <20170908131035.GO31874@twin.jikos.cz>

On Fri 2017-09-08 (15:10), David Sterba wrote:
> On Fri, Sep 08, 2017 at 10:54:46AM +0200, Ulli Horlacher wrote:
> 
> > How can I test if a subvolume is a snapshot?
> 
> The inode number is 256 on a btrfs filesystem:
> 
> if [ stat -f --format=%T $path = btrfs -a stat --format=%i $path = 256 ]; ...
> 
> The directory that's result of snapshotting a subvolume, also called
> EMPTY_SUBVOL has inode number 2, but that's not considered a normal
> subvolume.

This is not true.

root@fex:~# mount | grep /mnt/test
/dev/sdc1 on /mnt/test type btrfs (rw,relatime,space_cache,subvolid=5,subvol=/)

root@fex:~# btrfs subvol show /mnt/test
/mnt/test is toplevel subvolume

root@fex:~# btrfs subvolume snapshot -r /mnt/test /mnt/test/.snapshot/test
Create a readonly snapshot of '/mnt/test' in '/mnt/test/.snapshot/test'

root@fex:~# stat --format=%i /mnt/test
256

root@fex:~# stat --format=%i /mnt/test/.snapshot/test
256

No difference: both have inode=256


-- 
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum TIK         
Universitaet Stuttgart         E-Mail: horlacher@tik.uni-stuttgart.de
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    http://www.tik.uni-stuttgart.de/
REF:<20170908131035.GO31874@twin.jikos.cz>

  parent reply	other threads:[~2017-09-08 18:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-08  8:54 test if a subvolume is a snapshot? Ulli Horlacher
2017-09-08 11:37 ` Peter Grandi
2017-09-08 13:10 ` David Sterba
2017-09-08 15:25   ` Tomasz Kłoczko
2017-09-08 15:38     ` Hugo Mills
2017-09-08 16:12       ` Tomasz Kłoczko
2017-09-08 16:24         ` Hugo Mills
2017-09-08 16:39       ` David Sterba
2017-09-08 18:09         ` Tomasz Kłoczko
2017-09-08 18:44           ` David Sterba
2017-09-08 19:06           ` Austin S. Hemmelgarn
2017-09-08 20:54             ` Tomasz Kłoczko
2017-09-11 12:44               ` Austin S. Hemmelgarn
2017-09-08 16:27     ` David Sterba
2017-09-08 18:41   ` Ulli Horlacher [this message]
2017-09-08 18:53     ` David Sterba

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=20170908184157.GB7876@rus.uni-stuttgart.de \
    --to=framstag@rus.uni-stuttgart.de \
    --cc=linux-btrfs@vger.kernel.org \
    /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