[HowTo] Alternate method for BTRFS Snapshots

Hi all,

This is the easiest and quickest way I’ve found to enable BTRFS snapper snapshots on Manjaro, after a clean install (tested on Plasma version but should work on all).

REMEMBER! to select btrfs filesystem option during the installation process. Not the default, which is ext4.

After a fresh installation of Manjaro, right after your first boot into the new installed system, immediately remove timeshift to avoid any timeshift snapshot if you make an update.

Here are the steps:

pamac remove timeshift timeshift-autosnap-manjaro

This step is optional:

Edit /etc/fstab and add noatime,compress=zstd to every BTRFS entry.

Example of what the / entry should look like:

UUID=a421daab-6583-4360-8cf4-b70d21bb2ba0 /              btrfs   subvol=/@,defaults,discard=async,ssd,noatime,compress=zstd 0 0

Adding noatime and compression will now save storage space and also you will see increased IO speed.

— end of optional step —

Next:

Enable the grub menu option:

sudo nano /etc/default/grub

Make sure the line GRUB_TIMEOUT_STYLE reads like this:

GRUB_TIMEOUT_STYLE=menu

Then save the file, exit nano and run sudo update-grub.

After that, install the following programs:

pamac install snapper btrfs-assistant grub-btrfs snap-pac inotify-tools

When prompted, choose optional dependency 1:
btrfsmaintenance

Next:

sudo systemctl enable --now grub-btrfsd.service
sudo snapper -c root create-config /

Now create one snapshot for validation:

sudo snapper -c root create --description "First snapshot before updates"
sudo chmod a+rx /.snapshots
sudo chmod 700  /.snapshots
sudo chown :users /.snapshots

The End!

And that’s all you need.

After that, any updates that you do, either with pamac, pacman, yay, paru, etc., will trigger a snapper pre/post update and will show on your boot menu when powering up, so you have a choice to boot into you snapshot history.

I REALLY hope Manjaro developers put a little extra effort in the installation process and include this in the default installations of Manjaro when BTRFS is selected.

Anyway, KUDOS to all their work for the best arch based distro!
This is really a must for accidental recovery of any OS/user/F*up made by anything and guarantees a rollback recovery instead of having to do a full reinstall process.

Thanks.

5 Likes

On my straight Arch system, the fstab entries are “compress-force=zstd:3”

2 Likes

Edited post for general readability and tidyness. No charge.

1 Like

Indeed they are, and also on arcolinux and I believe also on Garuda. And that’s the way they should be set for all fstabs related to BTRFS on any distro during installation.
BTW, the setting “compress-force=zstd:3” I believe defaults to zstd by just specifying “compress=zstd”

1 Like

It is not recomendet to use force-compress

https://btrfs.readthedocs.io/en/latest/Compression.html#incompressible-data


Using the forcing compression is not recommended, the heuristics are supposed to decide that and compression algorithms internally detect incompressible data too.

Pre-compression heuristics

The heuristics aim to do a few quick statistical tests on the compressed data in order to avoid probably costly compression that would turn out to be inefficient. Compression algorithms could have internal detection of incompressible data too but this leads to more overhead as the compression is done in another thread and has to write the data anyway. The heuristic is read-only and can utilize cached memory.

The tests performed based on the following: data sampling, long repeated pattern detection, byte frequency, Shannon entropy.

:footprints: