个人工具

UbuntuHelp:BackupYourSystem

来自Ubuntu中文

Oneleaf讨论 | 贡献2007年5月24日 (四) 09:04的版本 (新页面: {{From|https://help.ubuntu.com/community/BackupYourSystem}} {{Languages|UbuntuHelp:BackupYourSystem}} Backing up your system is an important thing for everyone to do. You never know when ...)

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航, 搜索


Backing up your system is an important thing for everyone to do. You never know when your hard drive will die, or some other disaster strikes. You don't want to lose all of your bookmarks, pictures from vacations, documents, school papers, music, and more just because you did not make a recent backup. It can be as simple as backing up the most important things on your computer to a CD or DVD, or using one of the methods here for backing up your entire /home directory, or maybe your whole computer. There are several methods listed here for you to choose from.


Using the TAR command

This requires using the command line (aka the terminal) It makes a backup of your root or whatever directory you want to backup into a nice TAR file. You can backup to remote directories, different hard drives, to a CD or DVD (if the finished tar file is over 2gb, you will have to use the "split" command and use multiple cd's or dvd's.

To get a nice tutorial on how to backup using the TAR command, visit this page: UbuntuHelp:BackupYourSystem/TAR


Using Simple Backup Suite (easiest, GUI)

Simple Backup Suite is a program that was created during the Google Summer of Code 2005. It is program with a GNOME interface (if you use KDE or some other work manager, you might need to install some stuff in order to run Simple Backup Suite). You can specify how often it backs up (or not automatically at all), the destination (including remote locations), what file types / directories to exclude and what directories you want it to back up. Simple Backup Suite also makes incremental backups, so once you do a full backup, all backups after that are simply what has changed between the last full backup and your increment. You can also configure the rules that old backups get deleted.

To view on how to set up, configure and backup using Simple Backup Suite, please visit this page here: BackupYourSystem/SimpleBackupSuite


GRUB restore

Now, if you want to move your system to a new harddisk or if you did something nasty to your GRUB (like, say, install Windows), You'll also need to reinstall GRUB. There are several very good howto's on how to do that here on this forum, so i'm not going to reinvent the wheel. Instead, take a look here (forum) or here: RecoveringUbuntuAfterInstallingWindows

On the forum thread, there are a couple of methods proposed. I personally recommend the second one, posted by remmelt, since that has always worked for me.

Other Methods

dd

If you want to back up an entire partition, or an entire hard drive (including the MBR), no matter what operating system is installed on it, "dd" is the way to go.

( http://packages.ubuntu.com/edgy/admin/partimage may be an easier way to back up entire partitions, but it apparently (?) can't back up the MBR, and there are a few obscure operating systems it doesn't fully support ).

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 also pipe through gzip or bzip2 to compress the images.

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

For example, on my system, to back up the entire "hda" drive of some random computer running some random operating system, I reboot with Ubuntu LiveCD, then do

sudo dd if=/dev/hda | gzip -c | ssh -v -c blowfish [email protected] "dd of=backup_latitude_2007-02-28.gz"

then type in my password on the remote system (to the "davidcary" account on the Ubuntu file server at 192.168.128.80 -- your system will likely be different). The transfer rate seemed to be limited by my (1 GHz) laptop CPU, since the transfer rate never went above 3 MiB/s on my 100 Mbps Ethernet; the total transfer time was about an hour and a half, creating a file almost 9 GB. -- DavidCary

(fixme: summarize the information in the following links: )

More details on using dd for backup and restore:

More details on backing up the MBR:

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

UbuntuHomeBackup

UbuntuHomeBackup

duplicity

DuplicityBackupHowto

BackupPC

UbuntuHelp:BackupPC

other options

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 UbuntuHelp: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).

ContinuousBackups and HomeUserBackup and MigrateAndBackup have some interesting ideas about making backups completely automated. BackupOfPackageUserData and UbuntuDownUnder/BOFs/SimpleBackupSolution also still needs help.

What exactly does SessionBackup do?