Re: find snapshot parent?

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

 




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):




> 



[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