备份/归属或整个系统

我正在阅读有关如何备份的内容,并且我一直在运行那些只是备份/home/文件夹而不是整个系统的人。 我只是不明白这里的想法,因为所有已经安装的程序呢?

当然,如果你丢失了你的系统,你会想要一个快速的方法来恢复你的所有数据而不必经历并重新安装所有丢失的程序,因为你慢慢发现你需要在新系统上使用它们,对吧?

如果要备份整个系统,最好通过引导到像clonezilla这样的方式来做它。 然后将整个驱动器映像为快照。 您可以稍后通过再次或类似地引导到clonezilla进行还原,并将磁盘映像复制回磁盘。

http://clonezilla.org/

如果要备份数据库(如您提到的postgres),则应使用特定于您的设置的数据库工具。 例如,我使用AutoMySQLBackup通过滚动备份备份我的MySQL数据库。 我将命令放在crontab中,检查我的USB驱动器是否已连接,如果是,则运行备份。

http://sourceforge.net/projects/automysqlbackup/

第三,如果它是你的个人机器,你也应该备份/回家。 为此,我使用“Back in Time”来跟踪文件的变化。 这样可以保护您免受错误覆盖或删除文件,撤消编辑和其他用户错误等问题的影响。 Lifehacker对它有很好的概述。 偶尔将您的/ home的完整副本复制到USB驱动器并将其存储在场外(例如在办公室)也是一个好主意。 如果这是一个问题,您可以使用加密的USB驱动器。

http://lifehacker.com/5212899/back-in-time-does-full-linux-backups-in-one-click

许多人发现完整的磁盘克隆/恢复并不比刚刚进行全新安装那么麻烦。 很多人也没有自己的SQL数据库。 这就是为什么你看到关注just / home的原因。

我还说没有必要备份整个系统。 /home/etc应该就够了。 如果您还备份了软件包选择,那么灾难发生后您就可以快速启动并运行。

对于Back In Time我编写了一个user-callback脚本,它将在创建新快照之前将所有必要的信息放在您的home 。 从软件中心安装Back In Time并将其配置为backup /home/ 。 如果您要备份/etc配置其他Back In Time配置文件和Back In Time (root)因为只有root拥有对/etc完全访问权限。 然后将下面的脚本复制到~/.config/backintime/user-callback并使用chmod 755 ~/.config/backintime/user-callback使其可执行

 #!/bin/sh # Copyright (c) 2012-2014 Germar Reitze # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # backup selection of apt-get # Take a look at # https://github.com/bit-team/backintime/wiki/FAQ#how-to-backup-debian-ubuntu-package-selection # https://github.com/bit-team/backintime/wiki/FAQ#how-to-restore-debian-ubuntu-package-selection profile_id="$1" profile_name="$2" reason="$3" errorcode="$4" DST="$HOME/.apt-backup" case $reason in 1) #on process begin mkdir -p $DST dpkg --get-selections > $DST/package.list apt-mark showauto > $DST/pkg_auto.list apt-mark showmanual > $DST/pkg_manual.list rm -f $DST/sources.list.d/* cp -aR /etc/apt/sources.list* $DST/ apt-key exportall > $DST/repo.keys ;; esac 

灾难发生后,您需要按照以下步骤操作:

  1. 像往常一样在你的新硬盘上安装Debian / Ubuntu
  2. 从我们的PPA安装backintime-qt4

     sudo add-apt-repository ppa:bit-team/stable sudo apt-get update sudo apt-get install backintime-qt4 
  3. 将外部驱动器与快照连接

  4. 开始Back In Time 。 它会询问您是否要恢复配置。 当然你想要的! Back In Time应该自动找到您的快照。 只需选择要从中恢复配置的那个,然后单击“确定”。
  5. 恢复你的家
  6. 如果你有特别的东西,重新创建你的/etc/apt/sources.list 。 如果您的Debian / Ubuntu版本发生了变化,请不要只从~/.apt-backup/sources.list复制它们
  7. 复制您的存储库

     sudo cp ~/.apt-backup/sources.list.d/* /etc/apt/sources.list.d/ 
  8. 恢复你的PPA的apt-keys

     sudo apt-key add ~/.apt-backup/repo.keys 
  9. 安装和更新dselect with

     sudo apt-get install dselect sudo dselect update install 
  10. ~/.apt-backup/package.list做一些“ ~/.apt-backup/package.list ”。 例如,您不想再次安装旧内核。 所以跑

     sed -e "/^linux-\(image\|headers\)/d" -i ~/.apt-backup/package.list 
  11. 再次安装旧包

     sudo apt-get update sudo dpkg --set-selections < ~/.apt-backup/package.list sudo apt-get dselect-upgrade 
  12. 恢复包选择

     sudo apt-mark auto $(cat ~/.apt-backup/pkg_auto.list) sudo apt-mark manual $(cat ~/.apt-backup/pkg_manual.list) 

我是BIT Dev-Team的成员

您可以备份整个系统,但恢复更复杂,也需要永久! 如果我是你,我会备份/home/并在需要时重新安装应用程序。 备份/home/您还备份应用程序首选项,这样您就不会丢失设置。