-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support the creation of an empty snapshot #944
Support the creation of an empty snapshot #944
Comments
Creation of an empty snapshot is very easy since it is partly already implemented. YaST Since you use-case uses --no-dbus anyway it is not even required to extend the DBus |
The problem is a bit tricky: So far first the snapper config has to be created and then the snapshot 1. When creating snapshot 1 as empty the snapper config is not included in the snapshot. Even when creating snapshot 1 as a snapshot of the toplevel subvolume the snapper config is also present in the toplevel subvolume (for which we already have a bug report btw). I have now implemented a two step workflow: The first step "filesystem" creates the subvolumes. The second step "config" creates snapper files. More precise: The step "filesystem" does the following: create btrfs subvolume //.snapshots The step "config" does the following: create snapper sysconfig //etc/sysconfig/snapper The installer has to mount the filesystem before the step "filesystem". Between the two steps the filesystem must be remounted (since the default subvolume was changes). Additionally the .snapshots subvolume must be mounted by the installer. The installer must also handle /etc/fstab or similar. Example workflow: mkfs.btrfs -f /dev/sdc1 mount /dev/sdc1 /test /usr/lib/snapper/installation-helper --root-prefix /test --step filesystem umount /test mount /dev/sdc1 /test /usr/lib/snapper/installation-helper --root-prefix /test --step config --description initial --userdata a=1 Now snapper can be used normally, e.g.: snapper --no-dbus --root /test ls Unfortunately I cannot test it thoroughly since I do not have an installer that can use this new workflow. So feedback is needed. Test packages are available at https://build.opensuse.org/package/show/home:aschnell:snapper/snapper. |
@aschnell thanks much for these changes. I think this is fine, so far I could manage to run an installer without having to create any other subvolume than My tests were successful so the only thing I miss now on my end is a version threshold to discriminate snapper including these changes. Whenever there is a new version cut in Factory we should be capable to actually finalize the draft I created for testing. |
Thanks for the feedback. And yes, the @ subvolume is optional. Some SUSE products have it, others not. In YaST it can be controlled via a product specific configuration file. I have tested both setups, see https://github.com/openSUSE/snapper/blob/master/client/installation-helper/test1.sh and https://github.com/openSUSE/snapper/blob/master/client/installation-helper/test2.sh. I will make a new snapper release soon, likely January. |
I am making a 0.12.1 release right now. |
In snapper from an image builder perspective we are missing the capability of creating a new empty snapshot. By empty I mean creating a snapshot that is not based on a previous one.
The reasoning is the following, in Elemental, we aim to install/update images as snapshots with following sequence:
Pretty similar to what
tukit
from transactional updates does. The problem we have is that we implement this procedure for the very first snapshot too (our first root is considered to be a snapshot too like in MicroOS). We are basically missing a way to call snapper to create a new empty subvolume as an snapshot, that way, snapper could be really our wrapper aroundbtrfs
utility.Let me expose how we create the first root to be seen as a snapshot by snapper (roughly translated into shell steps):
The so the problem we have is that we need to wrap btrfs to create subvolumes, create snapshot metadata, handle subvolumes IDs vs snapshot IDs, etc. It feels a bit like we are re-implementing core functionalities of snapper itself.
What we'd love to see in snapper is something similar to:
So to my eyes is essentially bringing to snapshot the capability to create empty snapshots (no parent) and the capability to provide custom configuration beyond
/etc
. This is good for imaging and creating systems like Micro OS in which the very first/
is considered a snapshot already. This would also be valuable for KIWI to simplify some of the logic, as there in order to support Micro OS builds there is alsobtrfs
custom logic to mimic snapper.The text was updated successfully, but these errors were encountered: