linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* find snapshot parent?
@ 2019-07-06 15:53 Ulli Horlacher
  2019-07-06 16:57 ` Nikolay Borisov
  2019-07-06 23:24 ` Ulli Horlacher
  0 siblings, 2 replies; 10+ messages in thread
From: Ulli Horlacher @ 2019-07-06 15:53 UTC (permalink / raw)
  To: linux-btrfs

Is there a standard way to find the path of the subvolume parent of a
snapshot? 

For example:

root@xerus:/test# btrfs sub list /test
ID 269 gen 9818 top level 5 path tux/test
ID 1026 gen 9804 top level 1011 path tmp/xx/ss1
ID 1027 gen 9804 top level 1011 path tmp/xx/ss2

root@xerus:/test# btrfs subvolume show /test/tmp
/test/tmp
        Name:                   tmp
        UUID:                   5a873eca-9b6c-fc4e-aed5-eb287839d693
        Parent UUID:            -
        Received UUID:          -
        Creation time:          2019-07-04 00:17:11 +0200
        Subvolume ID:           1011
        Generation:             9813
        Gen at creation:        9749
        Parent ID:              5
        Top level ID:           5
        Flags:                  -
        Snapshot(s):
                                xx/ss1
                                xx/ss2

root@xerus:/test# btrfs subvolume show /test/tmp/xx/ss1
/test/tmp/xx/ss1
        Name:                   ss1
        UUID:                   3641bb81-d1fd-4440-8f29-6f17ff9ec4e1
        Parent UUID:            5a873eca-9b6c-fc4e-aed5-eb287839d693
        Received UUID:          -
        Creation time:          2019-07-05 11:13:15 +0200
        Subvolume ID:           1026
        Generation:             9804
        Gen at creation:        9793
        Parent ID:              1011
        Top level ID:           1011
        Flags:                  readonly
        Snapshot(s):

Must I call "btrfs subvolume show" for every subvolume to find the
matching Parent ID/UUID or parse the "Snapshot(s)" section?

And how can I see whether /test/tmp/xx/ss1 is a snapshot at all?
Do all snapshots have a "Parent UUID" and regular subvolumes not?

-- 
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:<20190706155353.GA13656@tik.uni-stuttgart.de>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: find snapshot parent?
  2019-07-06 15:53 find snapshot parent? Ulli Horlacher
@ 2019-07-06 16:57 ` Nikolay Borisov
  2019-07-06 20:43   ` Ulli Horlacher
  2019-07-06 23:24 ` Ulli Horlacher
  1 sibling, 1 reply; 10+ messages in thread
From: Nikolay Borisov @ 2019-07-06 16:57 UTC (permalink / raw)
  To: linux-btrfs



On 6.07.19 г. 18:53 ч., Ulli Horlacher wrote:
> Is there a standard way to find the path of the subvolume parent of a
> snapshot? 
> 
> For example:
> 
> root@xerus:/test# btrfs sub list /test
> ID 269 gen 9818 top level 5 path tux/test
> ID 1026 gen 9804 top level 1011 path tmp/xx/ss1
> ID 1027 gen 9804 top level 1011 path tmp/xx/ss2
> 
> root@xerus:/test# btrfs subvolume show /test/tmp
> /test/tmp
>         Name:                   tmp
>         UUID:                   5a873eca-9b6c-fc4e-aed5-eb287839d693
>         Parent UUID:            -
>         Received UUID:          -
>         Creation time:          2019-07-04 00:17:11 +0200
>         Subvolume ID:           1011
>         Generation:             9813
>         Gen at creation:        9749
>         Parent ID:              5
>         Top level ID:           5
>         Flags:                  -
>         Snapshot(s):
>                                 xx/ss1
>                                 xx/ss2
> 
> root@xerus:/test# btrfs subvolume show /test/tmp/xx/ss1
> /test/tmp/xx/ss1
>         Name:                   ss1
>         UUID:                   3641bb81-d1fd-4440-8f29-6f17ff9ec4e1
>         Parent UUID:            5a873eca-9b6c-fc4e-aed5-eb287839d693
>         Received UUID:          -
>         Creation time:          2019-07-05 11:13:15 +0200
>         Subvolume ID:           1026
>         Generation:             9804
>         Gen at creation:        9793
>         Parent ID:              1011
>         Top level ID:           1011
>         Flags:                  readonly
>         Snapshot(s):
> 
> Must I call "btrfs subvolume show" for every subvolume to find the
> matching Parent ID/UUID or parse the "Snapshot(s)" section?

That seems to be the way, looking at code for the Snapshot(s) section it
iterates every subvolume and checks if its Parent UUID matches the UUID
of the subvolume - if yes it adds that particular subvol (snapshots are
subvolumes with a parent) to the "SNapshot(s)" section.

> 
> And how can I see whether /test/tmp/xx/ss1 is a snapshot at all?
> Do all snapshots have a "Parent UUID" and regular subvolumes not?

Indeed, only snapshots have a Parent UUID.

> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: find snapshot parent?
  2019-07-06 16:57 ` Nikolay Borisov
