How to Copy a Disk Using dd Command

dd is a common program for Unix and Unix-like operating systems whose primary purpose is to “convert and copy a file.” It can duplicate data accross files, devices and partitions and volumes.

Usage:

dd if=source of=target bs=byte_size
("USUALLY" some power of 2, and usually not less than 512 bytes (ie, 512, 1024, 2048, 4096, 8192, 16384, but can be any reasonable whole integer value.) skip= seek= conv=

Examples:
1. Duplicate one hard disk partition to another hard disk partition: You want to duplicate sda2 to sdb2.

[root@server ~]# dd if=/dev/sda2 of=/dev/sdb2 bs=4096 conv=notrunc,noerror

2. Create an image file for a certain disk or device partition:

FORMULA: dd if=source of=target
# Actual Syntax
[root@server ~]# dd if=/dev/sda of=/home/burnz/sda.img

3. Restoration the created image file to another device:

FORMULA: dd if=source of=target
# Actual Syntax
[root@server ~]# dd if=/home/burnz/sda.img of=/dev/sde
41963520+0 records in
41963520+0 records out
21485322240 bytes (21 GB) copied, 1479.89 seconds, 14.5 MB/s

NOTE:
By running dd you simply copying the entire disk with or without a content, so the bigger the disk the longer dd will end.

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.