> -----Original Message----- > From: linux-btrfs-owner@xxxxxxxxxxxxxxx [mailto:linux-btrfs-owner@xxxxxxxxxxxxxxx] On Behalf Of Hans van Kranenburg > Sent: Wednesday, July 17, 2019 5:24 PM > To: linux-btrfs@xxxxxxxxxxxxxxx; Ulli Horlacher <framstag@xxxxxxxxxxxxxxxxxxxx> > Subject: Re: how do I know a subvolume is a snapshot? > > Hi, > > On 7/17/19 1:24 AM, Ulli Horlacher wrote: > > > > I thought, I can recognize a snapshot when it has a Parent UUID, but > > this is not true for snapshots of toplevel subvolumes: > > > > root@trulla:/# btrfs version > > btrfs-progs v4.5.3+20160729 > > > > root@trulla:/# btrfs subvolume show /mnt/tmp /mnt/tmp is toplevel > > subvolume > > > > root@trulla:/# btrfs subvolume snapshot /mnt/tmp /mnt/tmp/ss Create a > > snapshot of '/mnt/tmp' in '/mnt/tmp/ss' > > > > root@trulla:/# btrfs subvolume create /mnt/tmp/xx Create subvolume > > '/mnt/tmp/xx' > > > > root@trulla:/# btrfs subvolume show /mnt/tmp/ss /mnt/tmp/ss > > Name: ss > > UUID: 7732bdde-0485-204e-b41b-833376e791da > > Parent UUID: - > > Received UUID: - > > Creation time: 2019-07-17 01:02:48 +0200 > > Subvolume ID: 270 > > Generation: 60 > > Gen at creation: 60 > > Parent ID: 5 > > Top level ID: 5 > > Flags: - > > Snapshot(s): > > > > root@trulla:/# btrfs subvolume show /mnt/tmp/xx /mnt/tmp/xx > > Name: xx > > UUID: 342b2065-1679-8245-bd76-8da598cc33d8 > > Parent UUID: - > > Received UUID: - > > Creation time: 2019-07-17 01:03:02 +0200 > > Subvolume ID: 271 > > Generation: 61 > > Gen at creation: 61 > > Parent ID: 5 > > Top level ID: 5 > > Flags: - > > Snapshot(s): > > > > How do I know that /mnt/tmp/ss is a snapshot? > > I cannot see a snapshot identifier. > > > > The technical answer is: > > * The uuid of the top-level subvol (id 5) is > 00000000-0000-0000-0000-000000000000 > * The parent uuid of your snapshot/clone is also 0000... as a result. > * For interpretation of parent uuid field, there is no distinction between "has no parent uuid" (the field is empty, > which technically means all bits are 0) and the actual value 0000... > * So... the tooling displays it as "-". ¯\_(ツ)_/¯ > > The practical answer is: > > * Don't put anything in the top level subvol that would make you want to snapshot it. > > Note: In btrfs design, there is no technical difference between a snapshot and a writable clone (as opposed to e.g. > netapp snapshots and clones). This makes the design less complicated, but it results in a collection of known usability > issues, like that if you expect them to be different, they still aren't. > > Hans Hello, FYI, this problem should be fixed in mkfs.btrfs >= v4.16 since the top-level subvolume also gets non-empty UUID at mkfs time. Thanks
