个人工具

“UbuntuHelp:BackupYourSystem”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/BackupYourSystem}}
 
{{From|https://help.ubuntu.com/community/BackupYourSystem}}
 
{{Languages|UbuntuHelp:BackupYourSystem}}
 
{{Languages|UbuntuHelp:BackupYourSystem}}
 +
<<Include(Tag/NeedsExpansion)>>
 
Backing up your system important, since you never know when your hard drive will die or some other disaster will strike. Several backup methods are listed below.
 
Backing up your system important, since you never know when your hard drive will die or some other disaster will strike. Several backup methods are listed below.
 
== Archival backup ==
 
== Archival backup ==
 +
=== From the Desktop ===
 +
If you go to Applications > Add/Remove, and search for 'backup' there are multiple items available.
 +
==== Using Simple Backup Suite ====
 +
Simple Backup Suite is a program that was created during the Google Summer of Code 2005. Using a familiar GNOME interface, you can specify how often it backs up, the destination, what to exclude and what to back up.
 +
Simple Backup Suite also makes incremental backups, after creating the initial backup, only the files that have changed are backed up.
 +
For more information see: BackupYourSystem/SimpleBackupSuite
 +
==== Duplicity ====
 +
[[UbuntuHelp:DuplicityBackupHowto|DuplicityBackupHowto]]
 +
==== [[UbuntuHelp:BackupPC|BackupPC]] ====
 +
[[BackupPC]]
 
=== From the command line ===
 
=== From the command line ===
 
==== Using the TAR command ====
 
==== Using the TAR command ====
第10行: 第21行:
 
</nowiki></pre>
 
</nowiki></pre>
 
The compressed image created can be broken into smaller chunks for copying to removable media using the split command.
 
The compressed image created can be broken into smaller chunks for copying to removable media using the split command.
More information can be found here: [[UbuntuHelp:BackupYourSystem/TAR|BackupYourSystem/TAR]]
+
More information can be found here: [[BackupYourSystem/TAR]]
 
==== Creating disc images using dd ====
 
==== Creating disc images using dd ====
 
Suitable for backing up entire disks. Open a terminal (in the examples you will need to replace hda with the partition you wish to backup).
 
Suitable for backing up entire disks. Open a terminal (in the examples you will need to replace hda with the partition you wish to backup).
第59行: 第70行:
 
Update your drive mappings to the new devices there. Grub may be setup with numberish IDs for your drives, then you need the command ''blkid'' to read the new identifiers of your disk.
 
Update your drive mappings to the new devices there. Grub may be setup with numberish IDs for your drives, then you need the command ''blkid'' to read the new identifiers of your disk.
 
After your system is able to boot and runs again, you can resize your partitions to fill the rest of the new harddisk (if you want that) as described here:
 
After your system is able to boot and runs again, you can resize your partitions to fill the rest of the new harddisk (if you want that) as described here:
* [http://www.howtoforge.com/linux_resizing_ext3_partitions_p2 Enlarging An ext3 Partition]
+
* [[http://www.howtoforge.com/linux_resizing_ext3_partitions_p2|Enlarging An ext3 Partition]]
 
You can use the "loopback device" to mount this partition image, making it easy to read the old version of files and still keep your current version untouched.
 
You can use the "loopback device" to mount this partition image, making it easy to read the old version of files and still keep your current version untouched.
[http://www.trekweb.com/~jasonb/articles/linux_loopback.shtml Mounting disks with Linux's loopback device]
+
[[http://www.trekweb.com/~jasonb/articles/linux_loopback.shtml|Mounting disks with Linux's loopback device]]
 
by Jason Boxman
 
by Jason Boxman
== From the Desktop ==
 
=== Using Simple Backup Suite ===
 
Simple Backup Suite is a program that was created during the Google Summer of Code 2005. Using a familiar GNOME interface, you can specify how often it backs up, the destination, what to exclude and what to back up.
 
Simple Backup Suite also makes incremental backups, after creating the initial backup, only the files that have changed are backed up.
 
For more information see: BackupYourSystem/SimpleBackupSuite
 
=== Duplicity ===
 
[[UbuntuHelp:DuplicityBackupHowto|DuplicityBackupHowto]]
 
=== [[UbuntuHelp:BackupPC|BackupPC]] ===
 
[[UbuntuHelp:BackupPC|BackupPC]]
 
 
== Incremental Backup ==
 
== Incremental Backup ==
 
=== rsync ===
 
=== rsync ===
第84行: 第86行:
 
<code><nowiki>-a</nowiki></code> preserves the date and times of the files (same as <code><nowiki>-t</nowiki></code>), descends recursively into all directories (same as <code><nowiki>-r</nowiki></code>), copies symlinks as symlinks (same as <code><nowiki>-l</nowiki></code>), preserves file permissions (same as <code><nowiki>-p</nowiki></code>), preserves groups (same as <code><nowiki>-g</nowiki></code>), preserves file ownership (same as <code><nowiki>-o</nowiki></code>), and preserves devices as devices (same as <code><nowiki>-D</nowiki></code>).
 
<code><nowiki>-a</nowiki></code> preserves the date and times of the files (same as <code><nowiki>-t</nowiki></code>), descends recursively into all directories (same as <code><nowiki>-r</nowiki></code>), copies symlinks as symlinks (same as <code><nowiki>-l</nowiki></code>), preserves file permissions (same as <code><nowiki>-p</nowiki></code>), preserves groups (same as <code><nowiki>-g</nowiki></code>), preserves file ownership (same as <code><nowiki>-o</nowiki></code>), and preserves devices as devices (same as <code><nowiki>-D</nowiki></code>).
 
<code><nowiki>-vv</nowiki></code> increases the verbosity of the reporting process
 
<code><nowiki>-vv</nowiki></code> increases the verbosity of the reporting process
rsync has several [http://www.debianadmin.com/rsync-backup-web-interfacefrontend-or-gui-tools.html graphical frontends: grsync, Backup Monitor, QSync, Zynk, rsyncbackup, TKsync]
+
rsync has several [[http://www.debianadmin.com/rsync-backup-web-interfacefrontend-or-gui-tools.html|graphical frontends: grsync, Backup Monitor, QSync, Zynk, rsyncbackup, TKsync]]
 +
For more options, there is a separate page about [[rsync]]
 
== See also ==
 
== See also ==
 
You might also want to check out these backup programs which will help you to make automated backups of your system:
 
You might also want to check out these backup programs which will help you to make automated backups of your system:
* [http://amanda.zmanda.com/ Amanda].
+
* [[http://amanda.zmanda.com/|Amanda]].
* [http://www.partimage.org/ Partimage].
+
* [[http://www.partimage.org/|Partimage]].
* [http://www.mondorescue.org/ Mondo Rescue].
+
* [[http://www.mondorescue.org/|Mondo Rescue]].
* [http://www.rsnapshot.org/ rsnapshot].
+
* [[http://www.rsnapshot.org/|rsnapshot]].
* [http://www.bacula.org/ Bacula].
+
* [[http://www.bacula.org/|Bacula]].
* [http://en.wikipedia.org/wiki/Nice_(Unix) nice].
+
* [[http://en.wikipedia.org/wiki/Nice_(Unix)|nice]].
 
Other wiki discussing various Linux backup techniques:
 
Other wiki discussing various Linux backup techniques:
* [http://www.nslu2-linux.org/wiki/HowTo/BackupYourLinuxBox NSLU2: back up your Linux box]
+
* [[http://www.nslu2-linux.org/wiki/HowTo/BackupYourLinuxBox|NSLU2: back up your Linux box]]
 
See the full discussion in these threads on the Ubuntu forums:
 
See the full discussion in these threads on the Ubuntu forums:
 
* http://www.ubuntuforums.org/showthread.php?t=70566
 
* http://www.ubuntuforums.org/showthread.php?t=70566
 
* http://www.ubuntuforums.org/showthread.php?t=35087  Howto: Backup and restore your system! (very long thread; but all the good bits have (hopefully) already been summarized on this page.)
 
* http://www.ubuntuforums.org/showthread.php?t=35087  Howto: Backup and restore your system! (very long thread; but all the good bits have (hopefully) already been summarized on this page.)
 
* http://ubuntuforums.org/showthread.php?t=295
 
* http://ubuntuforums.org/showthread.php?t=295
[http://www.debianadmin.com/backup-and-restore-your-ubuntu-system-using-sbackup.html "Backup and Restore Your Ubuntu System using Sbackup"] has nice step-by-step instructions (with screenshots) of using sbackup.
+
[[http://www.debianadmin.com/backup-and-restore-your-ubuntu-system-using-sbackup.html|"Backup and Restore Your Ubuntu System using Sbackup"]] has nice step-by-step instructions (with screenshots) of using sbackup.
Systems like [[UbuntuHelp:Subversion|Subversion]] and
+
Systems like [[Subversion]] and
[http://wayback.sourceforge.net/ Wayback] and [http://n0x.org/copyfs/ CopyFS]
+
[[http://wayback.sourceforge.net/|Wayback]] and [[http://n0x.org/copyfs/|CopyFS]]
 
are useful when you want to see how things were a week ago -- they let you see *every* change to a file.
 
are useful when you want to see how things were a week ago -- they let you see *every* change to a file.
 
(But they don't help when the hard drive fails, so they are complementary to these other forms of backup that only store occasional snapshots, but also survive hardware failures).
 
(But they don't help when the hard drive fails, so they are complementary to these other forms of backup that only store occasional snapshots, but also survive hardware failures).
第108行: 第111行:
 
What exactly does Ubuntu:SessionBackup do?
 
What exactly does Ubuntu:SessionBackup do?
 
----
 
----
[[category:CategoryDocumentation]]  [[category:CategoryNeedsExpansion]] [[category:CategoryBackupRecovery]]
+
[[category:CategoryBackupRecovery]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2008年10月19日 (日) 04:19的版本


<<Include(Tag/NeedsExpansion)>> Backing up your system important, since you never know when your hard drive will die or some other disaster will strike. Several backup methods are listed below.

Archival backup

From the Desktop

If you go to Applications > Add/Remove, and search for 'backup' there are multiple items available.

Using Simple Backup Suite

Simple Backup Suite is a program that was created during the Google Summer of Code 2005. Using a familiar GNOME interface, you can specify how often it backs up, the destination, what to exclude and what to back up. Simple Backup Suite also makes incremental backups, after creating the initial backup, only the files that have changed are backed up. For more information see: BackupYourSystem/SimpleBackupSuite

Duplicity

DuplicityBackupHowto

BackupPC

BackupPC

From the command line

Using the TAR command

Suitable for backing up your home directory. Open a terminal and enter the command:

tar cvfz output input

The compressed image created can be broken into smaller chunks for copying to removable media using the split command. More information can be found here: BackupYourSystem/TAR

Creating disc images using dd

Suitable for backing up entire disks. Open a terminal (in the examples you will need to replace hda with the partition you wish to backup). Create a hard disk image:

dd if=/dev/hda1 of=/home/hda1.bin

Create a compressed disk image

dd if=/dev/hda1 | gzip > /home/hda1.bin.gz

Back up the MBR

dd if=/dev/hda of=/home/hda.boot.mbr bs=512 count=1

Restore MBR (from a Live CD)

dd if=/mnt/hda1/home/hda.boot.mbr of=/dev/hda bs=512 count=1

Backup a drive to another drive

dd if=/dev/hda of=/dev/hdb conv=noerror,sync bs=4k

The command:

dd -if /dev/hda1 > partitionimage.dd

will backup "/dev/hda1", the first partition on hda1. A whole drive (including the MBR) could be backed up using just /dev/hda as the input "file". Restoring is done by:

dd -if partitionimage.dd -of /dev/hda1

If you have a complete new harddrive and want to restore the backup (or copy your old system to the new drive). First, the new drive has to be bigger or exactly the same size as the old one. First go superuser and switch to runlevel 1 so that you can fumble around with the harddisk without other services interfering:

sudo su
init 1

restore either the whole disk to the new drive or one partition (depending on how you made the backup):

dd -if partitionimage.dd -of /dev/hda1

If you restored the whole drive (/dev/hda), the system will not automatically create the devices (/dev/hda1, /dev/hda2) if you just restored the whole drive. If you know how to make the devices show up without reboot, write it here, otherwise this is a good moment to reboot. If you restored the system to a new drive, and your device names changed (for example from /dev/hda to /dev/sda) then you must adapt the bootloader and the mount points. While still on runlevel 1, edit these files:

/boot/grub/menu.list
/etc/fstab

Update your drive mappings to the new devices there. Grub may be setup with numberish IDs for your drives, then you need the command blkid to read the new identifiers of your disk. After your system is able to boot and runs again, you can resize your partitions to fill the rest of the new harddisk (if you want that) as described here:

You can use the "loopback device" to mount this partition image, making it easy to read the old version of files and still keep your current version untouched. [disks with Linux's loopback device] by Jason Boxman

Incremental Backup

rsync

Rsync updates the copies the files that have changed and even then only transfers the parts of those files that have changed. That is useful for saving bandwidth when backing up over the network. For safety, transfer between two machines is done via SSH. Rsync is especially good for backing up home directories. The command for transferring to a remote machine is:

sudo rsync --delete -azvv -e ssh /home [email protected]:./backupdirectory

-z compresses the data --delete deletes files that don't exist on the system being backed up. Maybe you want this, maybe not. -a preserves the date and times of the files (same as -t), descends recursively into all directories (same as -r), copies symlinks as symlinks (same as -l), preserves file permissions (same as -p), preserves groups (same as -g), preserves file ownership (same as -o), and preserves devices as devices (same as -D). -vv increases the verbosity of the reporting process rsync has several [frontends: grsync, Backup Monitor, QSync, Zynk, rsyncbackup, TKsync] For more options, there is a separate page about rsync

See also

You might also want to check out these backup programs which will help you to make automated backups of your system:

Other wiki discussing various Linux backup techniques:

See the full discussion in these threads on the Ubuntu forums:

["Backup and Restore Your Ubuntu System using Sbackup"] has nice step-by-step instructions (with screenshots) of using sbackup. Systems like Subversion and [[6]] and [[7]] are useful when you want to see how things were a week ago -- they let you see *every* change to a file. (But they don't help when the hard drive fails, so they are complementary to these other forms of backup that only store occasional snapshots, but also survive hardware failures). Ubuntu:ContinuousBackups and Ubuntu:HomeUserBackup and Ubuntu:MigrateAndBackup have some interesting ideas about making backups completely automated. Ubuntu:BackupOfPackageUserData and Ubuntu:UbuntuDownUnder/BOFs/SimpleBackupSolution also still needs help. What exactly does Ubuntu:SessionBackup do?