Linux DD implements disk complete full-image backup, recovery recover (Restore)

Source: Internet
Author: User

1,DD operation is a simple copy by byte, what partition table Ah, MBR (master boot record) Ah all copy;

1. Disk Cloning
That is to copy the entire hard drive. Of course you first need to pick up a new hard drive on your computer and let the system recognize it. For example, the hard drive may be recognized as/DEV/SDB, and the original hard drive is called/DEV/SDA. Then you can simply execute on the linux command line:
dd if=/dev/sda of=/dev/sdb
Yes, that's it. Once this command is complete, your second hard drive will have a copy that is identical to the first hard drive and can be started. Because the DD operation is simply by byte copy, what partition table Ah, MBR ah all copy.
Of course you can also make some tweaks to customize the cloning operation. For example, you might want to back up the contents of your hard drive to a disk file instead of another new hard disk, and you can
dd if=/dev/sda of=~/disk1.img
After that, Disk1.img is a backup of the disk image files, you can copy or transfer to other media can also be compressed:
gzip disk1.img #generates disk1.img.gz
Or, when you create a disk image file, you perform compression:
dd if=/dev/sda | gzip > disk.img.gz
dd if=/dev/sda | bzip2 > disk.img.bz2

That's good! Ghost has all the features.

2. Partition cloning
If we don't want to clone the entire disk and just want to back up some of the partitions that hold the data, you'll need to clone a partition. As stated in the preliminary knowledge, partitioning is also a file under Linux. For example
dd if=/dev/sda1 of=~/part1.img
The first partition of the first disk is backed up into a file named Part1.img.
Partition replication is also possible:
dd if=/dev/hda1 of=/dev/hda3
The partition is copied to partition 3 intact.

3. Recovering a disk or partition from a mirrored file
It is easy to restore by exchanging the file name of the above command with the and if points. For example
dd if=disk1.img of=/dev/sda
Restore the image saved in disk1.img to the first disk
dd if=part1.img of=/dev/hda2
Restore the image saved in part1.img to the second partition of the first hard drive

Finally, it is important to note that regardless of the backup or restore, you need to ensure that the file or disk space to which you are pointing is greater than the if point, because it is copied by byte. If there is not enough space to store the content, the backup will fail naturally.

Linux DD implements disk complete full-image backup, recovery recover (Restore)

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.