Linux Copy One Hard Disk to Another Using dd Command
Q. How can I copy one hard disk to another using dd command?
A. dd command can copy disk in raw format. It will copy partition table and bootloader and all partitions within this disk. For example, you can copy /dev/sda to /dev/sdb (same size) using the following dd command. dd should complete with no errors, but output the number of records read and written.
Login as the root user (use sudo or su command)
WARNING! These examples may result into data loss, ensure there are good backups before doing this, as using dd wrong way can be dangerous.Open terminal or shell prompt and type the following dd command:
# dd if=/dev/sda of=/dev/sdb
Where,
- if=/dev/sda : Input disk (source)
- of=/dev/sdb : Output disk (destination)
You can also copy hard disk or partition image to another system using a network and netcat (nc) command.
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Other Helpful FAQs:
- UNIX / Linux: copy master boot record (MBR)
- Linux copy data from a floppy to hard disk
- Howto find out or Learn harddisk size in Linux or UNIX
- What happens when hard disk fails in raid 5
- Linux / UNIX advantage of creating soft links instead of copy a file
Discussion on This FAQ
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: backups, bootloader, dd command, hard disk, partition table, partitions, raw format, root user, sda



February 5th, 2008 at 4:08 am
Hi,
Please check your steps. Instead of if & of you have written if twice