On Sun, 2020-07-19 at 15:50 +0200, Christian Boltz wrote:
Hello,
Am Samstag, 18. Juli 2020, 19:59:29 CEST schrieb Bill Merriam:
I noticed this on 15.2 but I think it worked the same way on 15.1.
The default subvolume always seems to be snapshot 1 even though that is not the most recent snapshot.
btrfs sub get-default / ID 265 gen 6686 top level 264 path @/.snapshots/1/snapshot
Indeed that is what gets mounted (apparently) on root.
/dev/mapper/system-root152 on / type btrfs (rw,relatime,ssd,space_cache,subvolid=265,subvol=/@/.snapshots/1/sn aps h ot)
Every time zypper installs updates it makes new before and after snapshots and I would think the default subvolume and the currently mounted subvolume would need to be the NEW snapshot, not snapshot 1. Nevertheless (a very fancy word) the system seems to work just fine so I think I just don't understand default subvolumes.
I have read the opensuse wiki about btrfs, subvolumes and snapshots and I have read the kernel wiki about that. It always makes me think the newest snapshot is the one used. Is there an explaination for this somewhere? Can someone on the list explain it?
Is snapshot 1 and the newest snapshot the same thing?
I'll try to explain it without causing more confusion ;-)
First, there are two ways how you can manage a system with btrfs - the "traditional" way and "transactional updates" way.
With Leap, you are most likely using the "traditional" way.
== Traditional way ==
This is the default for Leap and Tumbleweed.
You can think of /@/.snapshots/1/snapshot in a similar way as if you had an ext4 root partition - it's the subvolume that gets always used and modified (for example if you install some packages).
If you install a package with zypper, it will get installed in your running system and is instantly usable.
The snapshots created by zypper are "backups" and get increasing numbers.
Nevertheless, .snapshots/1/ stays the snapshot you'll be using.
There is one exception: if you do a "snapper rollback", this technically means to switch to another snapshot - one of the "backups" created by zypper. I never needed that ;-) but AFAIK in this case your system willl really be switched to a different snapshot number. And you'll keep this number until you do another rollback.
== Transactional updates ==
Transactional updates are used by default in Kubic, but you can also setup Tumbleweed and Leap the transactional way if you want.
With transactional updates, things are completely different:
On a system using transactional updates, your / partition is read- only (with an overlay filesystem for things like /etc/ to allow config changes).
If you install a package, a new snapshot gets created, and the package gets installed into that snapshot (not in the running system). If everything succeeds, the default snapshot (which is used on boot) gets switched to the new snapshot with the just-installed package.
The advantage is that you can't break your running system. Even if the installation breaks after half of the package, you never have an inconsistent running system. In that case, the broken snapshot simply gets thrown away, no damage done. Also, if a snapshot turns out to be unbootable, there's a mechanism to auto-rollback to the last known- working snapshot.
The disadvantage of transactional updates is that you need to reboot to switch to the new snapshot and to make the changes active. This isn't a serious problem for Kubic (where having a guaranteed consistent and working state is more important than avoiding a reboot), but for desktop usage my personal opinion is that having to reboot after installing a package is too annoying ;-) (well, at least after a fresh installation - after some months, I rarely have to install additional packages)
HTH ;-)
Regards,
Christian Boltz -- "Arial was designed for Monotype in 1982 by Robin Nicholas and Patricia Saunders" - Diese Aussage ist bei mir und bei dir gleich gültig. (Gleich gültig. Nicht: Gleichgültig. :-) ). Ob sie uns interessiert, sei dahingestellt, die Aussage ist wahr. [Ratti in fontlinge-devel]
Thank you Christian, that makes everything perfectly clear to me. You explained it very well. Perhaps this explanation should be added to the documentation some where. I will continue to use "traditional" on my desktops, and use transactional on my servers and VM's. I like the fact that those systems install software updates and reboot themselves in the middle of the night without my having to pay attention. I would use it on desktops but having to reboot every time I install something or make a change drives me crazy. I am going to figure out a way to remind myself of which style the system is when I login. Thanks again. Bill Merriam -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org