BTRFS/Rollback & Yum Snapshot Plugin
Jorge Fábregas
jorge.fabregas at gmail.com
Mon Feb 3 15:44:15 UTC 2014
On 01/30/2014 09:02 PM, Jorge Fábregas wrote:
> Now, here's the thing. I wanted to permanently run off these snapshots
> so I wanted to delete the parent "subvolumes" for these snapshots (e.g.
> "commit" the snapshot) by doing:
>
> # mount -o subvolid=5 /dev/vda3 /mnt
> # btrfs subvolume delete /mnt/root
> Delete subvolume '/mnt/root'
> ERROR: cannot delete '/mnt/root' - Device or resource busy
Well, I found out you can rename the subvolumes and not only that; you
can also rename them ("move" them) while they're being used. This is
what I'm doing when I want to rollback my system to the previous state:
1) Modify GRUB2: Change "rootflags=subvol=root/yum_*" accordingly & reboot
2) Make sure you're running off the snapshot subvolume:
# cat /proc/selfmountinfo | grep btrfs
3) Move/Rename snapshot subvol & delete old root fs
# mount -o subvolid=5 /dev/vda3 /mnt
# mv /mnt/root/yum_20140203080009 /mnt
# btrfs subvolume delete /mnt/root
# mv /mnt/yum_20140203080009 /mnt/root
4) Modify GRUB2: revert rootflags=subvol=root/yum_* to subvol=root
Since I used the default setup for btrfs, Anaconda created a /boot of
its own (ext4). (I presume a btrfs /boot is not ready yet). This
creates some time paradox issues when I want to run "yum upgrade" again:
- yum wants to install a kernel that I already have (the one I'm
currently running with)
- yum wants to remove the oldest kernel (which it already removed on
previous existence)
All of this due to the fact that I restored the previous RPM database
when I rollbacked my system.
There is more to this yum-plugin/btrfs/rollback than meets the eye :(
--
Jorge
More information about the users
mailing list