@ 2019-07-06 20:43   ` Ulli Horlacher
  2019-07-07  5:27     ` Andrei Borzenkov
  2019-07-07  6:43     ` Nikolay Borisov
  0 siblings, 2 replies; 10+ messages in thread
From: Ulli Horlacher @ 2019-07-06 20:43 UTC (permalink / raw)
  To: linux-btrfs

On Sat 2019-07-06 (19:57), Nikolay Borisov wrote:

> > And how can I see whether /test/tmp/xx/ss1 is a snapshot at all?
> > Do all snapshots have a "Parent UUID" and regular subvolumes not?
> 
> Indeed, only snapshots have a Parent UUID.

Not all:

root@xerus:/test# btrfs subvolume snapshot -r /test /test/ss1
Create a readonly snapshot of '/test' in '/test/ss1'

root@xerus:/test# btrfs subvolume show /test/ss1
/test/ss1
        Name:                   ss1
        UUID:                   02bd07bc-0bab-3442-96be-40790e1ba9be
        Parent UUID:            -
        Received UUID:          -
        Creation time:          2019-07-06 22:37:37 +0200
        Subvolume ID:           1036
        Generation:             9824
        Gen at creation:        9824
        Parent ID:              5
        Top level ID:           5
        Flags:                  readonly
        Snapshot(s):

root@xerus:/test# btrfs subvolume show /test
/test is toplevel subvolume

-- 
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:<1e70c50e-54d7-0507-60ad-9c486e3517a9@suse.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: find snapshot parent?
  2019-07-06 15:53 find snapshot parent? Ulli Horlacher
  2019-07-06 16:57 ` Nikolay Borisov
@ 2019-07-06 23:24 ` Ulli Horlacher
  1 sibling, 0 replies; 10+ messages in thread
From: Ulli Horlacher @ 2019-07-06 23:24 UTC (permalink / raw)
  To: linux-btrfs

I have now implemented "btrfs_subvolume_list", example:

root@xerus:~# df3 -T
Filesystem     Type    Mbytes      Used Available Use% Mounted on
/dev/sda1      ext4    20,029     4,482    14,507  24% /
/dev/sdd4     btrfs    53,247       101    51,052   1% /test

root@xerus:~# btrfs_subvolume_list
rw /test
ro /test/.snapshot/2019-07-06_2236.test <- /test
ro /test/snapshot_1 <- /test
ro /test/ss1 <- /test
ro /test/ss3 <- -
rw /test/tmp
ro /test/tmp/xx/ss1 <- /test/tmp
ro /test/tmp/xx/ss2 <- /test/tmp
ro /test/tmp/xx/ss3 <- /test/ss3
rw /test/tmp/zz2 <- /test/tux/zz
rw /test/tux/test
ro /test/tux/test/.snapshot/2017-12-02_1341.test <- /test/tux/test
rw /test/tux/test2 <- /test/tux/test
rw /test/tux/test2/test <- /test/tux/test
rw /test/tux/zz

<- means: is snapshot of ...

Note: I have deleted the subvolume parent of /test/ss3

Sourcecode is available under:

https://fex.rus.uni-stuttgart.de/fas/framstag@rus.uni-stuttgart.de/linuxtools/anonymous@fex.rus.uni-stuttgart.de/k5JuaCkGRqGOYeFUHuB47S35rhs3vBZo

-- 
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:<20190706155353.GA13656@tik.uni-stuttgart.de>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: find snapshot parent?
  2019-07-06 20:43   ` Ulli Horlacher
