Linux backup system to another drive

Source: Internet
Author: User

First you'll think of the DD command.

But

1, if the small hard drive is OK, the big hard drive on t is not high efficiency;

2, moreover, DD is a hardware-level copy, the front of the MBR will also be restored to another disk, if the source hard disk is 100G, the target disk is 200G, and will have problems, 200G hard disk due to be overwritten by the write 100G hard disk MBR caused only available 100G, not to mention rewrite MBR quite trouble;

So it's best not to back up to another drive in a way similar to DD IF=/DEV/SDA of=/dev/sdb.

It is recommended to copy it in tar.

First, refer to the fdisk-l display of the target hard disk with Fdisk as the source hard disk partition, each partition of the starting bar can be seen at the end of the bar, of course, you can also define the partition size as needed;

Where the swap partition in Fdisk after the new partition (that is, the partition is allocated well) with the T option to specify the ID of 82, if FAT32 is B;

After the area is divided, it is formatted with MKFS. (The partition format of the source hard disk can be #df-t view)

#mkfs-T EXT3/DEV/SDB1

The source hard disk partition can then be backed up to the target hard disk partition by partition:

mkdir /mnt/sda1/mnt/Mount /dev/sda1/mnt/Mount /dev/sdb1/mnt/  /mnt/tar -CPV. |  Tar -xpc/mnt/sdb1

Of course someone will say such trouble, direct DD if=/dev/sda1 OF=/DEV/SDB1, this is not to say no, but,,,

1, if a larger partition meaningless copy empty data is not a smart approach;

The 2,tar solves the fragmentation problem when the copy is restored, so it is highly recommended for a copy of the system. (although there is no need to worry too much about disk fragmentation for the Linux partition format)

Linux backup system to another drive

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.