Linux系统之备份数据

来源:互联网 发布:wifi网络电话机 编辑:程序博客网 时间:2024/05/13 06:51

System Backup and Recovery

Rsync

Rsync is the directory backup and transfer tool for Linux. It is installed by default in Ubuntu. It can provide any type of backup, and options are extensive. Several GUI frontends for Rsync are listed here.

GRsync

GRsync is a GTK-based GUI front-end for Rsync. Install:

sudo apt-get install grsync

Bacula

Bacula is the most widely-used GTK-based open source (GPL-licensed) network backup utility that is used in both server and desktop installations. A catalogue of backups can be maintained using MySQL, PostgreSQL, or SQLite. For more info see the Ubuntu documentation. Both text-based and GUI frontends are available. Install the MySQL version:

sudo apt-get install bacula

SBackup

SBackup is a simple backup and restore utility for the GTK-desktop. Install:

sudo apt-get install sbackup

Keep (Backup and Recovery)

Keep is a QT/KDE based backup utility used in previous versions of Ubuntu. It is no longer maintained and is not included in Ubuntu by default. Install:

sudo apt-get install keep

Run:

  • Menu -> Applications -> System Tools -> Keep (Backup System)
  • Backup:
Click "Add a Directory to Backup"
Select directories you wish to backup
Select a location to place the backup
Set how often you wish the backups to take place, and how long to keep them
Click "Backup Now"
Select the directory groups you wish to backup.
  • Recover:
Click "Restore a Backup"
Select the directory groups you wish to restore.

Partimage (Partition backup)

Partimage is a free open-source utility to back up an entire partition into an .iso image. It can be used across a network, as well. Install and run:

sudo apt-get install partimagesudo partimage

Partimage cannot be used from within the partition you wish to backup. You will either have to run it from a different partition or from a LiveCD that contains it. (A serious limitation of Partimage is its inability to backup/restore split image files to/from multiple media (e.g. spanned DVDs/CDs), limiting its usefulness as an inexpensive cloning and distribution solution. Partition image backup/restoration must be to/from a single hard drive, large capacity USB stick, or networked storage space.)

cp

An entire partition's filesystem can easily be copied to another partition using the cp -a command. (However, this cannot be done for the partition of a filesystem that is running. Use the (K)Ubuntu LiveCD to copy partitions when necessary.) Obviously the destination partition should be as large or larger than the source partition, and while not necessary, probably is best if both partitions are of the same filesystem type (e.g. ext4). Use GParted to create or manipulate the destination partition, if necessary. To copy the entire filesystem, for example, from the ext4 partition /dev/sda6 into the ext4 partition at/dev/sda7, mount both partitions:

sudo mkdir /media/partsda6sudo mkdir /media/partsda7sudo mount /dev/sda6 -t ext4 /media/partsda6sudo mount /dev/sda7 -t ext4 /media/partsda7

Then merely copy the contents from one partition to the other:

