LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 11-21-2005, 10:56 PM   #1
linuxnew
LQ Newbie
 
Registered: Apr 2004
Posts: 9

Rep: Reputation: 0
Copy hard drive to hard drive


Hello,

I have a 60 GB Hard drive with Dual Boot (RH9 and WinXP), I want to copy the entire hard drive to a new 200 GB one. Please let me know how I do that.

Thanks in Advance,

Kartik
 
Old 11-22-2005, 12:43 AM   #2
2damncommon
Senior Member
 
Registered: Feb 2003
Location: Calif, USA
Distribution: Debian Wheezy
Posts: 2,839

Rep: Reputation: 48
Obviously the new drive is about 140GB larger than the old drive.
If any partition contained just files I would simply copy the files.
If I was attempting to recreate an OS I would first run "cfdisk -Ps /dev/hda". I would create partitions on the new drive (again with cfdisk, which I prefer) slightly larger than on the old drive (just to be sure).
I would use the "dd" command on each partition. "dd if=/dev/hda1 of=/dev/hdb1" or such.
This should recreate each partition and leave you with the extra space on the new drive which is probably what you want to do.

EDIT: You would want to be sure you had an alternate boot method for at the very least one of the operating systems to be able to create the boot manager options you want.

EDIT2: You should not need to get too involved with a swap partition.

Last edited by 2damncommon; 11-22-2005 at 12:50 AM.
 
Old 11-22-2005, 01:00 AM   #3
williamwbishop
Member
 
Registered: Feb 2003
Location: god's judge
Posts: 376

Rep: Reputation: 30
I would look up ghost for linux on freshmeat.net, or simply use g4u
 
Old 11-22-2005, 01:16 AM   #4
2damncommon
Senior Member
 
Registered: Feb 2003
Location: Calif, USA
Distribution: Debian Wheezy
Posts: 2,839

Rep: Reputation: 48
Quote:
I would look up ghost for linux on freshmeat.net, or simply use g4u
Would these methods make exact copies of multiple partitions (and operating systems) leaving the remainder of the space on the new drive free?
 
Old 11-22-2005, 09:07 PM   #5
linuxnew
LQ Newbie
 
Registered: Apr 2004
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks Sir
 
Old 11-23-2005, 04:57 PM   #6
purelithium
Member
 
Registered: Oct 2005
Location: Canada
Distribution: Mandriva 2006.0
Posts: 390

Rep: Reputation: 30
dd if=/dev/hda of=/dev/hdb conv=notrunc

the if parameter is the origin and the of parameter is the target.
 
Old 11-23-2005, 05:13 PM   #7
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,014

Rep: Reputation: 115Reputation: 115
cp should be able to do this, with some special options for devices and other not normal files.
 
Old 11-23-2005, 05:36 PM   #8
linuxnew
LQ Newbie
 
Registered: Apr 2004
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by 2damncommon
Obviously the new drive is about 140GB larger than the old drive.
If any partition contained just files I would simply copy the files.
If I was attempting to recreate an OS I would first run "cfdisk -Ps /dev/hda". I would create partitions on the new drive (again with cfdisk, which I prefer) slightly larger than on the old drive (just to be sure).
I would use the "dd" command on each partition. "dd if=/dev/hda1 of=/dev/hdb1" or such.
This should recreate each partition and leave you with the extra space on the new drive which is probably what you want to do.

EDIT: You would want to be sure you had an alternate boot method for at the very least one of the operating systems to be able to create the boot manager options you want.

EDIT2: You should not need to get too involved with a swap partition.
How about adding a SATA card and hard drive, that would be an easier option!!!

please advise

Kartik
 
Old 11-24-2005, 02:31 AM   #9
2damncommon
Senior Member
 
Registered: Feb 2003
Location: Calif, USA
Distribution: Debian Wheezy
Posts: 2,839

Rep: Reputation: 48
Quote:
How about adding a SATA card and hard drive, that would be an easier option!!!
Zero SATA experience here.
My understanding is that attempting to use SATA with any operating system stands to make things more complicated.
Why "easier"?
 
Old 11-24-2005, 02:49 AM   #10
Electro
Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
The utility dd should never be use to make a copy of the smaller drive. Just use cfdisk or fdisk to create partitions on the 200 GB hard drive. Then use hdparm to re-read the partition table on the 200 GB to skip the reboot process. Next format the partitions and then copy files for each partition using the cp utility. Finally run boot loader to setup the MBR and edit fstab file if need to.
 
Old 11-24-2005, 07:27 AM   #11
slantoflight
Member
 
Registered: Aug 2005
Distribution: Smoothwall
Posts: 283
Blog Entries: 3

Rep: Reputation: 35
If you were to just use dd you would end up with the wrong drive geometry settings and your free space would probrably be reported incorrectly. And lets not forget what the journal will have to suffer through now. If fact, the only way to properly copy a harddrive to another different sized harddrive using dd is a real pain in the ass. Definitely easier to use the above user's suggestion.

Last edited by slantoflight; 11-24-2005 at 07:28 AM.
 
Old 11-24-2005, 08:33 AM   #12
2damncommon
Senior Member
 
Registered: Feb 2003
Location: Calif, USA
Distribution: Debian Wheezy
Posts: 2,839

Rep: Reputation: 48
Quote:
The utility dd should never be use to make a copy of the smaller drive.
Quote:
If you were to just use dd you would end up with the wrong drive geometry settings
You are correct.
IF you were COPYING THE ENTIRE SMALLER DRIVE TO A LARGER DRIVE.
Copying a partition would have no effect on the MBR and geometry previously created.
"cp" will work IF you use the correct options.
 
Old 11-24-2005, 12:49 PM   #13
purelithium
Member
 
Registered: Oct 2005
Location: Canada
Distribution: Mandriva 2006.0
Posts: 390

Rep: Reputation: 30
Apologies, again i am corrected. I didn't read enough to realize that they were 2 different size drives.
 
Old 11-28-2005, 09:04 PM   #14
rmang
LQ Newbie
 
Registered: Jan 2004
Posts: 12

Rep: Reputation: 0
Is there any danger in using the "cp" command on a live multi-user system? Could you do a preliminary cp-ax for each partition live, then boot to single user mode (or disable all services) and issue a cp -aux to freshen any recently changed files, swap drives, and reboot? Trying to figure out a way to minimize downtime for such a drive switch (in the case of a primary drive starting to exhibit signs of failure).

Rob
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing grub to external USB hard drive for later use as internal hard drive dhave Linux From Scratch 2 12-10-2005 09:48 AM
Easiest way to copy a boot drive to a new hard drive lsgko Linux - Software 3 05-24-2005 10:38 PM
How to copy ext2fs from failed hard drive to good drive? DogWalker Linux - Hardware 2 08-30-2004 11:52 PM
Copy a Hard Drive rjneeley Linux - Software 3 06-11-2004 08:58 AM
STUCK--Trying to copy old Hard Drive to new Hard Drive. Please Help tsw Linux - Newbie 8 05-26-2004 03:47 AM


All times are GMT -5. The time now is 07:57 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration