Backup of Linux drives and partitions, using the DD command example __linux

Source: Internet
Author: User

The DD command is a very simple backup tool for Linux distributions. The "DD" tool simply copies the standard input to the standard output and reads in 512-byte blocks.
The DD command is a very simple backup tool for Linux distributions. The "DD" tool simply copies the standard input to the standard output and reads in 512-byte blocks. With the DD command, we can create a full disk, a disk drive, and so on, and the following article will help you learn some useful "dd" commands. 1: Create an existing partition backup

The following command backs up the entire partition/dev/sdb1 to the/opt/sdb1.img file.
# dd IF=/DEV/SDB1 of=/opt/sdb1.img Sample output

16064937+0 Records
in 16064937+0 records out
8225247744 bytes (8.2 GB) copied, 123.319, 66.7 MB/s
2: Restore Backup to other partitions

The above/opt/sdb1.img backup files can be restored to other partitions (/DEV/SDB2), and we can recover them with the following command.
# dd if=/opt/sdb1.img OF=/DEV/SDB2 Sample output

16064937+0 Records in
16064937+0 records out

Now, the/dev/sdb2 you can see is the/DEV/SDB1. 3: Create a copy with an existing partition

We can partition them directly from the existing partitions. The following command creates a copy of the/DEV/SDB1 to/DEV/SDB2.
# dd IF=/DEV/SDB1 OF=/DEV/SDB2 Sample output

16064937+0 Records
in 16064937+0 records out
8225247744 bytes (8.2 GB) copied, 221.431, 37.1 MB/s
4: Create an existing hard disk clone

The following command copies the first 446 bytes This is the MBR from one disk to the second disk. This will create a second disk boot.
# dd IF=/DEV/SDA of=/dev/sdb bs=446 count=1

1+0 Records in
1+0 records out

Now make sure that the/dev/sdb match is a/DEV/SDA partition. Once you do this, you can use to replicate each partition:
# dd IF=/DEV/SDA1 OF=/DEV/SDB1
# dd If=/dev/sda2 of=/dev/sdb2 5: MBR mirrored files for backup and recovery

Create a backup of the mirrored file that uses the following command MBR.
# dd IF=/DEV/SDA of=/opt/backup-mbr-sda.img bs=512 count=1 Sample Output

1+0 Records in
1+0 records out

The next step is to recover the MBR to a different disk, using the following command to do this.
# dd if=/opt/backup-mbr-sda.img of=/dev/sdb bs=446 count=1

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.