sudo cp -a /media/partsda6/* /media/partsda7
  • Of course, once the partition's filesystem is copied, a bootmanager (Grub2 or Grub Legacy) will have to be updated/reconfigured to recognize the new partition's OS in order to enable it to boot. Also, the /etc/fstab file of the new partition's filesystem may need to be edited (in regards to the UUIDs of the various partitions), to prevent conflicts. To determine the UUIDs of all current partitions on a hard drive:
sudo blkid

Edit fstab so that the UUIDs are correctly reflected there.

  • To confirm that the file copy has completed, the Linux command du (also see these tips) can be used to calculate the disk usage for both the source and destination folders in order to compare the values (to ensure that they are the same). For example, the values should be the same for both partitions after copying has completed:
sudo du /media/partsda6sudo du /media/partsda7

dd

dd is a *nix command that enables the copying of files or an entire disk using a single command. Parameters must be precisely specified to avoid risk of accidentally erasing data. See these brief instructions or these instructions for detailed options. You cannot copy a hard drive that contains the operating system you are currently running. Instead, boot into a LiveCD and run the dd command that way. An example command to copy Hard drive X to Hard drive Y is:

dd if=/dev/hdx of=/dev/hdy
  • ddrescue is a variation of the dd command that allows working with potentially corrupted datasets, partitions, or hard drives.

FSArchiver (Filesystem Archiver)

FSArchiver is a utility to backup the filesystem by files (instead of by partition blocks). A filesystem backed up in this way can be moved to a different sized partition or another disk filesystem altogether (e.g. from ext3 to ext4). Backups can be split and stored on (and restored from) spanned media (e.g. multiple DVDs/CDs). It is included in the System Rescue CD. Install:

sudo apt-get install fsarchiver

System Rescue and Cloning Utilities

System Rescue CD

SystemRescueCD is a LiveCD that includes important utilities such as GParted, Partimage, ddrescue, Rsync, andFSArchiver. Several of these utilities cannot be used from within a running partition, so using them from a LiveCD is often necessary. Download and burn the LiveCD from the website.

Clonezilla

Clonezilla allows the backup or duplication of a partition for a single machine or for multiple machines over a network. (It is similar to Norton Ghost.) It includes Partimage, partclone, and other utilities. It is available as a LiveCD which can then be burned. (A serious limitation of Clonezilla is its inability to backup/restore split image files to/from multiple media (e.g. spanned DVDs/CDs), limiting its usefulness as an inexpensive cloning and distribution solution. Partition image backup/restoration must be to/from a single hard drive, large capacity USB stick, or networked storage space.)

Disk Imaging software

  • G4U is a utility to image a disk bit by bit.
  • G4L is a utility to image a disk bit by bit. It includes a GUI interface.

Ubuntu Customization Kit

  • Ubuntu Customization Kit is a utility to customize a (K)Ubuntu LiveCD. Install:
sudo apt-get install uck

Remastering software

Debian and (K)Ubuntu Linux operating systems can be "remastered" and customized (using one of a number of utilities) for re-distribution. (See this Wikipedia list.) This enables an organization to pre-load desired applications and customizations for distribution among its members, while preserving the intrinsic architecture and function of (K)Ubuntu. The customized (K)Ubuntu OS can then be distributed on a CD or on a USB flashdrive. Users are then free to further customize the OS, or even to revert back to the original default (K)Ubuntu settings. Also see the Ubuntu wiki.

  • oem-config-gtk
sudo apt-get install oem-config-gtk
  • Remastersys for Ubuntu. For tips, see this page.
  • Reconstructor. The open source engine can be downloaded and installed as a .deb package.

Run (K)Ubuntu LiveCD from a USB pendrive

The (K)Ubuntu LiveCD can be installed on and run from a USB pendrive. Settings can be "persistently" saved (but the LiveCD kernel modules can not be upgraded). Programs can be installed and run, however, and files saved to the USB drive. (The installed programs will remain installed). A (K)Ubuntu Live CD is needed to do the installation. For additional info, see the Ubuntu Official documentation, the Ubuntu Community documentation or the Pendrivelinux instructions.

The USB "LiveCD" can be used to install (K)Ubuntu on computers (including netbooks) that do not have CD-ROM/DVD drives. See these instructions to boot from a USB flashdrive.

USB pendrives to be used to run (K)Ubuntu should have a minimum of 2 Gb (preferably 4 Gb). If you wish to install a fast, fully functional Linux system on a pendrive that has less memory than that, use PuppyLinux or Lubuntu.

USB Creator

You can make a "LiveCD" on a USB pendrive using USB Creator and either a LiveCD or an .iso version of the LiveCD stored on your hard drive. USB Creator is installed by default in (K)Ubuntu. If not, install:

sudo apt-get install usb-creator-gtk
  • Run:
Menu -> System -> Startup Disk Creator

Create a boot CD to allow booting from the USB drive

Many computers do not allow booting from a USB drive (but they do allow booting from the CD-ROM). You can create a CD-ROM using these Pendrivelinux instructions and set your BIOS to boot from this CD-ROM. When you boot from this CD-ROM, it will use the bootup files on the (K)Ubuntu USB drive you previously created (in the step above).


原文链接:http://ubuntuguide.org/wiki/Ubuntu_Trusty_System_Backup


0 0
原创粉丝点击