@ 2019-07-07  5:27     ` Andrei Borzenkov
  2019-07-07  6:43     ` Nikolay Borisov
  1 sibling, 0 replies; 10+ messages in thread
From: Andrei Borzenkov @ 2019-07-07  5:27 UTC (permalink / raw)
  To: linux-btrfs

06.07.2019 23:43, Ulli Horlacher пишет:
> On Sat 2019-07-06 (19:57), Nikolay Borisov wrote:
> 
>>> And how can I see whether /test/tmp/xx/ss1 is a snapshot at all?
>>> Do all snapshots have a "Parent UUID" and regular subvolumes not?
>>
>> Indeed, only snapshots have a Parent UUID.
> 
> Not all:
> 
> root@xerus:/test# btrfs subvolume snapshot -r /test /test/ss1
> Create a readonly snapshot of '/test' in '/test/ss1'
> 
> root@xerus:/test# btrfs subvolume show /test/ss1
> /test/ss1
>         Name:                   ss1
>         UUID:                   02bd07bc-0bab-3442-96be-40790e1ba9be
>         Parent UUID:            -
>         Received UUID:          -
>         Creation time:          2019-07-06 22:37:37 +0200
>         Subvolume ID:           1036
>         Generation:             9824
>         Gen at creation:        9824
>         Parent ID:              5
>         Top level ID:           5
>         Flags:                  readonly
>         Snapshot(s):
> 
> root@xerus:/test# btrfs subvolume show /test
> /test is toplevel subvolume
> 

Which is one more reason to not use btrfs top level directly.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: find snapshot parent?
  2019-07-06 20:43   ` Ulli Horlacher
  2019-07-07  5:27     ` Andrei Borzenkov
@ 2019-07-07  6:43     ` Nikolay Borisov
  2019-07-07  7:37       ` Andrei Borzenkov
  1 sibling, 1 reply; 10+ messages in thread
From: Nikolay Borisov @ 2019-07-07  6:43 UTC (permalink / raw)
  To: linux-btrfs



On 6.07.19 г. 23:43 ч., Ulli Horlacher wrote:
> On Sat 2019-07-06 (19:57), Nikolay Borisov wrote:
> 
>>> And how can I see whether /test/tmp/xx/ss1 is a snapshot at all?
>>> Do all snapshots have a "Parent UUID" and regular subvolumes not?
>>
>> Indeed, only snapshots have a Parent UUID.
> 
> Not all:
> 
> root@xerus:/test# btrfs subvolume snapshot -r /test /test/ss1
> Create a readonly snapshot of '/test' in '/test/ss1'
> 
> root@xerus:/test# btrfs subvolume show /test/ss1
> /test/ss1
>         Name:                   ss1
>         UUID:                   02bd07bc-0bab-3442-96be-40790e1ba9be
>         Parent UUID:            -
>         Received UUID:          -
>         Creation time:          2019-07-06 22:37:37 +0200
>         Subvolume ID:           1036
>         Generation:             9824
>         Gen at creation:        9824
>         Parent ID:              5
>         Top level ID:           5
>         Flags:                  readonly
>         Snapshot(s):
> 
> root@xerus:/test# btrfs subvolume show /test
> /test is toplevel subvolume

This is really odd, looking at create_pending_snapshot the codes : 

memcpy(new_root_item->parent_uuid, root->root_item.uuid,                                      
                        BTRFS_UUID_SIZE);  

And that's not conditional on whether the snapshot is read only or not. 
So everytime we creata a snapshot it ought to be receiving the parent's 
subvolume UUID in its parent_uuid field. And indeed testing with latest misc-next kernel: 

root@ubuntu-virtual:~# btrfs subvol create /media/scratch/subvol10 
Create subvolume '/media/scratch/subvol10'

root@ubuntu-virtual:~# btrfs subvol snapshot /media/scratch/subvol10/ /media/scratch/snap-subvol10
Create a snapshot of '/media/scratch/subvol10/' in '/media/scratch/snap-subvol10'

