Arvin Schnell, 29 April 2014
As you might know it is possible to boot a btrfs snapshot of your root filesystem. That allows you to recover from certain boot problems of your system.
The approach is to manually boot a snapshot that is known to work and then setup the system to use a read-write snapshot of that snapshot per default.
So far this only works with btrfs and the system must be properly configured, e.g. mountpoint for subvolumes must be included in /etc/fstab, esp. for /.snapshots. With openSUSE 13.2 all of that should work out of the box.
Warning: First try this on a test system!
Here is an example of the workflow:
Create a snapshot of a “good” state and remember the snapshot number:
# snapper create --description "good" --print-number 42
Now ruin your system:
# rm /bin/bash
Reboot the system. Your system will not boot correctly or at least you cannot login. Reboot again and tell the kernel to boot the “good” snapshot by setting the kernel rootflags parameter:
I inserted the rootflags parameter right after the root parameter. You might also want to remove the splash and quiet parameter to better see potential error messages.
Your system should boot fine except that the root filesystem is read-only now since snapper normally creates read-only snapshots. So a few more steps are required which snapper can do for you:
# snapper rollback
That command does the following:
Create a read-only snapshot of the btrfs default subvolume. That is the system you just ruined.
Create a read-write snapshot of the currently mounted btrfs subvolume. That is the “good” snapshot we created some minutes ago and booted into.
Set the btrfs default subvolume to the second of the just created snapshots.
Now reboot your system once again and everything should be working fine.
This feature is available in snapper since version 0.2.2.