特殊:Badtitle/NS100:BackupYourSystem
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/BackupYourSystem }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/af | • {{#if: UbuntuHelp:BackupYourSystem|Afrikaans| [[::BackupYourSystem/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/ar | • {{#if: UbuntuHelp:BackupYourSystem|العربية| [[::BackupYourSystem/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/az | • {{#if: UbuntuHelp:BackupYourSystem|azərbaycanca| [[::BackupYourSystem/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/bcc | • {{#if: UbuntuHelp:BackupYourSystem|جهلسری بلوچی| [[::BackupYourSystem/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/bg | • {{#if: UbuntuHelp:BackupYourSystem|български| [[::BackupYourSystem/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/br | • {{#if: UbuntuHelp:BackupYourSystem|brezhoneg| [[::BackupYourSystem/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/ca | • {{#if: UbuntuHelp:BackupYourSystem|català| [[::BackupYourSystem/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/cs | • {{#if: UbuntuHelp:BackupYourSystem|čeština| [[::BackupYourSystem/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/de | • {{#if: UbuntuHelp:BackupYourSystem|Deutsch| [[::BackupYourSystem/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/el | • {{#if: UbuntuHelp:BackupYourSystem|Ελληνικά| [[::BackupYourSystem/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/es | • {{#if: UbuntuHelp:BackupYourSystem|español| [[::BackupYourSystem/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/fa | • {{#if: UbuntuHelp:BackupYourSystem|فارسی| [[::BackupYourSystem/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/fi | • {{#if: UbuntuHelp:BackupYourSystem|suomi| [[::BackupYourSystem/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/fr | • {{#if: UbuntuHelp:BackupYourSystem|français| [[::BackupYourSystem/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/gu | • {{#if: UbuntuHelp:BackupYourSystem|ગુજરાતી| [[::BackupYourSystem/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/he | • {{#if: UbuntuHelp:BackupYourSystem|עברית| [[::BackupYourSystem/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/hu | • {{#if: UbuntuHelp:BackupYourSystem|magyar| [[::BackupYourSystem/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/id | • {{#if: UbuntuHelp:BackupYourSystem|Bahasa Indonesia| [[::BackupYourSystem/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/it | • {{#if: UbuntuHelp:BackupYourSystem|italiano| [[::BackupYourSystem/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/ja | • {{#if: UbuntuHelp:BackupYourSystem|日本語| [[::BackupYourSystem/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/ko | • {{#if: UbuntuHelp:BackupYourSystem|한국어| [[::BackupYourSystem/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/ksh | • {{#if: UbuntuHelp:BackupYourSystem|Ripoarisch| [[::BackupYourSystem/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/mr | • {{#if: UbuntuHelp:BackupYourSystem|मराठी| [[::BackupYourSystem/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/ms | • {{#if: UbuntuHelp:BackupYourSystem|Bahasa Melayu| [[::BackupYourSystem/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/nl | • {{#if: UbuntuHelp:BackupYourSystem|Nederlands| [[::BackupYourSystem/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/no | • {{#if: UbuntuHelp:BackupYourSystem|norsk| [[::BackupYourSystem/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/oc | • {{#if: UbuntuHelp:BackupYourSystem|occitan| [[::BackupYourSystem/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/pl | • {{#if: UbuntuHelp:BackupYourSystem|polski| [[::BackupYourSystem/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/pt | • {{#if: UbuntuHelp:BackupYourSystem|português| [[::BackupYourSystem/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/ro | • {{#if: UbuntuHelp:BackupYourSystem|română| [[::BackupYourSystem/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/ru | • {{#if: UbuntuHelp:BackupYourSystem|русский| [[::BackupYourSystem/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/si | • {{#if: UbuntuHelp:BackupYourSystem|සිංහල| [[::BackupYourSystem/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/sq | • {{#if: UbuntuHelp:BackupYourSystem|shqip| [[::BackupYourSystem/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/sr | • {{#if: UbuntuHelp:BackupYourSystem|српски / srpski| [[::BackupYourSystem/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/sv | • {{#if: UbuntuHelp:BackupYourSystem|svenska| [[::BackupYourSystem/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/th | • {{#if: UbuntuHelp:BackupYourSystem|ไทย| [[::BackupYourSystem/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/tr | • {{#if: UbuntuHelp:BackupYourSystem|Türkçe| [[::BackupYourSystem/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/vi | • {{#if: UbuntuHelp:BackupYourSystem|Tiếng Việt| [[::BackupYourSystem/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/yue | • {{#if: UbuntuHelp:BackupYourSystem|粵語| [[::BackupYourSystem/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/zh | • {{#if: UbuntuHelp:BackupYourSystem|中文| [[::BackupYourSystem/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/zh-hans | • {{#if: UbuntuHelp:BackupYourSystem|中文(简体)| [[::BackupYourSystem/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BackupYourSystem | UbuntuHelp:BackupYourSystem | {{#if: | :}}BackupYourSystem}}/zh-hant | • {{#if: UbuntuHelp:BackupYourSystem|中文(繁體)| [[::BackupYourSystem/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:BackupYourSystem|:BackupYourSystem|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :BackupYourSystem/zh | | {{#ifexist: BackupYourSystem/zh | | {{#ifeq: {{#titleparts:BackupYourSystem|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:BackupYourSystem|1|-1|}} | zh | | }}
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 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 removeable 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
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. Mounting disks with Linux's loopback device 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
UbuntuHomeBackup
Ubuntu/UbuntuHomeBackup
duplicity
BackupPC
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 transfering 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
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:
- 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://ubuntuforums.org/showthread.php?t=295
"Backup and Restore Your Ubuntu System using Sbackup" has nice step-by-step instructions (with screenshots) of using sbackup. Systems like Subversion and Wayback and CopyFS 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?