Automated snapshots on EXT4 filesystem

Hello everyone! I finally installed Endevour in single boot!
My laptop has an ssd and an hdd. The ssd contains the whole operating system but the home folder, which is on the hdd.
Both of them are encrypted and everything has been set up accordingly in crypttab (both of them use the same key and needed to be unlocked at boot) and fstab (to specify the home folder had to be in the other partition).
I am not extremely confident about not breaking anything with updates and such and before starting doing anything I may want to revert, I decided to try and make full system snapshots (so both OS and home dir in the other disk).
I looked inside the EndevourOS’s wiki and I found an article talking about timeshift (https://discovery.endeavouros.com/encrypted-installation/btrfs-with-timeshift-snapshots-on-the-grub-menu/2022/02/) but it uses BTRFS and if possible I would REALLY like to stick with EXT4.
I haven’t been able to find anything related to using timeshift on non-BTRFS partitions.
On the Arch Wiki I managed to find this page (https://wiki.archlinux.org/title/System_backup) with multiple solutions.
I am not sure I am using lvm so I did not open that page.
The other two options I am aware from that are rsync and tar. Both of them look VERY heavy and if possible I would like to have grub menu to restore and manage snapshots (see timeshift link from before). Does anyone have any suggestion or perhaps personal preference on how to perform such task? Possibly with some util to do it periodically like Timeshift?

As far as I know, Timeshift uses Rsync for snapshots if you are using an ext4 filesystem. ext4 is not a copy on write (COW) filesystem so the concept of snapshots doesn’t exist in ext4 unlike btrfs or zfs which are COW filesystems.

3 Likes

Timeshift works in two modes: Rsync- or BTRFS mode.

In rsync mode, snapshots are taken using rsync and hard links. Your initial snapshot needs as much space as your original data. Duplicate files are shared between the snapshots to save disk space. Generating and restoring snapshots takes some time because new files have to be physically copied. Timeshift in rsync-mode can save data anywhere, you’re ext4 filesystem for instance.

In BTRFS mode, snapshots are taken using the BTRFS file system. The initial snapshot doesn’t take up any space, only future changes to your data. Generating and restoring snapshots takes very little time (~1 second).

=> So in short, Timeshift actually does what you need. Just give it a try.

Grub doesn’t provide this feature. While grub can boot into a btrfs snapshot, you’ll still need to restore a snapshot from a running system; your booted snapshot, your regular system, a live environment, etc.
To restore a snapshot you could then use Timeshift from within this system; or plain rsync, or any other method to copy your backuped snapshot files.


If you’re not sure you’re most probably not using logical volumes. Last time I checked you’d have to set this up manually in calamares and make some adjustments to the system afterwards to get the encryption working. So, you’d probably know.
LVM actually also has a snapshot feature built-in. Used it for years with ext4, but I prefer btrfs snapshots: easier and faster to work with.

4 Likes

Welcome to the forum @leonardo03
My limited personal experience, I had ext4 with timeshift. But after reading so much on btrfs, and getting sick of seeing Btrfs as a greyed out option ín timeshift, I decided to try out btrfs with Btrfs Assistant grub-btrfs and it’s perfect. I don’t use LVM or LUKS encryption, but I am sure it will work. Just my experience, but I would not return to ext4.
Also using Btrfs Assistant, which is written by @dalto I don’t need timeshift and its currently keepíng 270 snapshots taking very little space, and can reboot into any of those snapshots from the grub menu.
Also it lists the files added/removed/edited in that snapshot making into easier to restore tho the right snapshot. Btrfs Assistant is in the aur, should you take the Btrfs approach.
I wish you well in your journey.

1 Like

Hello there! Thank you for the reply! Unfortunatelly I’ve heard quite a few bad rumors about btrfs and also don’t want to reinstall my system from scratch, although btrfs could be worth a try if I reinstall my other computer.

In the end (if someone ever needs this), I decided to use borgbackup as my primary backup method and rsync as a fallback; Both on an external disk.

sudo rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/home/*"} /run/media/myuser/Backups/EMERGENCY/ #This is the rsync backup command I did run
sudo borg init --encryption=none /run/media/myuser/Backups/borgbackup
sudo borg create --compression zlib,6 --atime --comment 'Initial Backup' --exclude '/dev/*' --exclude '/proc/*' --exclude '/sys/*' --exclude '/tmp/*' --exclude '/run/*' --exclude '/mnt/*' --exclude '/media/*' --exclude '/lost+found' --exclude '/home/*' /run/media/myuser/Backups/borgbackup::initial_backup / --progress

I plan on keep doing backups using the same command but manually changing values such as day, month and year.
I should be able to automate the process using cron jobs.
Although I am unsure whether the command is good to go or can be made shorter, mounting the archive showed all the directories and files I backed up (apparently) correctly.
Perhaps using borgmatic I wouldn’t have to type the whole lenghty command everytime!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.