root@ubuntu-virtual:~# btrfs subvol snapshot -r /media/scratch/subvol10/ /media/scratch/snap-subvol10-ro
Create a readonly snapshot of '/media/scratch/subvol10/' in '/media/scratch/snap-subvol10-ro'

root@ubuntu-virtual:~# btrfs subvol show /media/scratch/snap-subvol10
snap-subvol10
	Name: 			snap-subvol10
	UUID: 			8000e96e-5d6e-3c49-a4d3-5e3868ac6972
	Parent UUID: 		6352b676-fce5-0945-88d9-745a6ae72783
	Received UUID: 		-
	Creation time: 		2019-07-07 06:40:15 +0000
	Subvolume ID: 		262
	Generation: 		17
	Gen at creation: 	17
	Parent ID: 		5
	Top level ID: 		5
	Flags: 			-
	Snapshot(s):

root@ubuntu-virtual:~# btrfs subvol show /media/scratch/snap-subvol10-ro/
snap-subvol10-ro
	Name: 			snap-subvol10-ro
	UUID: 			8964dab3-37b0-fc4e-b891-69323d3aaea0
	Parent UUID: 		6352b676-fce5-0945-88d9-745a6ae72783
	Received UUID: 		-
	Creation time: 		2019-07-07 06:40:26 +0000
	Subvolume ID: 		263
	Generation: 		18
	Gen at creation: 	18
	Parent ID: 		5
	Top level ID: 		5
	Flags: 			readonly
	Snapshot(s):

Note that the related code hasn't change in a long time. 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: find snapshot parent?
  2019-07-07  6:43     ` Nikolay Borisov
@ 2019-07-07  7:37       ` Andrei Borzenkov
  2019-07-07  9:12         ` Nikolay Borisov
  0 siblings, 1 reply; 10+ messages in thread
From: Andrei Borzenkov @ 2019-07-07  7:37 UTC (permalink / raw)
  To: Nikolay Borisov, linux-btrfs

07.07.2019 9:43, Nikolay Borisov пишет:
> 
> 
> On 6.07.19 г. 23:43 ч., Ulli Horlacher wrote:
>> On Sat 2019-07-06 (19:57), Nikolay Borisov wrote:
>>
>>>> And how can I see whether /test/tmp/xx/ss1 is a snapshot at all?
>>>> Do all snapshots have a "Parent UUID" and regular subvolumes not?
>>>
>>> Indeed, only snapshots have a Parent UUID.
>>
>> Not all:
>>
>> root@xerus:/test# btrfs subvolume snapshot -r /test /test/ss1
>> Create a readonly snapshot of '/test' in '/test/ss1'
>>
>> root@xerus:/test# btrfs subvolume show /test/ss1
>> /test/ss1
>>         Name:                   ss1
>>         UUID:                   02bd07bc-0bab-3442-96be-40790e1ba9be
>>         Parent UUID:            -
>>         Received UUID:          -
>>         Creation time:          2019-07-06 22:37:37 +0200
>>         Subvolume ID:           1036
>>         Generation:             9824
>>         Gen at creation:        9824
>>         Parent ID:              5
>>         Top level ID:           5
>>         Flags:                  readonly
>>         Snapshot(s):
>>
>> root@xerus:/test# btrfs subvolume show /test
>> /test is toplevel subvolume
> 
> This is really odd, looking at create_pending_snapshot the codes : 
> 
> memcpy(new_root_item->parent_uuid, root->root_item.uuid,                                      
>                         BTRFS_UUID_SIZE);  
> 
> And that's not conditional on whether the snapshot is read only or not. 
> So everytime we creata a snapshot it ought to be receiving the parent's 
> subvolume UUID in its parent_uuid field.

Does top level subvolume of btrfs have subvolume UUID at all? How can
one display it? None of "btrfs subvolume" commands show it.

> And indeed testing with latest misc-next kernel: 
> 
> root@ubuntu-virtual:~# btrfs subvol create /media/scratch/subvol10 
> Create subvolume '/media/scratch/subvol10'
> 
> root@ubuntu-virtual:~# btrfs subvol snapshot /media/scratch/subvol10/ /media/scratch/snap-subvol10
> Create a snapshot of '/media/scratch/subvol10/' in '/media/scratch/snap-subvol10'
> 

/media/scratch/subvol10 is not top level subvolume.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: find snapshot parent?
  2019-07-07  7:37       ` Andrei Borzenkov
@ 2019-07-07  9:12         ` Nikolay Borisov
  2019-07-07 22:18           ` Ulli Horlacher
  0 siblings, 1 reply; 10+ messages in thread
From: Nikolay Borisov @ 2019-07-07  9:12 UTC (permalink / raw)
  To: Andrei Borzenkov, linux-btrfs



On 7.07.19 г. 10:37 ч., Andrei Borzenkov wrote:
> 07.07.2019 9:43, Nikolay Borisov пишет:
>>
>>
>> On 6.07.19 г. 23:43 ч., Ulli Horlacher wrote:
>>> On Sat 2019-07-06 (19:57), Nikolay Borisov wrote:
>>>
>>>>> And how can I see whether /test/tmp/xx/ss1 is a snapshot at all?
>>>>> Do all snapshots have a "Parent UUID" and regular subvolumes not?
>>>>
>>>> Indeed, only snapshots have a Parent UUID.
>>>
>>> Not all:
>>>
>>> root@xerus:/test# btrfs subvolume snapshot -r /test /test/ss1
>>> Create a readonly snapshot of '/test' in '/test/ss1'
>>>
>>> root@xerus:/test# btrfs subvolume show /test/ss1
>>> /test/ss1
>>>         Name:                   ss1
>>>         UUID:                   02bd07bc-0bab-3442-96be-40790e1ba9be
>>>         Parent UUID:            -
>>>         Received UUID:          -
>>>         Creation time:          2019-07-06 22:37:37 +0200
>>>         Subvolume ID:           1036
>>>         Generation:             9824
>>>         Gen at creation:        9824
>>>         Parent ID:              5
>>>         Top level ID:           5
>>>         Flags:                  readonly
>>>         Snapshot(s):
>>>
>>> root@xerus:/test# btrfs subvolume show /test
>>> /test is toplevel subvolume
>>
>> This is really odd, looking at create_pending_snapshot the codes : 
>>
>> memcpy(new_root_item->parent_uuid, root->root_item.uuid,                                      
>>                         BTRFS_UUID_SIZE);  
>>
>> And that's not conditional on whether the snapshot is read only or not. 
>> So everytime we creata a snapshot it ought to be receiving the parent's 
>> subvolume UUID in its parent_uuid field.
> 
> Does top level subvolume of btrfs have subvolume UUID at all? How can
> one display it? None of "btrfs subvolume" commands show it.
> 
>> And indeed testing with latest misc-next kernel: 
>>
>> root@ubuntu-virtual:~# btrfs subvol create /media/scratch/subvol10 
>> Create subvolume '/media/scratch/subvol10'
>>
>> root@ubuntu-virtual:~# btrfs subvol snapshot /media/scratch/subvol10/ /media/scratch/snap-subvol10
>> Create a snapshot of '/media/scratch/subvol10/' in '/media/scratch/snap-subvol10'
>>
> 
> /media/scratch/subvol10 is not top level subvolume.

root@ubuntu-virtual:~# mkfs.btrfs /dev/vdc 

root@ubuntu-virtual:~# mount /dev/vdc /media/scratch/

root@ubuntu-virtual:~# btrfs subvolume snapshot  /media/scratch/ /media/scratch/snap1
Create a snapshot of '/media/scratch/' in '/media/scratch/snap1'

root@ubuntu-virtual:~# btrfs subvolume snapshot  -r /media/scratch/ /media/scratch/snap-ro
Create a readonly snapshot of '/media/scratch/' in '/media/scratch/snap-ro'



root@ubuntu-virtual:~# btrfs subvol show /media/scratch/      
/
	Name: 			<FS_TREE>
	UUID: 			80633e8d-fa8a-4922-ac0c-b46d7b2e2d81
	Parent UUID: 		-
	Received UUID: 		-
	Creation time: 		2019-07-07 09:09:15 +0000
	Subvolume ID: 		5
	Generation: 		8
	Gen at creation: 	0
	Parent ID: 		0
	Top level ID: 		0
	Flags: 			-
	Snapshot(s):
				snap1
				snap-ro

