wesbarnett / snap-pac

Pacman hooks that use snapper to create pre/post btrfs snapshots like openSUSE's YaST
GNU General Public License v2.0
180 stars 14 forks source link

Backing up non btrfs /boot #7

Closed NicoHood closed 7 years ago

NicoHood commented 7 years ago

On some systems with efi partition used for /boot or on arm devices such as the raspberry pi you only have a fat32 partition available as /boot. Sadly you cannot configure snapper to also backup this partition.

Wouldn't it be possible for snap-pac to mirror this data to a special folder, say /.boot, before every transaction? You could add an auto detection or add a setting for this.

Especially on arm this is important if the kernel changes and you use an initramfs it will be unable to load the kernel if the /boot kernel is different than the one used in root. Also there are other settings in /boot that often can cause problems.

wesbarnett commented 7 years ago

I'm going to have to think about this a little bit on whether or not it should be implemented in this project. I think it would be simple to implement as a hook that is called when the linux package (or other kernel) is updated.

NicoHood commented 7 years ago

That'd make more sense actually.

Not sure if this already exists. I searched a bit but found nothing so far. But it would really make sense to also track the /boot partition with snap-pac. Otherwise kernel updates can get you really in trouble when reverting anything.

You could make it as subproject and add this as optional dependency for example. It would be extremely important for those having fat32 boot partitions.

wesbarnett commented 7 years ago

Put the following in /usr/share/libalpm/hooks. Ensure the file has .hook as a suffix. Enjoy:

[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = linux

[Action]
Description = Backing up /boot...
When = PreTransaction
Exec = /usr/bin/rsync -avzq --delete /boot /.bootbackup
NicoHood commented 7 years ago

Thanks. I've added it to the wiki: https://wiki.archlinux.org/index.php/Snapper#Backup_boot_partition