[arch-general] Btrfs snapshots for upgrade operations
Tom Gundersen
teg at jklm.no
Thu Oct 25 11:02:08 EDT 2012
On Thu, Oct 25, 2012 at 3:50 PM, Leonidas Spyropoulos
<artafinde at gmail.com> wrote:
> Archlinux is supporting btrfs for root filesystem some time now. Have any
> work or thoughts been done for supporting snapshots before update packages?
> This way you can keep record of what's happening to your system and easily
> rollback if something breaks.
> I know Fedora and Suse (if not mistaken) supports that with their package
> managers.
I put together a proof-of-concept a while back for doing something
like this. It "worked", but was nowhere near ready for public
consumption, so I never posted it anywhere.
What I thought would be nice was the ability for an upgrade to take
effect on the next reboot without touching the running system. No need
to integrate with pacman, a wrapper in bash would do.
It went something like this (assuming / is on btrfs):
create a new subvolume as a snapshot of /
mount the new subvolume on /mnt/
pacman -Syu --root=/mnt
mark the new subvolume as the default one
This means the current rootfs is not touched at all during the
upgrade. However, next time the rootfs is remounted (i.e., on the next
reboot) you will get the upgraded system. Moreover, if something went
pear shaped, the subvolume of your old system should still be around
which you can boot into with the right kernel parameter.
Obviously any changes you do to the rootfs after creating the snapshot
will be lost on the next reboot, so some care must be taken to make
sure you know what you are doing :-) (it might be reasonable to only
allow this if the rootfs is mounte read-only).
Cheers,
Tom
More information about the arch-general
mailing list