root@ubuntu-virtual:~# btrfs subvol show /media/scratch/snap1/
snap1
	Name: 			snap1
	UUID: 			df861e02-5f54-a74c-a560-dfa66a80b528
	Parent UUID: 		80633e8d-fa8a-4922-ac0c-b46d7b2e2d81
	Received UUID: 		-
	Creation time: 		2019-07-07 09:09:38 +0000
	Subvolume ID: 		257
	Generation: 		6
	Gen at creation: 	6
	Parent ID: 		5
	Top level ID: 		5
	Flags: 			-
	Snapshot(s):

root@ubuntu-virtual:~# btrfs subvol show /media/scratch/snap-ro/
snap-ro
	Name: 			snap-ro
	UUID: 			f9c1a467-2d8a-2343-9011-a4ad07e701b7
	Parent UUID: 		80633e8d-fa8a-4922-ac0c-b46d7b2e2d81
	Received UUID: 		-
	Creation time: 		2019-07-07 09:11:34 +0000
	Subvolume ID: 		258
	Generation: 		8
	Gen at creation: 	8
	Parent ID: 		5
	Top level ID: 		5
	Flags: 			readonly
	Snapshot(s):




> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: find snapshot parent?
  2019-07-07  9:12         ` Nikolay Borisov
@ 2019-07-07 22:18           ` Ulli Horlacher
  2019-07-08  4:05             ` Andrei Borzenkov
  0 siblings, 1 reply; 10+ messages in thread
From: Ulli Horlacher @ 2019-07-07 22:18 UTC (permalink / raw)
  To: linux-btrfs

On Sun 2019-07-07 (12:12), Nikolay Borisov wrote:


> root@ubuntu-virtual:~# mount /dev/vdc /media/scratch/
> 
> root@ubuntu-virtual:~# btrfs subvol show /media/scratch/      
> /
> 	Name: 			<FS_TREE>
> 	UUID: 			80633e8d-fa8a-4922-ac0c-b46d7b2e2d81
> 	Parent UUID: 		-
> 	Received UUID: 		-
> 	Creation time: 		2019-07-07 09:09:15 +0000
> 	Subvolume ID: 		5
> 	Generation: 		8
> 	Gen at creation: 	0
> 	Parent ID: 		0
> 	Top level ID: 		0
> 	Flags: 			-
> 	Snapshot(s):
> 				snap1
> 				snap-ro


root@fex:~# lsb_release -d
Description:    Ubuntu 18.04.2 LTS

root@fex:~# btrfs version
btrfs-progs v4.15.1

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

root@fex:~# btrfs subvolume show /local
/
        Name:                   <FS_TREE>
        UUID:                   -
        Parent UUID:            -
        Received UUID:          -
        Creation time:          -
        Subvolume ID:           5
        Generation:             1633457
        Gen at creation:        0
        Parent ID:              0
        Top level ID:           0
        Flags:                  -

No UUID!

-- 
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:<8bc57b91-fc13-979b-a25a-b7a16094d09a@suse.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: find snapshot parent?
  2019-07-07 22:18           ` Ulli Horlacher
