Auto-Snapshot with dnf on Fedora | 在fedora上使用dnf自动快照
When I was using Arch Linux, one of my favorite packages was snap-pac, which works elegantly with pacman to create snapshots before and after any update.
当我在用 Arch Linux 的时候,我最喜欢的软件包之一是 snap-pac,它可以和 pacman 优雅地配合,在任何更新前后创建快照。
After I returned to Fedora, I wanted to implement a similar process for dnf. However, I found the solution is a little more complicated than on Arch, especially for dnf5. So, this article is a step-by-step guide to set it up.
回到 Fedora 后,我想为 dnf 实现类似的功能。然而,我发现解决方案比 Arch 上要复杂一些,特别是对于 dnf5。所以,这篇文章是一个手把手的设置指南。
1. Install necessary packages | 安装必要的软件包
1 | |
2. Setup snapper config | 设置 snapper 配置
1 | |
If you want, you can also create snapshot for /home as well:
如果你愿意,也可以为 /home 创建快照:
1 | |
3. Setup dnf-snapper | 设置 dnf-snapper
1 | |
And copy and paste the following content:
然后复制并粘贴以下内容:
1 | |
Now save and exit, and restart the computer if you can. Everything should work properly now.
现在保存并退出,如果可以的话重启电脑。一切都应该能正常工作了。
Conclusion | 总结
Using linux OS is an infinite loop of crash and recover. And snapshot is the only thing can help us take our breath and sleep at night.
使用 Linux 操作系统就是一个无限循环的崩溃和恢复。而快照是唯一能让我们在晚上松一口气,安然入睡的东西。