Jump to content

Cloning a hard drive


EdN

Recommended Posts

I cloned a Fedora 12 hard drive to a new hard drive using Seagate DiscWizard. Everything appeared to go well. However the new hard drive will not boot. How do I make it bootable?

Link to comment
Share on other sites

You must rewrite the master boot record in order to be able to read the partition table which is on the new disk, Try accessing the new harddisk with a partitioning program and rewriting it from there, using a program such as gParted or fstab.

Link to comment
Share on other sites

  • 2 weeks later...

oni-kun is right...you are going to have to flag the drive as bootable.  The easiest way to do this is to just boot up using a live cd (Ubuntu, gparted, fedora, knoppix...any of them will do).  You can see what drives the kernel knows about by using:

 

# fdisk -l

 

Use sudo fdisk -l if you're not root (i.e. an Ubuntu live CD).  Let's say that your drive is /dev/sda.  Then you would need to open it up with something like fdisk (or cfdisk, which is a bit more friendly) to flag it as bootable:

 

cfdisk /dev/sda

 

Even if you make it bootable however, I'm not sure that the program properly copied over your /boot/grub directory properly.  If it did and menu.lst is intact, then simply flagging the drive as bootable should work.  If not, you're going to have to reinstall grub which you can do by using the grub-install command, or you can go the long way:

 

Put in the live CD and open a terminal.  Then run these commands (as root):

 

# grub
> find /boot/grub/stage1

 

This should return something like (hd0,0).  You will need this output for the next step.

 

> root (hd0,0)    [swap out (hd0,0) with whatever was returned in step 2]
> setup (hd0)

 

This will now install grub in your MBR.  However, there is a very simple and free way to avoid having to do any of this.  Ditch the Seagate DiscWizard program and just use the dd command in Linux.  I would recommend doing something like this:

 

1. purchase a new hard drive (larger than the old one if desired)

2. power down your computer and attach the new drive

3. boot up the system using a Linux live cd

4. locate which drive is which using [sudo] fdisk -l.  Let's just assume for this example that you only have one hard drive so /dev/sda is the original drive and /dev/sdb is the new one.

5. as root, copy from the source drive to the new drive:

 

# dd if=/dev/sda of=/dev/sdb bs=32256

 

6. power down the computer, unplug the old drive, and plug in it's replacement in the appropriate place

 

 

 

Now you should be able to boot up your system using the new drive, which is an exact clone of the previous drive.  It will copy over the MBR, copy over the information about whether or not the drive is bootable...in essence it copies EVERYTHING.  It does a bit-for-bit copy of every zero/one from the original drive to the new one.

 

If the drive is larger then difference will be unpartitioned space.  You can either create a new partition, or boot up using something like gparted and expand the size of the original partition to take advantage of that free space.

 

***WARNING***

 

By very, very careful about using the dd command.  "if" stands for input file and "of" stands for output file.  Before you press enter and kick off that command, be sure you have the appropriate drives in the appropriate places!  I always read the sentence out-loud to myself:

 

"data dump using input file of /dev/sda and output file of /dev/sdb with a block size of 32256"

 

You can use the output of fdisk -l or a piece of paper to make sure you have the appropriate input and output files.

 

If you swap the order of those (i.e. copy FROM the new drive TO the old one) then you are going to hose yourself and destroy all of the data on your original drive.  "bs" is just the block size to use during the copy.  32256 is larger than default and will make the copy go faster.

 

Hope this helps!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.