PDA

View Full Version : Help needed on using dd



orbitbsl
05-24-2006, 09:52 AM
I am new to Linux and am currently trying to copy / clone a hard drive with an XP OS to another.

The source drive shows up as hda1
The destination drive is an IDE on a USB adapter and shows up as sda. It has some old data on it which I assume will be overwritten.

Both drives are 20.4Gb

I believe I need to use "dd if=/dev/hda of=/dev/sda" to clone the drive.

I have gone to run and typed BASH.
I then typed su
I then typed the command shown above. The hard drive light pulses 1 or 2 times a seconds. After about 12 hours the command had not finished. I cancelled the operation and checked the destination drive in Linux. Nothing had changed on it.

Any ideas as to what I am doing wrong?

ckamin
05-24-2006, 10:41 PM
Just a rough guess, but if you are trying to clone an NTFS partition/drive, Linux might not be the answer. I have not used dd to clone an NTFS drive, so I do not know if it would work or not. It is just my opinion that if Linux is not flawless with NTFS, it could be the issue.

orbitbsl
05-25-2006, 12:01 AM
At the moment I am testing using dd to clone between two good drives as I need to clone a drive with a hardware fault. It can not be accessed in Windows as Windows times out. Therefore I can't use Ghost. However the drive can be accessed and read with Linux.

So assuming I can get two working drives to clone using dd I will then try the faulty drive.

Kowood
05-25-2006, 12:37 AM
The filesystem type won't matter, just make sure each fs is the EXACT SAME SIZE, down to the byte. Otherwise it won't work.

orbitbsl
05-25-2006, 07:28 AM
Hi Kowood

<<make sure each fs is the EXACT SAME SIZE>>
Does this mean I need to create a partition of the same size and type on the destination drive? I assumed that as dd did a byte by byte copy it would create everything during the process.

ruymbeke
05-25-2006, 05:50 PM
Hi Kowood
<<make sure each fs is the EXACT SAME SIZE>>
Does this mean I need to create a partition of the same size and type on the destination drive? I assumed that as dd did a byte by byte copy it would create everything during the process.
At first I woul copy the whole drive at once, including partition table and boot sectors
even though the new drive has a larger size and you will only use a portion of it.
Then under windows, resize, move or create new partition(s) to use the rest of the disk.
As far as I remember the windows boot loader (ntldr) do not like a change in the disk geometry
and/or a change in the physical location of the boot files...
You may need to use the windows recovery console from the install cd to re install the boot files.
My two cents,
Gilles

orbitbsl
05-26-2006, 09:31 AM
I have now tried another hard drive as the destination drive and attached it directly to the IDE rather than running it on a USB - IDE adapter. The dd now runs but it takes a very long time. 20Gb took 5 hours! This would take about 15 - 30 minutes with Ghost.

This there anything that can be done to speed up the dd? I need to clone a Windows XP drive that can only be read in Linux. It is 250Gb so it is going to take at least 2 days.

OErjan
05-26-2006, 10:20 AM
ghost copies data only dd copies the whle drive. quite diferente things don't you think?

ruymbeke
05-26-2006, 05:48 PM
...This there anything that can be done to speed up the dd? I need to clone a Windows XP drive that can only be read in Linux. It is 250Gb so it is going to take at least 2 days.
Did you enable dma in the kernel cheatcode ?
Did you enable the 32bit mode (hdparm -c1d1 /dev/hda) ?
My two cents,
Gilles

malaire
05-26-2006, 06:09 PM
I have now tried another hard drive as the destination drive and attached it directly to the IDE rather than running it on a USB - IDE adapter. The dd now runs but it takes a very long time. 20Gb took 5 hours! This would take about 15 - 30 minutes with Ghost.

This there anything that can be done to speed up the dd? I need to clone a Windows XP drive that can only be read in Linux. It is 250Gb so it is going to take at least 2 days.

You can use bs-option to set the block-size. Larger values might be faster (as long as they aren't too large), but I havn't really tested it. I usually use bs=1M

orbitbsl
05-26-2006, 11:01 PM
<<Did you enable dma in the kernel cheatcode ?
Did you enable the 32bit mode (hdparm -c1d1 /dev/hda) ?>>

I am new to Linux so I have no idea how to do this.

I will also give the bs= option a go to see if this improves things.

I am now using Paragon Disk Copy as it has a Linux CD version.

Thanks for all the help and suggestions.

ckamin
05-27-2006, 07:29 AM
See this link for info on Cheatcodes: http://www.knoppix.net/wiki/Cheat_Codes

The one you want is dma. At the boot prompt before Knoppix continues booting, type "knoppix dma". You can add any other desired cheat codes at that time as well. Then just hit "enter" and Knoppix will continue to boot with dma enabled. It can have profound effects on optical and hard drives. It is off by default, but some hardware requires it to be enabled.

Just wondering why your XP drive can only be read in Linux? To clone a drive, Ghost should work well. There is a bootable version that should do the trick, or a program such as Acronis True Image. Most recent versions (after about 2001) would support NTFS partitions. I have used both programs to clone drives for multiple PCs in a corporate environment. They can be configured to support external drives/burners. These programs would certainly be faster than what you have been trying so far.