LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-27-2005, 06:59 PM   #1
lunarcloud_88
Member
 
Registered: Jun 2005
Distribution: Gentoo
Posts: 74

Rep: Reputation: 15
Drive to Drive Copy


Is there a program to assist in complete drive-to-drive copying?
I use slackware linux, btw.
 
Old 07-27-2005, 08:35 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
The command you want is 'dd'. Assuming the drives are the same size (or the destination is larger):

dd if=/dev/hde of=/dev/hdf

The above will copy every block from the source (/dev/hde in this example) to the destination (/dev/hdf in the example). You can increase the buffering which may speed the copy if you have the memory, by specifying the 'bs' option:

dd if=/dev/hde of=/dev/hdf bs=4M

The above will set the block size to 4MB.
 
Old 07-29-2005, 09:24 AM   #3
lunarcloud_88
Member
 
Registered: Jun 2005
Distribution: Gentoo
Posts: 74

Original Poster
Rep: Reputation: 15
does the second drive have to be formatted first? if so... how do i do that. cfdisk let's me tell it to be "linux" format, but i had to go through the slack installer to actually make it ext3. how do i format it in ext3 then?
 
Old 07-29-2005, 09:38 AM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
You don't need to format it before the copy - any existing format will be overwritten. All blocks, including the filesystem overhead, partition tables, master boot record, etc. are being copied.

To format a partition as ext3, the command is (where /dev/hdx1 is the partion you want to format):

mke2fs -j /dev/hdx1

An ext3 partition is an ext2 partition with a journal (the -j option).
 
Old 07-29-2005, 09:48 AM   #5
lunarcloud_88
Member
 
Registered: Jun 2005
Distribution: Gentoo
Posts: 74

Original Poster
Rep: Reputation: 15
Will that also work for partitions?
If i just say dd if=/dev/hda1 of=/dev/hdb2
... will it just copy those partitions or will it try to copy the entire hard drives (therefore wiping files i need.)?

Last edited by lunarcloud_88; 07-29-2005 at 09:53 AM.
 
Old 07-29-2005, 09:54 AM   #6
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
It will just copy those partitions.
 
Old 07-29-2005, 09:55 AM   #7
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,272

Rep: Reputation: 154Reputation: 154
that will just copy hda1 to hdb2, hdb2 must be the same size or bigger
 
Old 07-29-2005, 09:59 AM   #8
lunarcloud_88
Member
 
Registered: Jun 2005
Distribution: Gentoo
Posts: 74

Original Poster
Rep: Reputation: 15
i plan on having it much bigger. Thanks guys!
 
Old 07-29-2005, 10:04 AM   #9
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Having it much bigger? If you are planning to expand the partition by moving to a larger partition, you will need the resize2fs command.
 
Old 07-30-2005, 09:48 AM   #10
lunarcloud_88
Member
 
Registered: Jun 2005
Distribution: Gentoo
Posts: 74

Original Poster
Rep: Reputation: 15
ok... now that i've moved it and realized it thinks its the same sized partition... how to i do that?
Can I be using the partition to be enlarged while running resize2fs?
Do I have to specify -j for ext3?

Last edited by lunarcloud_88; 07-30-2005 at 09:50 AM.
 
Old 07-30-2005, 10:11 AM   #11
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
No, you don't want to use it while it's being resized. It should not be a mounted partition. To resize it (assuming it's called /dev/hdb2) to fill the new partition:

resize2fs -p /dev/hdb2

Check the man page for details.
 
Old 07-30-2005, 05:37 PM   #12
lunarcloud_88
Member
 
Registered: Jun 2005
Distribution: Gentoo
Posts: 74

Original Poster
Rep: Reputation: 15
i've done it and made the necessary changes to /etc/fstab thanks guys!
 
Old 11-14-2006, 05:59 AM   #13
NuWeb
Member
 
Registered: Nov 2006
Posts: 55

Rep: Reputation: 15
I'm a bit new to linux.

I have a 80Gig WD drive that's about to die. I purchased another 80Gig WD drive and partitioned the drive the same as the first drive. I did "dd if=/dev/hda of=/dev/hdb" and the hard drive light started flickering. This has been going on for about 6 hours.

How long should it take to completely copy an 80 Gig drive.?

Thanks...
 
Old 11-14-2006, 07:52 AM   #14
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by NuWeb
I'm a bit new to linux.

I have a 80Gig WD drive that's about to die. I purchased another 80Gig WD drive and partitioned the drive the same as the first drive. I did "dd if=/dev/hda of=/dev/hdb" and the hard drive light started flickering. This has been going on for about 6 hours.

How long should it take to completely copy an 80 Gig drive.?

Thanks...
Normally better to start a new thread--but you question is pretty close to the original....

To use dd, there is no need to partition anything--it is doing low-level copy---bit by bit.

An easy way to answer your question **for your machine**:
dd if=/dev/hda of=/dev/hdb bs=1M count=10
See how long that takes...the same command without "count=10" will take 8,000 times longer (80GB/10MB)'

Also, I think dd goes faster when you specify a larger block size--I've never played with it though
 
Old 11-14-2006, 08:01 AM   #15
NuWeb
Member
 
Registered: Nov 2006
Posts: 55

Rep: Reputation: 15
Quote:
Originally Posted by pixellany
Normally better to start a new thread--but you question is pretty close to the original....

To use dd, there is no need to partition anything--it is doing low-level copy---bit by bit.

An easy way to answer your question **for your machine**:
dd if=/dev/hda of=/dev/hdb bs=1M count=10
See how long that takes...the same command without "count=10" will take 8,000 times longer (80GB/10MB)'

Also, I think dd goes faster when you specify a larger block size--I've never played with it though
Like I said, I'm new to this.

It's been going for 8 hours, should I stop it and start again.?

What should I use for the best results (the "EXACT" command line) and how long should it take to copy the drive.?

Since I partitioned the drive is there anything I need to do or does it just rewrite over everything.?

Thanks again...
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Easiest way to copy a boot drive to a new hard drive lsgko Linux - Software 3 05-24-2005 09:38 PM
CD-R Drive to CD-RW Drive Direct Copy CooManChu Linux - Hardware 25 01-08-2005 10:55 AM
How to copy ext2fs from failed hard drive to good drive? DogWalker Linux - Hardware 2 08-30-2004 10:52 PM
boot error after using Copy Commander to copy debian system onto larger new drive Interceptor Linux - Hardware 7 05-04-2003 12:40 PM
Cannot Copy Files From Network FAT32/NTFS Drive to My Local Linux Drive michaelh Linux - Networking 3 10-29-2002 10:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration