this post was submitted on 11 Nov 2023
855 points (85.2% liked)
linuxmemes
21180 readers
913 users here now
Hint: :q!
Sister communities:
Community rules (click to expand)
1. Follow the site-wide rules
- Instance-wide TOS: https://legal.lemmy.world/tos/
- Lemmy code of conduct: https://join-lemmy.org/docs/code_of_conduct.html
2. Be civil
- Understand the difference between a joke and an insult.
- Do not harrass or attack members of the community for any reason.
- Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
- Bigotry will not be tolerated.
- These rules are somewhat loosened when the subject is a public figure. Still, do not attack their person or incite harrassment.
3. Post Linux-related content
- Including Unix and BSD.
- Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of
sudo
in Windows.
- No porn. Even if you watch it on a Linux machine.
4. No recent reposts
- Everybody uses Arch btw, can't quit Vim, and wants to interject for a moment. You can stop now.
Please report posts and comments that break these rules!
founded 1 year ago
MODERATORS
When I started using Arch I just set it up on a btrfs filesystem and wrote a simple btrbk hook to take a snapshot before any package updates. That made it trivial to unfuck anything that broke after an update. I can't remember the last time I had to roll the system back but it's nice for peace of mind.
That’s quite clever, are there any guides for getting that set up? I’m using btrfs but haven’t gotten into snapshotting yet.
Start by playing with subvolumes and snapshots so you can get a feel for how they work. Once you've got that down you can break down your root filesystem into sensible subvolume chunks (
/
,/home
,/var/log
,/var/cache
etc) so that you only snapshot relevant content during each update. I wrote a btrbk config at that point, tested it a few times and then wrote a pacman hook to fire it on install, update or package remove events and went from there.Here's what I use to take snapshots - you'll need to write an appropriate btrbk config file for your subvolume layout but it's otherwise feature complete. https://gitlab.com/arglebargle-arch/btrbk-autosnap
Like I mentioned above, I haven't actually needed to roll the system back in ages but I get a lot of mileage out of being able to reach back in time and grab old versions of files for comparison.
Time shift is a lot easier if you're just starting out but it also requires a specific subvolume structure and isn't very flexible.
Edit: pro tip: don't make
/var
a separate subvolume from/
, it's way, way, way too easy to roll one or the other (/ or /var) back without the other. If you do that by accident pacman's state becomes out of sync with the running system and everything breaks. Stick to splitting frequently rewritten data like /var/cache and /var/log off, leave /var itself in the root subvolume.Timeshift, Timeshift auto-snap, and btrfs in the grub menu to have your snapshots there, too. Auto-snap takes a snapshot automatically whenever you upgrade or install some packages.