Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 5th December 2007, 05:55 PM
rando1000 Offline
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?
Reply With Quote
  #2  
Old 5th December 2007, 06:19 PM
dancingdog777 Offline
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'!
Reply With Quote
  #3  
Old 5th December 2007, 08:41 PM
BostonWatcher Offline
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?
Reply With Quote
  #4  
Old 5th December 2007, 08:58 PM
Gnafu the Great's Avatar
Gnafu the Great Offline
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...
Reply With Quote
  #5  
Old 6th December 2007, 06:11 PM
rando1000 Offline
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.
Reply With Quote
  #6  
Old 6th December 2007, 06:20 PM
Gnafu the Great's Avatar
Gnafu the Great Offline
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...
Reply With Quote
  #7  
Old 7th December 2007, 06:07 PM
dancingdog777 Offline
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!
Reply With Quote
  #8  
Old 7th December 2007, 06:35 PM
rando1000 Offline
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.
Reply With Quote
  #9  
Old 2nd February 2008, 10:06 AM
eliashickman's Avatar
eliashickman Offline
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:
Code:
pkill -USR1 ^dd$
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.
Reply With Quote
  #10  
Old 2nd February 2008, 11:23 AM
dancingdog777 Offline
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.
Reply With Quote
  #11  
Old 2nd February 2008, 08:26 PM
Gnafu the Great's Avatar
Gnafu the Great Offline
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...
Reply With Quote
  #12  
Old 2nd February 2008, 08:49 PM
stevea's Avatar
stevea Online
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.
Reply With Quote
Reply

Tags
cloning, drive

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
System Cloning griffinmt Using Fedora 4 21st January 2009 06:39 PM
Cloning a 20G to 40G HD with LVM Partitions seby Using Fedora 1 19th February 2008 09:49 AM
Cloning a Boot Drive Xavior Using Fedora 3 27th January 2008 08:22 PM
Cloning my hard drive blueboy4 Hardware & Laptops 17 23rd May 2007 09:57 PM
Cloning a drive image andygif Using Fedora 2 8th September 2006 01:38 PM


Current GMT-time: 14:38 (Saturday, 25-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat