Back up your linux system with partimage

Source: Internet
Author: User
Use partimage to back up your linux system-general Linux technology-Linux technology and application information. For more information, see the following section. Partimage is a tool used in Linux/UNIX to save various partitions into image files in different formats. The generated image file can be compressed in GZIP/BZIP2 format to save disk space. At the same time, the tool also supports splitting images into multiple small blocks to facilitate the copying of removable storage (such as ZIP ). Since version 0.6.0, partimage has been added with support for saving partitions through the network. The following is a guide to the use of this software.

Of course, when using the software, the partitions to be prepared must be unmounted first ). (If You Want To unmount a partition directly, you must enter the single-user mode, because you cannot set the partition to be processed (such as home) any file in is open. How to access it? Use init1. For details, please google or leave a message)

Partimage will play a good role in the following situations: first, when a partition has problems such as virus infection and file system errors, you can easily restore the partition data, it only takes about 10 minutes to make the problem free. A shard in the original state will appear in front of you. If you are afraid that the image will take up disk space, you can burn the image into a CD-R tray. In addition, it also plays a major role in installing systems for many computers with the same configurations. For example, if you have purchased 50 computers with the same configuration and want to install linux on these 50 computers, partimage will save you a lot of time. You can first install the system on a computer, create an image for it, restore the system on 49 other machines through the restore function of partimage.

Partimage supports the following file systems: ext2fs/ext3fs, Reiser3, FAT16/32, NTFS, HPFS, JFS, XFS, UFS (beta), HFS (beta ).

Okay. Next we will introduce the usage of this software:

First, install partimage in the system. For ubuntu users, the command is

Sudo apt-get install partimage

For debian users, the installation command is

# Apt-get install partimage

Before starting the program, check the following partitions that can be operated:

Sudo fdisk-l (for ubuntu) or # fdisk-l (for debian)

Then start the partimage program:

Sudo partimage (for ubuntu) or # partimage (for debian)

Once the program is opened, you will see an interface similar to this:



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.debianadmin.com/images/part/6.png'); ">

Press the up or down arrow to select the partition you want to back up.

Then, enter the path and name of the Image file you want to store in "Image file to create/use. In this example, Because I mounted the backup partition to the backup directory, my path name must be/backup/serverbackup, instead of simple serverbackup (simple backup will put the file in/partition, and if you want to back up the/partition ...... haha ). The next step is to save the partition to the new backup image.

On the next screen, if you want a faster backup speed, you can choose a non-compressed backup. The space is tight only when your external storage or the partition used to store the backup files, you can use the Gzip or Bzip2 option to compress the backup file only when the partition content you have backed up cannot be accommodated.



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.debianadmin.com/images/part/7.png'); ">

Well, at this time, please note that only the content used in the partition will be backed up. For example, if your partition is 100 GB but only 10 GB is used, the backup image file will only be 10 GB.

Next, press F5 to go to the next screen. Here, you need to enter a description to save the partition, that is, a name:



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.debianadmin.com/images/part/8.png'); ">

Partimage takes a short time to check partition data and generate a summary report on the general situation. After reading it, press Enter:



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.debianadmin.com/images/part/9.png'); ">

Now, the software will start to back up the partition to the image file you set. You can see the backup progress from the screen below:



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.debianadmin.com/images/part/10.png'); ">

When you see the following figure, the backup is complete:



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.debianadmin.com/images/part/11.png'); ">

Now, you can return to the terminal.

Well, after reading how to back up partitions, let's take a look at how to restore a partition. First, start partimage in the same way as above, and then you will see the following screen.



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.debianadmin.com/images/part/12.png'); ">

Here, you need to select the recovered partition and restore the image file. In this example, my backup file is serverbackup.000. Generally, If you specify the suffix img, the backup file will be suffixed with img. Otherwise, it is suffixed with 000 by default. Next, select the "restore partition from an image file" option and go to the next screen:



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.debianadmin.com/images/part/13.png'); ">

Simply press Enter. Then you will see the following screen:



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.debianadmin.com/images/part/14.png'); ">

The option you need to note is "Erase free blocks with zero values". If this option is selected, all unused spaces are filled with 0, that is, the data before this partition will no longer exist (a bit like the "fill in" option in the hard disk Repair Tool ). If this option is not selected, the original data still exists in the unrecovered area, and you can also access it (it may encounter some difficulties, because the accessibility is only theoretical. However, the dd program can be used to read the old data ). OK. Press F5 to go to the next screen:



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.debianadmin.com/images/part/15.png'); ">

The size of the restored partition must be the same as that of the saved partition. If the partition is smaller than the original partition, the operation cannot proceed. If a partition is larger than the original partition, unused parts will be wasted. In other words, space will be lost. Okay. At this time, check the overview:



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.debianadmin.com/images/part/15.png'); ">

Then confirm the image file name:



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.debianadmin.com/images/part/16.png'); ">

Then there is the recovery progress indicator:



(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // www.debianadmin.com/images/part/17.png'); ">

Now, we have successfully restored the partition from a backup image. How is it easy? You can try it yourself. Come on.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.