个人工具

UbuntuHelp:Backupsolutionsforlinux

来自Ubuntu中文

跳转至: 导航, 搜索

<<Include(Tag/Deletion)>> Page is entirely without use, all useful information is covered in rsync or BackupYourSystem. Information has been copied over if useful, and ignored when not. 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 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 -i
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. 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

Duplicity

DuplicityBackupHowto

BackupPC

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 transferring to a remote machine is:

sudo rsync --delete -azvv -e ssh /home remoteuser@remotehost.remotedomain:./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 graphical frontends: grsync, Backup Monitor, QSync, Zynk, rsyncbackup, TKsync

AFBackup-Manager

DuplicityBackupHowto

afio

AMANDA

Advanced Maryland Automatic Network Disk Archiver Howto

Arkeia

Enterprise-class network backup for Linux and Unix networks Howto

backupd

Small client/server backup solution for mixed networks Howto

Bacula

Bacula - a free client/server backup solution for Linux, Unix and Windows Howto

BAR

Backup and Restore for Mainframe Linux, Solaris, Intel and AIX Howto

BRU

A backup solution for Linux and UNIX Howto

BRU-Pro

Professional level network backup program Howto

Burt

Burt - Backup and Recovery Tool Howto

cdbackup

cd-r(w) backup utility Howto

cddump

A CD-R and CD-RW backup utility similar to dump/ufsdump Howto

CDTARchive or CDTAR

Graphical Backup program for linux Howto

confstore

confstore is a configuration backup and restoration utility Howto

Crash Recovery Kit for Linux

A crash recovery kit for Linux Howto

DAR - Disk ARchive

full and differential Backup over several disks, compression, and other features

Datbkr

Tar based tape backup program with remote SSH support Howto

dobackup.pl

Flexible Perl multi-server backup system Howto

Dump/Restore

Utilities to dump and restore an ext2 partition Howto

easy-Backup

Easy backup tool Howto

EVault

EVault provides WAN backup and restore over IP Howto

FileBackup

FileBackup is an easy-to-use GNOME-based backup and restore utility Howto

glastree

A poor man's snapshot, builds live, per-diem backups that users can browse directly Howto

Hosting Backup

Hosting Backup is a set if PHP command line scripts that provides an easy way to backup hosted Web Howto

KDar --- the KDE Disk archiver

Disk-based archiving and backup GUI for KDE based on libdar Howto

KDat

Tar based tape archiver Howto

mbackup

A modular backup client/server Howto

Mondo Rescue

Baremetal backup/recovery for tape, CD, NFS Howto Generates bootable rescue CD ISOs

NovaNET 8.5

Tape backup for single server. Upgrade to network, plus stacker available Howto

Oracle Backup

OracleBackup is an easy-to-use backup and restore utility for Oracle databases Howto

reverse

Simplified CD backup for Linux Howto

scdbackup

Burt - Backup and Recovery Tool Howto

SimpleBackup

A simple, flexible and very portable directory backup program Howto

Sitback

Entry level backup Howto

star

The fastest known implementation of a tar archiver Howto

Storix Backup Administrator for Linux

Full featured Linux backup product with complete and flexible system recovery Howto

UNiBACK for Linux

Fast, easy, reliable network backup solution for UNIX & Linux Howto

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. The Arch Linux wiki has additional backup resources Reliable Linux backups: How to backup Linux, BSD and other Unix-like systems properly is an excellent article that compares the pros and cons of many of common command line backup programs 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?