Copying HD with Linux on it

In one of the coming days, the HD of my laptop will be replaced by a new one and I want to be able to save all my O/S installs and data from the old disk to the new one. I have a combined installation of Win95/WinNT and Linux of the old HD.

Would I be able to just add the new HD, startup Linux and do something magic like dd if=/dev/hda of=/dev/hdb, so that I get a exact sector copy of the old disk to the new? I want to make sure that neither partitions and bootblocks get damaged on the way...
luitjesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

comlab4Commented:
u can try using norton ghost

Does Ghost Support Linux?

Situation:
You want to use Ghost to clone a Linux drive or migrate it to a larger hard drive. Will Ghost do this?

Solution:
Currently, Ghost can correctly change partition sizes on FAT16, FAT32, and NTFS partitions only. When a drive is partitioned in a different format, Ghost can only perform a sector by sector copy. Sector by sector copies do not allow for there to be any changes in the geometry of the hard drive.
Therefore, Ghost can be used to clone a drive to an identical drive for cloning or backup purposes. However, Ghost currently cannot be used to migrate a Linux partition to a larger drive.
0
swwelshCommented:
I think partition magic 4.0 can do this, but I haven't tried it
0
rrussellCommented:
Yes, it's easy, but no, it's not really that easy.
The burning question is whether or not you can simultaneously mount both hard drives in the same laptop at the same time.  If so, make sure you have a rescue floppy handy before you start.

Since the new drive will be larger than the old one, you can't do a raw dd copy.  If you create partitions on it the same size as the partitions on the old drive and allocate the new space as a new partition, you can simply dd the partitions (dd if=/dev/hda1 of=/dev/hdb1).

You'll have to make your windows partitions bothe the same size and the same number (hdX) on both drives, and copy them with dd.  For the linux part, you'll have to mount both drives and copy all directories except /dev and /proc.  On the new drive, make a /dev and /proc directory, and put in them any symlinks you may have created on the other drive.

Then, take out the old drive, boot from the floppy, and fix lilo.  Pay close attention to /etc/fstab as all this is going on.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

luitjesAuthor Commented:
For your information, the replacing drive is expected to be the exact same make and model then the one currently being used.

Wouldn't that eliminate some of the problems that were raised?

    Rende
0
rrussellCommented:
In that case, then maybe you can, it's worth a shot.  But, be sure you do it from a boot disk, and don't do it while the drives are mounted, assuming you can put both drives in the laptop at the same time.  Make sure you're not swapping on the disk, too, becasue dd'ing an active swap partition is undesired.
0
pwhite76Commented:
I agree with the comments by rrussell, with one modification:

You should copy the files in /dev.  Your system will be pretty useless without them.

Also, make sure you use the -a (archive) option to cp, as this will preserve links, file attributes, and copy directories recursively.
0
luitjesAuthor Commented:
How would I go about creating the suggested boot disk?
0
rrussellCommented:
http://howto.tucows.com/LDP/HOWTO/Bootdisk-HOWTO.html

When you installed your system, it should have prompted you to make a "rescue disk" - that disk will do nicely.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.