Hi,
I just wanted to share my experience of setting up my system with the kubuntu 20.04 LTS release and BTRFS, in case that is useful for anyone else.
My first attempt, where I was just following the regular LUKS full disk encryption guide for ubuntu 18.04 failed completely - I think the partitions and grub were not set up correctly, because btrfs handles partitions/subvolumes a bit differently. In my case the step where you use the chroot environment to set up crypttab ended in a complete disaster with the old guide (i.e. chroot giving me errors all the time).
Instead, I used this guide, which worked perfectly (including chroot):
https://mutschler.eu/linux/install-guides/ubuntu-btrfs/
I opted for a swap file and also installed Timeshift along with timeshift-autosnap-apt and grub-btrfs, as suggested, however, I do not include the @home subvolume in Timeshift.
The reason is that I have a separate backup process using btrbk (which is also in the ubuntu repos).
I think this is fairly important, as Timeshift only creates local snapshots on your disk. This is very fast, but if your disk fails or you loose your laptop, you are out of luck. Timeshift seems to be convenient to restore your system after you broke it or an upgrade failed, but it is not a backup solution!
I hope someone will find this useful - feel free to ask questions or comment on my setup!
Before I describe my backup solution, one word of advice: if you are not familiar with Btrfs and you are considering to switch (and there are reasons to do so, in particular related to easy backups), do some research first! There are some important conceptual differences to regular file systems like ext4, and the steps in the guide linked above will make a lot more sense, once you are aware of that.
Read some articles and in particular, make sure you understand Copy-on-Write and subvolumes. For example, your system-root "/" is not the btrfs filesystem root, it is actually just a subvolume of your btrfs <root_fs>, which is conventionally called '@'.
I found this post here on kubuntuforums quite useful, too:
https://www.kubuntuforums.net/showth...-and-SNAPSHOTS
The way I set up my backup using btrbk requires some preparation:
First I created a larger partition with an encrypted LUKS volume on an external HDD, formatted that with btrfs, created a subfolder (not a subvolume) to hold my backups, and mounted it on my computer. I created the LUKS and did the formatting with the KDE Partition Manager (GUI). You could add a key file to mount this volume automatically when the HDD is plugged in, but I just use Dolphin and kwallet to unlock it when I log in; just make sure this is mounted when the backup-process runs.
Then I mount my btrfs <root_fs> with the OS/root/@ and home/@home subvolumes at a mount point (say /mnt/btrfs_pool) and create a subfolder there to hold my snapshots.
With that, you can run btrbk through a cronjob. btrbk requires a config file, which is quite straight forward to set up and should be run as a root cronjob.
https://digint.ch/btrbk/doc/readme.html
Personally, I also have a wrapper script for btrbk, which mounts the <root_fs> before btrbk is called, and unmounts it afterwards. Note, however, that in principle this does not appear to be necessary, because Timeshift seems to always have the <root_fs> of your system drive mounted at /run/timeshift/backup/.
This creates automatic rotating/cycling backups of your system and home subvolumes on an external, encrypted disk. One of the nice things is that these backups are done incrementally (similar to rsync, but smarter and faster); for me a complete incremental backup from my system SSD to my external HDD takes less than a minute and I have them scheduled daily; the initial backup of course takes longer (~30min.).
I hope someone will find this useful - feel free to ask questions or comment on my setup!
I just wanted to share my experience of setting up my system with the kubuntu 20.04 LTS release and BTRFS, in case that is useful for anyone else.
My first attempt, where I was just following the regular LUKS full disk encryption guide for ubuntu 18.04 failed completely - I think the partitions and grub were not set up correctly, because btrfs handles partitions/subvolumes a bit differently. In my case the step where you use the chroot environment to set up crypttab ended in a complete disaster with the old guide (i.e. chroot giving me errors all the time).
Instead, I used this guide, which worked perfectly (including chroot):
https://mutschler.eu/linux/install-guides/ubuntu-btrfs/
I opted for a swap file and also installed Timeshift along with timeshift-autosnap-apt and grub-btrfs, as suggested, however, I do not include the @home subvolume in Timeshift.
The reason is that I have a separate backup process using btrbk (which is also in the ubuntu repos).
I think this is fairly important, as Timeshift only creates local snapshots on your disk. This is very fast, but if your disk fails or you loose your laptop, you are out of luck. Timeshift seems to be convenient to restore your system after you broke it or an upgrade failed, but it is not a backup solution!
I hope someone will find this useful - feel free to ask questions or comment on my setup!
Before I describe my backup solution, one word of advice: if you are not familiar with Btrfs and you are considering to switch (and there are reasons to do so, in particular related to easy backups), do some research first! There are some important conceptual differences to regular file systems like ext4, and the steps in the guide linked above will make a lot more sense, once you are aware of that.
Read some articles and in particular, make sure you understand Copy-on-Write and subvolumes. For example, your system-root "/" is not the btrfs filesystem root, it is actually just a subvolume of your btrfs <root_fs>, which is conventionally called '@'.
I found this post here on kubuntuforums quite useful, too:
https://www.kubuntuforums.net/showth...-and-SNAPSHOTS
The way I set up my backup using btrbk requires some preparation:
First I created a larger partition with an encrypted LUKS volume on an external HDD, formatted that with btrfs, created a subfolder (not a subvolume) to hold my backups, and mounted it on my computer. I created the LUKS and did the formatting with the KDE Partition Manager (GUI). You could add a key file to mount this volume automatically when the HDD is plugged in, but I just use Dolphin and kwallet to unlock it when I log in; just make sure this is mounted when the backup-process runs.
Then I mount my btrfs <root_fs> with the OS/root/@ and home/@home subvolumes at a mount point (say /mnt/btrfs_pool) and create a subfolder there to hold my snapshots.
With that, you can run btrbk through a cronjob. btrbk requires a config file, which is quite straight forward to set up and should be run as a root cronjob.
https://digint.ch/btrbk/doc/readme.html
Personally, I also have a wrapper script for btrbk, which mounts the <root_fs> before btrbk is called, and unmounts it afterwards. Note, however, that in principle this does not appear to be necessary, because Timeshift seems to always have the <root_fs> of your system drive mounted at /run/timeshift/backup/.
This creates automatic rotating/cycling backups of your system and home subvolumes on an external, encrypted disk. One of the nice things is that these backups are done incrementally (similar to rsync, but smarter and faster); for me a complete incremental backup from my system SSD to my external HDD takes less than a minute and I have them scheduled daily; the initial backup of course takes longer (~30min.).
I hope someone will find this useful - feel free to ask questions or comment on my setup!
Comment