LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Copy hard drive to hard drive (https://www.linuxquestions.org/questions/linux-hardware-18/copy-hard-drive-to-hard-drive-385359/)

linuxnew 11-21-2005 09:56 PM

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

2damncommon 11-21-2005 11:43 PM

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.

williamwbishop 11-22-2005 12:00 AM

I would look up ghost for linux on freshmeat.net, or simply use g4u

2damncommon 11-22-2005 12:16 AM

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?

linuxnew 11-22-2005 08:07 PM

Thanks Sir

purelithium 11-23-2005 03:57 PM

dd if=/dev/hda of=/dev/hdb conv=notrunc

the if parameter is the origin and the of parameter is the target.

tuxdev 11-23-2005 04:13 PM

cp should be able to do this, with some special options for devices and other not normal files.

linuxnew 11-23-2005 04:36 PM

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

2damncommon 11-24-2005 01:31 AM

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"?

Electro 11-24-2005 01:49 AM

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.

slantoflight 11-24-2005 06:27 AM

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.

2damncommon 11-24-2005 07:33 AM

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.

purelithium 11-24-2005 11:49 AM

Apologies, again i am corrected. I didn't read enough to realize that they were 2 different size drives.

rmang 11-28-2005 08:04 PM

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


All times are GMT -5. The time now is 12:09 PM.