Snapper and the "first root filesystem"

I installed Tumbleweed a few days ago and I’m confused about why the snapshot I have mounted at / is called “first root filesystem”. Is this normal? This is what snapper list outputs:

  # │ Type   │ Pre # │ Date                          │ User │ Used Space │ Cleanup │ Description           │ Userdata
────┼────────┼───────┼───────────────────────────────┼──────┼────────────┼─────────┼───────────────────────┼──────────────
 0  │ single │       │                               │ root │            │         │ current               │
 1* │ single │       │ Sat 26 Oct 2024 00:02:36 CEST │ root │  68.13 MiB │         │ first root filesystem │
 2  │ single │       │ Sat 26 Oct 2024 00:07:30 CEST │ root │ 347.98 MiB │ number  │ after installation    │ important=yes
39  │ pre    │       │ Sun 27 Oct 2024 15:34:02 CET  │ root │   1.36 MiB │ number  │ zypp(zypper)          │ important=no
[...]
48  │ post   │    47 │ Mon 28 Oct 2024 11:57:48 CET  │ root │   3.41 MiB │ number  │                       │ important=no

This is how / is mounted:

/dev/mapper/cr_root on / type btrfs (rw,relatime,ssd,space_cache=v2,subvolid=264,subvol=/@/.snapshots/1/snapshot)

I thought snapshot 1 should have been a read only snapshot of the first root filesystem before anything has been installed into it. I haven’t done anything snapshot related after installation, other than installing packages.
Also what does snapshot 0 refer to? /.snapshots/0 does not exist. In my understanding snapshot 1 should be named ‘current’, since that is what is mounted read-write now.

0 or current is the actual btrfs filesystem, the installer sets the system to boot from snapshot 1. That’s the * next to the number. Snapshots can be read-write or read-only. Query it like so:

sudo btrfs property get /.snapshots/1/snapshot

In openSUSE, you always boot from a snapshot. That’s how the rollback magic works! :magic_wand:

Because it the very first snapshot created during installation.

Yes, it is.

What do you mean with current or actual btrfs filesystem? Do you mean the /@ subvolume that contains the other subvolumes? Why would one call this ‘current’?

Ok cool. I was just wondering why it is called that way, since the description is only accurate in the moment of it’s creation. Or am I missing something here?

Subvolumes (@ and children) are different to the root volume (/).
Think of the root volume as a normal partition that you would mount. Better to visualize this:

# do as root
mount /dev/your-btrfs-device /mnt
ll /mnt
umount /mnt

This would show your normal root / filesystem but the directories where the subvolumes are mounted would be empty.

Now do snapper list-configs. This would show that by default snapper has the config named root for / volume.

You can think of subvolumes as directories that can be independently mounted. Normally this would be partitions, but in btrfs you have these “directories” that can be mounted. The parent of all subvolumes is @. Beneath it you can find all other subvolumes. Once again, better to visualize this:

# do as root, this is the top level subvolume dir
mount -o subvol=@ /dev/your-btrfs-device /mnt
ll /mnt
umount /mnt
# this would be just the home subvolume/dir and its contents
mount -o subvol=@/home /dev/your-btrfs-device /mnt
ll /mnt
umount /mnt

Because it is used as your current root filesystem. All other snapshots are just frozen point-in-time copies. The current snapshot is mounted when you mount filesystem and this snapshot gets all changes, so it stays “current” (pun intended).

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.