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