I’m trying to use snapper to create hourly snapshots for /etc and I’m stuck. I would like to either enable snapper for / or create a separate /etc subvolume. The first doesn’t work because I get the following error:
$ sudo snapper -c root create-config /
IO Error (subvolume is not a btrfs subvolume).
The 2nd option seems risky without understanding better how /etc is handled. It would help if I understood what is really mounted at / and /etc. The mount command isn’t helpful, as it just says they are both the btrfs root subvolume.
Does anyone have pointers to docs or the startup scripts that handle mounting / and /etc ?
Hello @akvadrako ,
I can see my btrfs subvolumes only if I use sudo in the command. sudo btrfs subvolume show / will show the entire sysroot which is where etc is (/etc) so a snapshot of my / will capture /etc as well.
In my setup, I followed the steps listed here to create snapshots of the root partition. Additionally, I created separate subvolumes for /tmp, /var/log and /var/cache at subvolume level 5 to not backup files stored there to the snapshots. For me, it’s enough to create snapshots before / after performing a system update, so I didn’t configure my system for hourly snapshots.
However, I didn’t manage to setup grub-btrfs to boot from snapshots (tested in a VM), because gdm just won’t start. But creating snapshots and restoring them like it is mentioned in the linked guide works well.
Sadly, the Fedora Installer doesn’t work with the partition scheme of openSUSE, which would probably be the best one, using snapper.
This is true. OSTree uses an overlayfs as the mount point for /etc. It uses the /usr/etc as its lower directory, with it’s upper directory with your older modifications, and it’s overlayer. Modifications are copied up to the overlay and then commited to the tree for the next deployment. Each deployment starts the cycle of a 3 way merge saving the upper directory for the rollback. The overlayer becomes the upper directory in the next deployment.
sudo ostree admin config-diff command will show you the current mutations on the /etc partition from the original /usr/etc directory.
OSTREE ADMIN CONFIG() OSTREE ADMIN CONFIG()
ostree-admin-config-diff - Diff current /etc configuration versus default
ostree admin config-diff [OPTIONS...]
Prints the differences between the current /etc directory and the default configuration in /usr/etc. Newly added files (present in /etc but not in /usr/etc) will
be prefixed with 'A'. Modified files will be prefixed with 'M', and deleted files with 'D'.
Use a different operating system stateroot than the current one.
$ ostree admin config-diff
OSTREE ADMIN CONFIG()
Oops! My bad. I was working from WS not SB. So you’re correct that you wouldn’t be able to snapshot. Really I wouldn’t bother snapshotting anything with SB in that case. Simply pinning with ostree and backing up the /home using btrfs subvolume snapshots would be my approach for that.
As for snapshotting / it can be done on SB but you would have had to make a root level btrfs volume on your device that has the root partition then create the subvolume for the / mount point as a child of the root volume. You then manually mount the root volume, take your snapshot then unmount it. Again, on SB this is, IMO, overkill since ostree does a pretty good job at this.
Thanks again, but that’s from 2014 and doesn’t say anything about how Silverblue mounts the overlayfs of /etc. What would be interesting is the specific mount calls or where I can find them.
But I guess it doesn’t matter because whatever it is, it probably won’t be layout in a way that lets me make/etc (or the upper part of it’s overlayfs mount) a subvolume. And using snapshots for the whole sysroot seems like it would cost too much space to keep around for long, defeating the point.
I think I will just write a script that uses config-diff to copy /etc modifications into a directory on /var and run that after making changes.