F9: Using dd to clone a drive...

Les Mikesell lesmikesell at gmail.com
Sat Jul 19 16:52:57 UTC 2008


Daniel B. Thurman wrote:

> > I used dd off the Gnome Live CD, so that neither
>> > drives were mounted nor active. Next I proceeded
>> > to use dd as follows:
>> >
>> > dd if=/dev/sda of=/dev/sdb
>> >
>> > It took approx. 6 hours to copy over 450GB of data.
>> >
>> You would be better off using gparted or clonzilla to do the
>> copping. With DD, it has to copy every byte. The others understand
>> file systems and only copy data, not empty space.
>>
> I tried Gparted-Live.
> 
> Unfortunately, it failed to copy 85% of the way complaining
> about a bad block on the source drive!  I have run the 'Check'
> and it does not even see any problems with the source drive!
> I even did a check on the destination drive and it says it does
> not see any problems either - even when the copy failed!
> 
> Is there any tool besides fsck that really does a through job
> making sure to detect bad-blocks (if there really was any)
> and add it to the bad block list?  Or, perhaps there is a problem
> with Gparted-Live v0.3.7.7.1 version?

A brute-force approach is 'cat /dev/sda >/dev/null'.  If it completes, 
run dmesg to see if there were any messages about soft errors or 
retries.  Also, smartctl -a /dev/sda might have something interesting 
about the disk health.

I'd try to get a tar archive of the contents of that filesystem if there 
is anything important on it. The bad spot might be on an unused portion 
that a file based copy would miss.


> The sda6 partition size is correctly 604106921 (~300GB) so why
> the heck is Gparted reading 937752324, probably somewhere
> in the 7th partition (5GB swap) or even possibly at the end of
> the750GB  drive itself?
> 
> Of the 300GB / partition, only 49GB is actually used while the
> rest is actually empty space.  Is that the problem?  Is Gparted
> smart enough not to copy over empty space and end after 49GB
> of data?
> 
> I  have tried everything I could throw at it:
> 
> Gnome-Live & Gparted Live:
> 1) mount /dev/sda6 /mnt/a
>     mount /dev/sdb6 /mnt/b
>     setenforce 0
>    a)  cp -acpx /mnt/a/.  /mnt/b
>    b)  tar --xattrs  -cpf - /mnt/a | (cd /mnt/b tar --xattrs -xpf - .)
> 
> Nothing seems to work!
> 
> Why am I not able to get the / partition copied over
> successfully?  Everything is bootable *except* / !

Do you still have both drives in the same machine, and do they contain 
LVM volumes?  If you cloned the id's the duplicate might not work. The 
solution might be as simple as unhooking the other drive. If the reason 
you are cloning is to build a different machine and you also have enough 
space on a networked drive to hold a compressed image copy, I recommend 
using clonezilla-live.  It's a bootable iso that will save the master 
copy to a local or remote (nfs/smb/ssh) drive.  Then you can boot it in 
the target and it will reconstruct the partitioning and filesystems as 
well as the contents.  It knows enough about most filesystems (including 
windows) to only copy the used portions of the disk so it is very fast.

-- 
   Les Mikesell
    lesmikesell at gmail.com




More information about the fedora-list mailing list