[arch-general] Btrfs snapshots for upgrade operations

Jan Steffens jan.steffens at gmail.com
Thu Oct 25 11:03:46 EDT 2012


On Thu, Oct 25, 2012 at 4:23 PM, Thomas Bächler <thomas at archlinux.org> wrote:
> Am 25.10.2012 15:50, schrieb Leonidas Spyropoulos:
>> Hello all,
>>
>> Firstly can a TU or developer few it to the dev mailing list, as I don't
>> have access.
>>
>> 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.
>>
>> Of course I am talking about an optional feature enabled only from the
>> user, not by default.
>>
>> Thoughts, ideas, discussion are welcome.
>
> This is surely a great idea when you have filesystem-level snapshots (as
> you have in btrfs).
>
> This sounds like something that can be easily written as a
> proof-of-concept implementation in a shell script. Once you work out the
> exact mechanics, we can consider either adding this to pacman or as an
> external wrapper to pacman, whatever makes sense. (This would be a
> discussion for the pacman-dev mailing list.)
>
> What I'm saying is: If you have a more detailed description of how this
> scheme should work, preferably together with a simple implementation,
> then a much more fruitful discussion will emerge.

Basically you tell the FS to subvol / to a location like
/.pacmansnaps/$datetime.

In the initramfs, you need an emergency facility to let the user list
the available subvols (btrfs su list /) and choose one to mount (which
would require adding subvol=/foo/bar or subvolid=12345 to the
rootflags).

Another thing to think about would be garbage collection of old
snapshots. btrfs also has a way of specifying the default mounted
subvolume of a filesystem.

I suppose a shell script would use the btrfs command to manipulate the
FS, while pacman would probably use IOCTLs?


More information about the arch-general mailing list