Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

After I used dd to clone a 120 gb hard disk to new empty 320 gb hard disk, the new disk cannot be booted. And fdisk tell me the partition table is no valid and Gparted just cannot edit the partitions.(I supposed I need to create a new partition on empty space)

The command I used to clone disks is:

dd if=/dev/sda1 of=/dev/sdb

Any way to restore the partition table? or what is wrong with my way to clone disk?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

The partition table is contained within the first 512 bytes of the disk (which are called MBR - Master Boot Record).

dd if=/dev/sda of=/dev/sdb bs=512 count=1 would copy them.

As ErikA says, either copy MBR + partition individually, or simply the whole disk to the other disk

share|improve this answer
    
I am wondering how can I clone swap partition? would this command be correct? sudo dd if=/dev/sdc2(swap partition in old hard disk) of=/dev/sda2(empty partition in new hard disk) bs=5MB –  Kurt Liu May 4 '11 at 14:30
    
@Kurt there isn't really a point to cloning a swap partition, just create a new swap partition with mkswap, use swapon to activate it, use swapoff to deactivate the old partition (at this point anything stored in it will move to RAM or the other partition) and then edit /etc/fstab to set the new partition as swap permanently. –  DerfK May 4 '11 at 16:19
add comment

With that command, you're cloning a partition to a disk, which is skipping the partition table.

Try this:

$ dd if=/dev/sda of=/dev/sdb
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.