This is on a debian bullseye that I plan to upgrade shortl.
When I set up this machine, I created a 1G partition for boot pool, without thinking much about what snapshot are
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
bpool 960M 592M 368M - - 40% 61% 1.00x ONLINE -
Whenever there is something that triggers an initramfs rebuild, I get some ‘convenient’ backup files from dkms. This has the effect that even just a couple snapshots fill up the partition.
This is how my snapshots look like today, after deleting the helpful dkms backup files:
bpool/BOOT/debian@autosnap_2023-05-01_00:00:08_monthly 162M - 334M -
bpool/BOOT/debian@autosnap_2023-06-01_00:00:08_monthly 88K - 338M -
bpool/BOOT/debian@autosnap_2023-06-19_23:30:08_weekly 80K - 338M -
bpool/BOOT/debian@autosnap_2023-06-26_23:30:08_weekly 80K - 338M -
bpool/BOOT/debian@autosnap_2023-07-01_00:00:08_monthly 80K - 338M -
bpool/BOOT/debian@autosnap_2023-07-03_23:30:08_weekly 80K - 338M -
bpool/BOOT/debian@autosnap_2023-07-10_23:30:08_weekly 80K - 338M -
bpool/BOOT/debian@autosnap_2023-07-16_00:00:08_daily 80K - 338M -
bpool/BOOT/debian@autosnap_2023-07-17_00:00:08_daily 80K - 338M -
bpool/BOOT/debian@autosnap_2023-07-17_23:30:08_weekly 0B - 338M -
bpool/BOOT/debian@autosnap_2023-07-18_00:00:08_daily 0B - 338M -
bpool/BOOT/debian@autosnap_2023-07-19_00:00:08_daily 56K - 338M -
bpool/BOOT/debian@autosnap_2023-07-20_00:00:08_daily 80K - 338M -
bpool/BOOT/debian@autosnap_2023-07-21_00:00:08_daily 80K - 338M -
bpool/BOOT/debian@autosnap_2023-07-22_00:00:08_daily 56K - 338M -
bpool/BOOT/debian@autosnap_2023-07-23_00:00:08_daily 56K - 182M -
This is the sanoid template:
frequently = 0
hourly = 0
daily = 8
weekly = 5
monthly = 6
yearly = 0
autosnap = yes
autoprune = yes
Whenever I have to do an upgrade on this machine, I have to carefully look for dkms or initram errors, as I have put myself in a stinky corner once, and I’d rather not do it again. I generally prune the snapshot manually before doing anything.
Is there a better way to handle this whole thing? Maybe having snapshot created by an initramfs hook, instead of sanoid?
I’m not entirely certain I understand the issue. What do you want to happen differently?
I’m trying to find a way to trigger the snapshot only when an updated or new initramfs is created, preferably before the process starts. I’ve found a hook for post-completion, but not one that is called at start of initramfs creation.
The issue I have is that there are independent parts of the OS that create backups and a 1G partitions fills very quickly if you also have sanoid taking regular snapshots. And recovering from a “didn’t create the initramfs because there was no space” error is not nice, if you happen to not be looking at the screen while the message flashes through.
I really wish there were beadm for debian, but that seems to be deeply intertwined with pkg, somewhere in the illumos sources.
need to have a look at zfsbootmenu…
I would reduce the retention on the boot pool snapshots.
When do you ever need to go back weeks or months?
Besides, initramfs issues are easily fixed with a usb boot/rescue drive so I don’t even see the need for more than 1 snapshot.
Then there’s another issue. Say there is an issue with initramfs, your system won’t boot. How will you revert? You’d need to boot from a rescue usb drive or something right? Or perhaps youre able to select a previous working snapshot at boot time?
Either way, I don’t see the use for more than a few snapshots.
need to have a look at zfsbootmenu…
That is definitely a MUCH better way to go for bootable zfs on root. Much, MUCH better. The only real downside I’ve found is that it has a hard dependency on fully-implemented UEFI that has made it unusable on some older (sixth gen Intel processor) motherboards that didn’t seem to implement all of the stack properly (no efi vars exposed according to the kernel, even after a UEFI boot).
I think I’ve been living under a rock, because only recently have I been hearing about zfsbootmenu.
You should be able to turn off backups for the initrd.img or turn off automatic updates since Debian will sometimes update the initrd.img for things not necessary to boot the system. You’ll have to remember to manually run update-initramfs when you update your system. You can also change the compression type to make the files smaller. Have a look at /etc/initramfs-tools/initramfs.conf and /etc/initramfs-tools/update-initramfs.conf.