为 ubuntu 编写一个系统救星,用于将损坏的系统恢复到工作状态

发布于 2024-12-08 16:42:34 字数 687 浏览 0 评论 0原文

我正在考虑为 ubuntu 编写一个系统救星应用程序,它可以将系统恢复到较早的状态。这在系统崩溃的情况下非常有用。 用户可以之前创建还原点,然后使用它们来还原系统。 这最初用于包,然后用于恢复以前版本的文件,有点像 Microsoft Windows 中的系统恢复功能。 这是想法页面 想法页面

我已经经历了一些实现它的想法,就像在 Windows 中完成的那样,通过在文件系统中保存有关文件的信息,文件系统足够智能,可以用于此功能。但是我们在linux中没有这样的文件系统,这样的文件系统就是brtfs,但是使用它会导致用户创建分区,这会很麻烦。所以我正在考虑一种“写入时复制和删除时保存”的方法。创建还原点时,我将在应用程序之前创建的还原文件夹中创建一个新的备份目录,例如“backup#1”,然后为需要还原的文件创建硬链接。现在,如果任何文件从其原始位置删除,我将拥有其硬链接,可在需要时用于恢复该文件。但这种方法不适用于修改。为了进行修改,我正在考虑在文件系统中创建挂钩(使用 redirfs ),它将调用我附加的回调将检查文件各个部分的修改。我会将这些所有更改保留在数据库中,然后在需要恢复时立即撤消更改。

请建议我一些有效的方法来做到这一点。 谢谢

I am thinking of writing a system life saver application for ubuntu, which can restore system to an earlier state. This could be much useful in situations of system break.
User can create restore point before and then use them to restore their system.
This would be used for packages initially and then later on for restoring previous versions of files,somewhat like system restore functionality in microsoft windows.
Here is the idea page Idea page

I have gone through some ideas of implementing it like that which is done in windows, by keeping information about the files in the filesystem, the filesystem is intelligent enough to be used for this feature. But we don't have such file system available in linux, one such file system is brtfs but using this will lead to users creating partitions, which will be cumbersome. So I am thinking of a "copy-on-write and save-on-delete" approach. When a restore point is created I will create a new directory for backup like "backup#1" in the restore folder created by application earlier and then create hard links for the files needed to be restored. Now if any file is deleted from its original location I would have its hard link with me which can be used to restore the file, when needed. But this approach doesn't work on modification. For modification I am thinking of creating hooks in the file system (using redirfs ) which will call my attached callbacks which will check for the modifications in various parts of the files. I will keep these all changes in the database and then reverse the changes as soon as a restore is needed.

Please suggest me some efficient approaches for doing this.
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

睫毛上残留的泪 2024-12-15 16:42:34

正如所建议的评论一样,LVM 快照功能为此类任务提供了良好的基础。它将在每个分区级别上工作,并且仅保存与当前系统状态相比发生变化的扇区。 LVM 指南给出了很好的概述

不过,您必须从一开始就使用 LVM 设置系统,并为快照留出足够的空间。

Like the comments suggested, the LVM snapshot ability provides a good basis for such an undertaking. It would work on a per-partition level and saves only sectors changed in comparison with the current system state. The LVM howto gives a good overview.

You'll have to set up the system from the very start with LVM, though, and leave sufficient space for snapshots.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文