site  contact  subhomenews

Quirky Snapshot Manager

December 27, 2013 — BarryK
I listed a goal for Quirky is to support system update/rollback/recovery, and a few days ago I posted what was the first step, proper support for uninstallation of packages in Quirky's "full installation" environment. See:

Now there is another big step, or to use my earlier analogy, the structure has not just a few bricks, but most of the walls built...

The Quirky Snapshot Manager takes a snapshot of the entire partition and saves it as a compressed file. You can "roll back" to that snapshot whenever you want. That's the essence of it.

Furthermore, there can be any number of snapshots, a whole history of them, and any earlier snapshot can be rolled back to.

Here is the GUI:

A possible scenario is that you want to experiment with compiling a lot of packages, but in case things get stuffed up, or if you just don't want to keep all the stuff that you have compiled and installed, very simple, take a snapshot beforehand.
It is easy-peasy to roll back afterward to that snapshot.

Some technical notes about how it works:

Older snapshots
The latest snapshot is a compressed file of almost all the files in the system partition, except for stuff that should not be saved, such as /dev, /tmp, /proc, etc.
Older snapshots are kept as delta (difference) files only, hence they are small. However, that does mean that if you choose to roll back to an older snapshot, the Snapshot Manager has to reconstruct the snapshot by reconstituting the delta files in sequence, going back in time.

Snapshots limit
In theory, you could have any number of older snapshots, and the GUI allows selection of the allowable limit up to 25. However, it is doubtful that you would want such a long history. There is not much point in rolling right back, usually it is only done for error recovery.
Although you can manually set the limit, the Snapshot Manager will automatically reduce this as the partition becomes full. In fact, it starts to reduce as the partition grows over 50% full, down to 1 when 75% full.

When the Recover button is clicked, there is then a choice whether to recover immediately while still running Quirky, or to reboot and recover.
The latter is a "play safe" mode, in which there is bootup into a ramdisk (with a tiny-Quirky in it), which then does the recovery, then there is another reboot.
Recovery via ramdisk does require that the installation is not absolutely trashed -- at least the basic utilities such as busybox must be functional. This does require that be OK.
In theory, I could create static utilities especially for the ramdisk, but that is a maybe future thing.

I have tested recovery both ways, and they both work. Recovery while Quirky is still running can potentially cause trouble, but if it does, a reboot will probably fix it. Or restart X.

Kernel boot parameter
It is also possible to cause a recovery at bootup by typing in the boot parameter "qfix=back". This will launch tiny-Quirky in a ramdisk and a menu will be offered of all available snapshots.

This is a neat tool. I created it primarily because this is something that I personally will use. For developers, or anyone who fiddles with their installation, it is comforting to know that there is an earlier snapshot that works, that can be rolled-back to if required.

I deliberately decided not to try and use any other partition in the computer for backup. Instead, it is all done in the one partition, in which Quirky is installed. This does mean that some spare space has to be left in the partition as "working space", at least 30% (before a snapshot is made).

Another point I should make is that the Quirky Snapshot Manager is written specifically for Quirky6. It requires a full installation, it expects some Quirky-specific layout, such as /var being a symlink into /tmp/var. It also checks for a vfat first-partition, in the case of an installation to an entire drive, and rolls back files logo.16 and vmlinuz as appropriate in that partition.

Note also, it is gettexted, and that should even work when doing recovery in a ramdisk.

The two scripts required to do all of this are /sbin/init and /usr/sbin/snapshot-manager.

The GUI tool is launched from the Filesystem menu.

Expect to see this in the upcoming Quirky 6.1.


One point that I should qualify: if the limit is set to 5 snapshots, it does not mean that after taking 5 snapshots, you can't take anymore.

You can keep taking them.

What happens is that the older snapshots get deleted. So, you have 5, the latest snapshot, and four earlier ones (which are delta-files). Any older snapshot is gone.

Tags: quirky, linux