Timeshift

I have been using Linux Mint for quite a while now, and Linux Mint has had Timeshift since Mint 19, which is about two years by now. But I haven’t noticed it until recently, and it is actually pretty nifty.

An example: I was consolidating services on my network, and as VLANs were involved, it meant reconfiguring the network of one server. And at one point, I had tried so many ways of doing that, that I really wanted to see exactly how my setup was shortly before I started messing around. Timeshift to the rescue!

My server runs with Linux Mint and thus is based on Ubuntu and thus uses netplan (and VLANs and netplan is worthly a post on its own!). So it was as easy as:

diff /etc/netplan/1-network-manager-all.yaml /media/media/timeshift/snapshots-daily/2020-07-17_20-00-01/localhost/etc/netplan/1-network-manager-all.yaml

(you’re not afraid of long commandlines, are you?)

So let’s talk about Timeshift. Timeshift is made for scenarios exactly like this; when you are tinkering with the setup of your systems and really wish you could go back in time to a point, where it still worked. It can restore all files to that point, or you can look at individual files just as I did.

This is also why Timeshift by design and by default excludes your home folder. If you want to restore your system to the way it was like, say, a month ago, you would very likely not want any of your files in your home folder to revert back too when doing so.

It’s is also not version control. If I wanted to see the entire history of changes, I would need another tool.

And it is also not really a backup. To save space, Timeshift links files that are unchanged between shapshots, which is pretty nifty. It is like having a copy in each snapshot, but you really only have one file, and you can delete a snapshot without affecting any of the others – the file stays until you delete the last reference. But this also means that if a files fails on the backup for some reason, it fails in all instances.

What Timeshift does, and does well, is to allow you to revert your system to a known good previous state.

One last word about Timeshift:

It will back up to a folder in the root of a filesystem called /timeshift, and by default the root filesystem. I usually configure my systems with a fairly small root filesystem and then mount in the space-consuming parts as separate filesystems. It is much more manageable that way (see my previous post about upgrading Mint for an example).

This also means, that I really do not want Timeshift to be in the root filesystem, and for my personal system the filesystem mounted as /home would be ideal. But I use an encrypted home folder, and how will that work out?

Turns out it works just fine. Without going into too much details, it is the individual home folders of each user that are encrypted and not the entire filesystem. So pointing Timeshift at the filesystem mounted as /home will make it place its snapshots unencrypted alongside the files holding the encrypted home folders (and then it will be accessible as /home/timeshift).

Linux Mint 20

I have just updated to Linux Mint 20.

That doesn’t sound like much of an achievement, but let me tell you a bit about my setup:

I dual boot. I love Linux and I have been doing just about anything I do on my computer on Linux including post processing of my photos (OK, some day we shall have a talk about Canon). The only caveat is gaming, and I do game too – and it is not really viable to avoid Windows, if you game. So I have been dual booting a Linux Mint and a Windows 10.

I use UEFI. Why? Because I was told it was safer and more modern, and who wouldn’t like that? But it can make things like dual booting infinitely more challenging. Did you know that Linux Mint is based on Ubuntu, which means the bootloader goes into the same directory? The bootloader needs to be signed, and the signing key trusted by the BIOS – and how does an open source OS then gets signed?

And talking about UEFI and dual booting Windows: install Windows first; it does not seem to understand why you would want anything but Windows.

I needed a clean install. I have used the current Linux Mint for quite some time, and many things have come and gone, so I really needed a clean start. Combined with the fact that the root partition was on the small side and not extendable, it all pointed to a clean install. Which ideally would mean triple booting: Windows and old and new Linux Mint.

I use an encrypted home folder. It does cost some performance, but encryption is cool, and it means that I do not have to worry that much about what may lie around when I am done using the hardware. But the encrypted home folder is supposedly tied to the OS. How to handle that when doing a fresh install? And not only do I use an encrypted home folder, /home is a separate partition on other drive.

With a setup like this, I did a lot of contingency planning. But it simply worked. Hats off to all those involved in making that work!

Here is how it went:

First I booted into Windows and told it that I wanted to reboot of a USB – Windows can do a lot of tricks to make shutdown and startup faster, but this would probably count as a hint not to.

Install was the usual choosing of timezone and keyboard layout etc. Choose the exact same user and password as before (this is important). When it comes to choosing how to layout the filesystem across partitions, choose custom.

Now make the installer allocate space for a new partition for the root filesystem. Swap can be shared with the other instance – they will never run concurrently when in a multi boot setup. And mount the /home from the existing partition (do not format – which is the default).

The installer will recognize not only that there is a Windows and another Linux, and add them to the boot menu. But it will also allow the /home folder to be shared even though it is encrypted.

As most of my settings are persisted in my home folder, it means mostly just reinstalling all that I want to keep. Everything so far has just picked up as if nothing had happened. And I can still boot into the old version of Mint – at some point some applications will deviate enough to not be able to coexist, but it is still nice to be able to see, exactly how things where.

I am very impressed.