[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 330
  • Last Modified:

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...
1 Solution
u can try using norton ghost

Does Ghost Support Linux?

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

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.
I think partition magic 4.0 can do this, but I haven't tried it
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.
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

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?

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.
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.
luitjesAuthor Commented:
How would I go about creating the suggested boot disk?

When you installed your system, it should have prompted you to make a "rescue disk" - that disk will do nicely.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now