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 2nd May 2011, 07:09 PM
znarus Offline
Registered User
 
Join Date: Mar 2011
Posts: 8
linuxfedorafirefox
use dd to copy 1 hd to another?

Hi.

My main hd is 500 gb. I have an usb-hd that also is 500 gb.
I want to copy the main hd to the usb-hd so if
the main hd should crash i can boot from the backup hd.
I think dd is the command to use. I have checked the man-page but there
are so many options.. Anyone knows how to use dd to do this?

Regards Znarus
Reply With Quote
  #2  
Old 2nd May 2011, 07:39 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,102
linuxfedorafirefox
Re: use dd to copy 1 hd to another?

The simple way is "dd if=<src> of=<dest> bs=1M"

But the issue is going to be the time it takes to copy.

For 500GB it will take 3/4 hours, and since going through USB is usually (not always) slower than the main controller (SATA likely), it can take over a day.

And during that time, it would NOT be a good idea to use the disk...

In fact, it would be best to do this by booting a rescue CD to do the copy.


dd does not respect open files -- This means that any activity on the disk being copied will not be copied appropriately, leaving possibly corrupted data on the copy.

If the disks are NOT full to the brim, it is actually faster to create target filesystems and copy them. None of the unused blocks will copied - speeding things up significantly.

The other problem depends on how the system is configured. Logical volumes will cause problems as you cannot install the disks to copy single files. The logical structure is duplicated, causing confusion with two disks/partitions that have the same identifier. This can prevent filesystems from being mounted, or even usable.
Reply With Quote
  #3  
Old 2nd May 2011, 08:35 PM
znarus Offline
Registered User
 
Join Date: Mar 2011
Posts: 8
linuxfedorafirefox
Re: use dd to copy 1 hd to another?

Aha.. thank you for your reply.. Not a good idea to use dd, I guess.. I know how to create file systems on the usb-disk and then copy ..
but i dont know how to make the usb-disk bootable..
Reply With Quote
  #4  
Old 3rd May 2011, 12:20 PM
hefeweizen's Avatar
hefeweizen Offline
Registered User
 
Join Date: Mar 2011
Posts: 58
linuxchrome
Re: use dd to copy 1 hd to another?

dd was built for exactly this kind of thing (designed in a day when a 1 megabyte file was huge). The first caution noted was about time and regardless of what tool you use, USB will be slow. A tool you make like better is rsync. If your copy (rsync) gets interrupted, you can kick it off again and rsync is smart enough to determine what already exists in the new location and picks up from there. Likewise once your rsync finishes, you can kick it off again and it will update only those files that have changed.

As for booting off a usb drive, it should not be insurmountable. I would proceed thusly:
- make sure bios can boot from usb hdd
- install new os into usb drive
- copy over important data

I suggest this because of a hesitancy involving grub (or other boot loader) detecting the usb disk properly. Theoretically it shouldn't care; you should be able to treat it as any other disk. However, this speculation leads me from recommending it outright and instead advising the above.

Last edited by hefeweizen; 3rd May 2011 at 03:56 PM. Reason: spelling correction
Reply With Quote
  #5  
Old 3rd May 2011, 12:38 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,102
linuxfedorafirefox
Re: use dd to copy 1 hd to another?

check out grub-install.

If the BIOS can boot USB, then grub-install should be able to boot it.
NOTE: the disk identification may cause problems if, for instance, you needed to remove an internal disk (I have hot-plug disks on SATA), then it is possible that the root disk (hd0,0) by default points to the /boot partition, may/will change. requiring you to change it using the grub shell to boot a USB.

A follow up on rsync - some notes I've had with it..

rsync will do the job... but if you have many many files (passing the millions, so this usually isn't an issue)....

rsync has to compare the entire directory tree being backed up with the tree on the destination before it starts copying the first file. When I worked with large file systems having millions of files and many subdirectories I found that this can take several days. Even when rsync is being restarted, this step must complete before the first file new file is copied. It is faster to use an incremental copy - that way new files are copied without needing a directory analysis first. The downside is that this depends on the application doing the copy as to whether it can handle deleting files that have been removed.

Last edited by jpollard; 3rd May 2011 at 12:44 PM.
Reply With Quote
  #6  
Old 3rd May 2011, 10:31 PM
assen Offline
Registered User
 
Join Date: Oct 2008
Posts: 492
linuxfedorafirefox
Re: use dd to copy 1 hd to another?

Hi,

dd is very fast and will do the job at "line speed", preserving your filesystem with all permissions et al. You only need to take care of one small thing: make sure the target drive has at least same number of bytes (blocks) as the source; check exactly in this unit as relocated blocks or simply some poor manufacturer's idea what a "gigabyte" is can spoil your day.

WWell,
Reply With Quote
Reply

Tags
copy

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
Can't copy CDs leonardevens Using Fedora 3 16th December 2006 01:09 PM


Current GMT-time: 05:33 (Tuesday, 21-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