Using snapper to snapshoot and restore a system

When using timeshift with btrfs it can take snapshots of @ and optionally @home only.

If you had a separate partition, timeshift when using btrfs would not be able to access it.

1 Like

I’m talking about the timeline settings here: /etc/snapper/configs/config Would they be the same for the /home config. I’m not sure what you meant about change the config settings in /etc/snapper. Those files are locked so i need root on kde.

Yes, a new one should have been created there called home. They all start out with whatever you have in the default template. However, you can change them to have whatever settings you prefer.

1 Like

Thanks @dalto @pebcak for all the explanations. My brain hurts but i think i have a better understanding. I still have unanswered questions about the snapshots being read only and do i need them to be writable? I also didn’t use the chmod command. Do i need to do any of these? I’m not very strong on permissions.

chmod a+rx .snapshots
chown :users .snapshots

Also how to restore is another day?

1 Like

No, your snapshots should not be writable.

You shouldn’t do either of those. The first one is an especially bad idea. That will make your snapshots accessible to all users.

Having your snapshots be not easily browsable is to your benefit. For example, if you do a find on your whole filesystem you don’t want it to search every file in every snapshot.

2 Likes

It’s definitely working so now i’ll just have to figure out how to use it. I’m not sure what to set the timeline settings at so i went with what the video showed.

[ricklinux@eos-kde ~]$ snapper -c root list
  # | Type   | Pre # | Date                        | User      | Cleanup  | Description                            | Userdata
----+--------+-------+-----------------------------+-----------+----------+----------------------------------------+---------
 0  | single |       |                             | root      |          | current                                |         
 1  | single |       | Tue 17 Aug 2021 11:11:49 PM | ricklinux | timeline | AfterInstall                           |         
 5  | single |       | Wed 18 Aug 2021 12:00:44 AM | root      | timeline | timeline                               |         
 8  | single |       | Wed 18 Aug 2021 01:38:28 AM | ricklinux | timeline | rEFIndIcon                             |         
 9  | single |       | Wed 18 Aug 2021 02:00:05 AM | root      | timeline | timeline                               |         
10  | single |       | Wed 18 Aug 2021 02:29:36 AM | root      | number   | snap-pac                               |         
11  | pre    |       | Wed 18 Aug 2021 08:56:34 AM | root      | number   | pacman -Syu                            |         
12  | post   |    11 | Wed 18 Aug 2021 08:56:34 AM | root      | number   | git konsole util-linux util-linux-libs |         
13  | single |       | Wed 18 Aug 2021 09:00:02 AM | root      | timeline | timeline                               |         
14  | single |       | Wed 18 Aug 2021 09:50:35 AM | root      | number   | boot                                   |         
15  | single |       | Wed 18 Aug 2021 10:00:15 AM | root      | timeline | timeline                               |         
16  | single |       | Wed 18 Aug 2021 10:01:07 AM | root      | number   | boot                                   |         
17  | single |       | Wed 18 Aug 2021 11:00:57 AM | root      | timeline | timeline                               |         
18  | single |       | Wed 18 Aug 2021 11:35:30 AM | root      | number   | boot                                   |         
19  | single |       | Wed 18 Aug 2021 12:29:18 PM | root      | number   | boot                                   |         
[ricklinux@eos-kde ~]$ snapper -c home list
 # | Type   | Pre # | Date                        | User      | Cleanup  | Description   | Userdata
---+--------+-------+-----------------------------+-----------+----------+---------------+---------
0  | single |       |                             | root      |          | current       |         
1  | single |       | Wed 18 Aug 2021 10:56:22 AM | ricklinux |          | FirstSnapshot |         
2  | single |       | Wed 18 Aug 2021 11:00:57 AM | root      | timeline | timeline      |         
[ricklinux@eos-kde ~]$ 

Thanks, as i was thinking. I like more typing when I’m not sure of what I’m doing :wink:

Yes, I’ve crearly explained my thought wrong but that’s what I was intending. Now I’ve a config that, based on my settings will create snapshot only for @root and not for the other subvolumes. Perfect!
Thank you so much for the esaustive explanation as always.

2 Likes

If it is the same video I saw, it seems like they were set somewhat haphazardly. Although, there have been so many different things posted over the last few days it may be a different video.

One thing to consider is the size of snapshot on disk is directly related to how much data has changed since the snapshot was taken. This means, generally speaking, that the older the snapshot, the more space it takes on disk.

So, given a reasonably typical rate of data change on a desktop, a snapshot from the last 24 hours will take up almost no space at all but a snapshot from 2 years ago will probably be taking up quite a lot of disk space.

That being said, here is how I configure mine for machines that are on most of the time:

  • hourly - 24
  • daily - 7
  • weekly - 5
  • monthly - 12

I may not do all of that depending on how much the data changes and how important it is. For example, on my root volume I stop at weekly. A month’s worth of snapshots is plenty there. On some volumes I do even less, only keeping the daily or hourly snapshots.

One other question i have. When i use EndeavourOS to set up Btrfs and then install snapper and set it up does the Btrfs install and adding snapper set everything correctly in the fstab or so i have to modify it.This is my current fstab after setting all this up. I didn’t manually change anything yet. Do i need to or does calamares take care of it.

[ricklinux@eos-kde ~]$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=65CA-723D                            /boot/efi      vfat    umask=0077 0 2
UUID=97988a9b-07a0-4637-b79d-a41bbfb0fd42 /              btrfs   subvol=/@,defaults,noatime,space_cache,autodefrag,compress=lzo 0 1
UUID=97988a9b-07a0-4637-b79d-a41bbfb0fd42 /home          btrfs   subvol=/@home,defaults,noatime,space_cache,autodefrag,compress=lzo 0 2
UUID=97988a9b-07a0-4637-b79d-a41bbfb0fd42 /var/cache     btrfs   subvol=/@cache,defaults,noatime,space_cache,autodefrag,compress=lzo 0 2
UUID=97988a9b-07a0-4637-b79d-a41bbfb0fd42 /var/log       btrfs   subvol=/@log,defaults,noatime,space_cache,autodefrag,compress=lzo 0 2
UUID=97988a9b-07a0-4637-b79d-a41bbfb0fd42 /swap          btrfs   subvol=/@swap,defaults,noatime,space_cache,autodefrag,compress=lzo 0 2
/swap/swapfile                            swap           swap    defaults,noatime 0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0
[ricklinux@eos-kde ~]$ 

Calamares will automatically configure your /etc/fstab. If it didn’t, your system wouldn’t work after the install.

As for snapper, snapshots don’t require any changes to /etc/fstab

1 Like

ok, now my question is tho, how can I restore a snapshot from a live system?
I’ve screwd up my installation and want to go back to a previous snapshot (taken with snapper). I boot up the live endeavouros iso, and…? I’ve read the Arch wiki about it but find it very confusing.
Also, because I screwd it up trying to switch from grub to systemd-bbot (and now the system doesn’t boot anymore) would be better restore a previous snapshot (so I would have back grub) or trying to fix systemd-boot? (I’ll obviously open another thread in the second case)

Restoring a snapshot won’t fix your bootloader in most cases.

ok, so I’ll open a new thread for that, thank you.

1 Like