 |
 |
 |
 |
| Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum. |

5th December 2007, 05:55 PM
|
|
Registered User
|
|
Join Date: Nov 2007
Posts: 47

|
|
|
dd and drive cloning
I want to use dd to clone an entire physical hard drive, designated /dev/sda, to a USB drive of the same size, designated /dev/sdb. I used the syntax dd if=/dev/sda of=/dev/sdb, and got the error "dd: opening `/dev/sda of=/dev/sdb': No such file or directory". What did I do wrong?
|

5th December 2007, 06:19 PM
|
|
Registered User
|
|
Join Date: Nov 2007
Location: Bournemouth, Deepest Darkest Dorset.
Posts: 55

|
|
|
This I copied from another site, so the "I" isn't me! Hope it answers your question though.
I have just installed a bigger hard drive in my main PC at home and have looked at the various options of 'cloning' my old drive to the new. I considered Norton Ghost and even downloaded the trial version. After a LOT of palaver getting it installed I discovered the trial version doesn't allow 'cloning'. I also looked at Ghost for Linux (G4L) but that seemed a bit complicated. Then I was informed about the 'dd' command in Linux, something I had never heard of, far less used. It turns out that one simple line will copy the complete contents of one drive to another! No fancy cloning software, no fancy graphical interfaces and no cost. You can even use this if you don't have Linux installed! Just boot from a Live CD (ANY Live CD) and enter the following command in a terminal:
dd if=/dev/sda of=/dev/sdb bs=32768
The above assumes you have (like me) SATA drives, if you have IDE drives you would type:
dd if=/dev/hda of=/dev/hdb bs=32768
If you were copying from an IDE drive to a SATa drive it would be:
dd if=/dev/hda of=/dev/sda bs=32768
The last part of the command (bs=32768) is not essential but does speed up the transfer by instructing to transfer larger blocks of data at a time.
so the next time you hear someone recomending norton Ghost or the like to clone a disk, just tell them about 'dd'!
|

5th December 2007, 08:41 PM
|
|
Registered User
|
|
Join Date: Mar 2005
Posts: 74

|
|
Quote:
|
Originally Posted by rando1000
"dd: opening `/dev/sda of=/dev/sdb': No such file or directory".
|
From this message it seems that dd thinks '/dev/sda of=/dev/sdb' is a device, instead of either '/dev/sda' or '/dev/sdb'. How exactly are you typing the command?
|

5th December 2007, 08:58 PM
|
 |
Gideon Mayhak
|
|
Join Date: May 2007
Location: Wisconsin Rapids, WI, USA
Age: 25
Posts: 771

|
|
Quote:
|
Originally Posted by BostonWatcher
From this message it seems that dd thinks '/dev/sda of=/dev/sdb' is a device, instead of either '/dev/sda' or '/dev/sdb'. How exactly are you typing the command?
|
That could be the answer itself. You may want to try enclosing each device file in quotes, like this:
Code:
dd if="/dev/sda" of="/dev/sdb"
I haven't used the dd command, though, so I could be totally wrong.
__________________
Something new coming to this space soon...
|

6th December 2007, 06:11 PM
|
|
Registered User
|
|
Join Date: Nov 2007
Posts: 47

|
|
Quote:
|
Originally Posted by Gnafu the Great
That could be the answer itself. You may want to try enclosing each device file in quotes, like this:
Code:
dd if="/dev/sda" of="/dev/sdb"
I haven't used the dd command, though, so I could be totally wrong.
|
I actually retyped it, and it finally worked. Not sure what I was doing, if there was some character I terminal I wasn't seeing or what. So the syntax I originally posted is correct. Thanks, everyone. BTW, just for reference, to copy an entire 40GB HD took about 2 hours.
|

6th December 2007, 06:20 PM
|
 |
Gideon Mayhak
|
|
Join Date: May 2007
Location: Wisconsin Rapids, WI, USA
Age: 25
Posts: 771

|
|
Quote:
|
Originally Posted by rando1000
I actually retyped it, and it finally worked. Not sure what I was doing, if there was some character I terminal I wasn't seeing or what. So the syntax I originally posted is correct. Thanks, everyone. BTW, just for reference, to copy an entire 40GB HD took about 2 hours.
|
Glad to hear  . Those darn keyboard gremlins are always causing trouble  .
__________________
Something new coming to this space soon...
|

7th December 2007, 06:07 PM
|
|
Registered User
|
|
Join Date: Nov 2007
Location: Bournemouth, Deepest Darkest Dorset.
Posts: 55

|
|
Quote:
|
Originally Posted by rando1000
BTW, just for reference, to copy an entire 40GB HD took about 2 hours.
|
I copied an 80 Gb hd to another one but it only took 25 mins. Guess it depends on the speed of your computer!
|

7th December 2007, 06:35 PM
|
|
Registered User
|
|
Join Date: Nov 2007
Posts: 47

|
|
Quote:
|
Originally Posted by dancingdog777
I copied an 80 Gb hd to another one but it only took 25 mins. Guess it depends on the speed of your computer!
|
Fair enough. My computer is about three years old. It probably also depends on the interface. Mine was to USB.
|

2nd February 2008, 10:06 AM
|
 |
Registered User
|
|
Join Date: Dec 2007
Location: Seoul, South Korea
Age: 37
Posts: 202

|
|
|
Viewing output
This is sweet. I am so happy!
Anyway, if you would like to view the output of "dd" because it really doesn't tell you much, you need another terminal (virtual terminal) open or a tab, if your using an x-term, and just run dd:
Code:
dd if="/dev/sda6" of="/dev/md1" bs=1M count=1536
md1 is a software RAID device that I created.
Then in your other VT or tab, type:
Then go back to the original term to see the progress. It is a little tedious but it works.
The other option is to find a copy of 'pdd'. I didn't bother, but it seems to implement incremental updates of its progress to STDOUT.
I am using 'dd' because I would like to eventually setup a RAID10 (1+0) and want to see how successful it turns out. Any suggestions on avoiding re-installation of Fedora 8 on a real (bios level) RAID10 configuration are appreciated.
|

2nd February 2008, 11:23 AM
|
|
Registered User
|
|
Join Date: Nov 2007
Location: Bournemouth, Deepest Darkest Dorset.
Posts: 55

|
|
|
Glad it was useful to you.
I'm not sure how to go about it, but there should be a way (there is in Windows) to make a slipstream version of your Fedora or any distro, where you install and get it running sweetly for you, then copy it and make another installation disc. That way if you need to do a clean install, you run it and it puts everything in that you want.
|

2nd February 2008, 08:26 PM
|
 |
Gideon Mayhak
|
|
Join Date: May 2007
Location: Wisconsin Rapids, WI, USA
Age: 25
Posts: 771

|
|
|
You can do that with Revisor, essentially.
__________________
Something new coming to this space soon...
|

2nd February 2008, 08:49 PM
|
 |
Registered User
|
|
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,302

|
|
|
So in conclusion ...
There must have been a typo in the original command
dd if=INFILE of=OUTFILE
should and does work as expected. No special quoting is needed.
Also using a larger blocksize like
dd if=INFILE of=OUTFILE bs=4M
will considerably speed up the operation.
You can send the USR1 signal from the same window with a little work ...
dd if=/dev/sda of=/dev/sdb & sleep 1; while [ -n "$(pidof dd)" ] ; do pkill -USR1 dd ; sleep 1 ; done
Last edited by stevea; 2nd February 2008 at 08:52 PM.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Current GMT-time: 14:38 (Saturday, 25-05-2013)
|
|
 |
 |
 |
 |
|
|