@ 2019-07-08  4:05             ` Andrei Borzenkov
  0 siblings, 0 replies; 10+ messages in thread
From: Andrei Borzenkov @ 2019-07-08  4:05 UTC (permalink / raw)
  To: linux-btrfs

08.07.2019 1:18, Ulli Horlacher пишет:
> On Sun 2019-07-07 (12:12), Nikolay Borisov wrote:
> 
> 
>> root@ubuntu-virtual:~# mount /dev/vdc /media/scratch/
>>
>> root@ubuntu-virtual:~# btrfs subvol show /media/scratch/      
>> /
>> 	Name: 			<FS_TREE>
>> 	UUID: 			80633e8d-fa8a-4922-ac0c-b46d7b2e2d81
>> 	Parent UUID: 		-
>> 	Received UUID: 		-
>> 	Creation time: 		2019-07-07 09:09:15 +0000
>> 	Subvolume ID: 		5
>> 	Generation: 		8
>> 	Gen at creation: 	0
>> 	Parent ID: 		0
>> 	Top level ID: 		0
>> 	Flags: 			-
>> 	Snapshot(s):
>> 				snap1
>> 				snap-ro
> 
> 
> root@fex:~# lsb_release -d
> Description:    Ubuntu 18.04.2 LTS
> 
> root@fex:~# btrfs version
> btrfs-progs v4.15.1
> 
> root@fex:~# mount|grep /local
> /dev/sdd1 on /local type btrfs (rw,relatime,space_cache,user_subvol_rm_allowed,subvolid=5,subvol=/)
> 
> root@fex:~# btrfs subvolume show /local
> /
>         Name:                   <FS_TREE>
>         UUID:                   -
>         Parent UUID:            -
>         Received UUID:          -
>         Creation time:          -
>         Subvolume ID:           5
>         Generation:             1633457
>         Gen at creation:        0
>         Parent ID:              0
>         Top level ID:           0
>         Flags:                  -
> 
> No UUID!
> 

Neither here on different versions of openSUSE. Note that it also
mistakenly displays subvolumes as snapshots (I assume, it simply
compares NULL subvolume UUID with NULL parent UUID in this case).

bor@leap423:~> sudo btrfs version
btrfs-progs v4.5.3+20160729
bor@leap423:~> uname -a
Linux leap423 4.4.180-102-default #1 SMP Mon Jun 17 13:11:23 UTC 2019
(7cfa20a) x86_64 x86_64 x86_64 GNU/Linux
bor@leap423:~> sudo btrfs su sh /mnt
/mnt is toplevel subvolume
bor@leap423:~>

bor@localhost:~> sudo btrfs version
btrfs-progs v4.19.1
bor@localhost:~> uname -a
Linux localhost 4.12.14-lp151.28.7-default #1 SMP Mon Jun 17 16:36:38
UTC 2019 (f8a1872) x86_64 x86_64 x86_64 GNU/Linux
bor@localhost:~> sudo btrfs su sh /mnt
/
	Name: 			<FS_TREE>
	UUID: 			-
	Parent UUID: 		-
	Received UUID: 		-
	Creation time: 		-
	Subvolume ID: 		5
	Generation: 		338
	Gen at creation: 	0
	Parent ID: 		0
	Top level ID: 		0
	Flags: 			-
	Snapshot(s):
				@
				@/var
				@/usr/local
				@/tmp
				@/srv
				@/root
				@/opt
				@/home
				@/boot/grub2/x86_64-efi
				@/boot/grub2/i386-pc
				@/.snapshots
				@/.snapshots/1/snapshot
bor@localhost:~>

bor@10:~> sudo btrfs version
btrfs-progs v5.1
bor@10:~> uname -a
Linux 10.0.2.15 5.1.7-1-default #1 SMP Tue Jun 4 07:56:54 UTC 2019
(55f2451) x86_64 x86_64 x86_64 GNU/Linux
bor@10:~> sudo btrfs su sh /mnt
/
	Name: 			<FS_TREE>
	UUID: 			-
	Parent UUID: 		-
	Received UUID: 		-
	Creation time: 		-
	Subvolume ID: 		5
	Generation: 		26638
	Gen at creation: 	0
	Parent ID: 		0
	Top level ID: 		0
	Flags: 			-
	Snapshot(s):
				@
				@/.snapshots
				@/boot/grub2/i386-pc
				@/boot/grub2/x86_64-efi
				@/home
				@/opt
				@/srv
				@/tmp
				@/usr/local
				@/var/cache
				@/var/crash
				@/var/lib/libvirt/images
				@/var/lib/machines
				@/var/lib/mailman
				@/var/lib/mariadb
				@/var/lib/mysql
				@/var/lib/named
				@/var/lib/pgsql
				@/var/log
				@/var/opt
				@/var/spool
				@/var/tmp
bor@10:~>



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-07-08  4:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-06 15:53 find snapshot parent? Ulli Horlacher
2019-07-06 16:57 ` Nikolay Borisov
2019-07-06 20:43   ` Ulli Horlacher
2019-07-07  5:27     ` Andrei Borzenkov
2019-07-07  6:43     ` Nikolay Borisov
2019-07-07  7:37       ` Andrei Borzenkov
2019-07-07  9:12         ` Nikolay Borisov
2019-07-07 22:18           ` Ulli Horlacher
2019-07-08  4:05             ` Andrei Borzenkov
2019-07-06 23:24 ` Ulli Horlacher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).