Re: test if a subvolume is a snapshot?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxx
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    http://www.tik.uni-stuttgart.de/
REF:<20170908131035.GO31874@xxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux