1

Topic: Copy MBR using GParted?

I just downloaded GParted Live CD and it seems really nice.

I'm trying to make a backup clone disk of my IBM/Lenovo desktop's SATA hard drive running XP. The original hard drive is 160GB - about 150GB first partition, normal NTFS and a 10GB "security"  partition. I booted up with the GParted Live CD, and resized the first partition to 20GB, so now my original hard disk has a 20GB NTFS partition, a bunch of unpartitioned space, and the 10GB security partition. The disk boots fine, and the 20GB is plenty for my system. Everything looks good.

I then put a blank 160GB SATA drive on a second controller, booted up with the GParted Live CD, and copied the 20GB from my main drive to the extra drive. The copy took place very quickly, and with no errors. I used GParted to make sure the partition on the extra drive is set as "bootable".

If I boot up from the main drive, and look at the second drive, it looks fine, and it seems to have all the right folders and files etc. on it.

But, if I disconnect the main drive and try to boot from the cloned drive, it starts loading Windows but then just freezes somewhat before the login prompt should display. It does this if I boot in Safe mode or just normally.

From looking at this board, I think maybe it is a problem with my MBR. I guess the MBR isn't officially part of any partition and doesn't actually get copied over when I copy the first partition?  Does that seem like a reasonable explanation of the problem? If so, what is a good (simple!) way to deal with it? Do I want to find some way to copy the MBR from the first disk to the clone? Or is it better to create a MBR on the clone from scratch?

Advice appreciated greatly!

Thanks. -Steve

2

Re: Copy MBR using GParted?

Hi Steve,
When you copy a partition from hd to hd, you dont copy windows to somewhere, but ntfs partition to somewhere. As you can guess few things are missing :-p
It is sure that mbr is missing. If you are okay, you could try two different things :
First try to install mbr booting the xp cd and following the micro$ docs : http://support.microsoft.com/kb/314058
and specialy this :

FIXBOOT
fixboot drive name:
Use this command to write the new Windows boot sector code on the system partition. In the command syntax, drive name is the drive letter where the boot sector will be written. This command fixes damage in the Windows boot sector. This command overrides the default setting, which writes to the system boot partition. The fixboot command is supported only on x86-based computers.
FIXMBR
fixmbr device name
Use this command to repair the MBR of the boot partition. In the command syntax, device name is an optional device name that specifies the device that requires a new MBR. Use this command if a virus has damaged the MBR and Windows cannot start.

Warning This command can damage your partition tables if a virus is present or if a hardware problem exists. If you use this command, you may create inaccessible partitions. We recommend that you run antivirus software before you use this command.

You can obtain the device name from the output of the map command. If you do not specify a device name, the MBR of the boot device is repaired, for example:
fixmbr \device\harddisk2
If the fixmbr command detects an invalid or non-standard partition table signature, fixmbr command prompts you for permission before rewriting the MBR. The fixmbr command is supported only on x86-based computers.

If this doesnt work, tell us, and then we will try to backup mbr from the gparted livecd, and restore it to the second hd. But in this case, sata must be the same, and partition TOO !!!

Larry
GParted-project Admin
Former GParted-LiveCD maintainer (2007)

3

Re: Copy MBR using GParted?

Thanks very much! I will definitely try the XP recovery console and FIXBOOT and FIXMBR.

Does it matter which to run first? I'm thinking FIXMBR first?

And if the disks are the same, and the partitions are the same, why would FIXBOOT need to be run? Wouldn't FIXMBR be sufficient?

Your help is greatly appreciated. -Steve

4

Re: Copy MBR using GParted?

About win$, i dont know : this is a test. I am not sur it will work. I am sure there isno mbr on the second hd : so is xp able to create a one, i really dont know. You also could try to download a win98 bootdisk, boot itup and run :  fdisk /mbr [WITH ONLY the new hd plugged!!!!!!!].
If it doesnt work, then we will try something else.

Larry
GParted-project Admin
Former GParted-LiveCD maintainer (2007)

5

Re: Copy MBR using GParted?

Thanks for the tips, I'll try some and let you know how it works.  -Steve

6

Re: Copy MBR using GParted?

Yeah!

I couldn't get the XP recovery console to work - it claimed my admin password was wrong, but I think this was actually because my admin account had been renamed.

At any rate, using a Win98se boot floppy and typing in "fdisk /mbr" worked quickly and it seems perfectly.

So, it seems like I can do what I want by:

- Shut computer down, attach blank hard disk as a second disk, and boot using GParted Live CD
- Use GParted to copy  my system partition to the blank hard disk
- Shut the computer down, remove the system disk, and boot using Win98se floppy
- Run "fdisk /mbr"

But isn't there a "cleaner" way to do this? GParted is so good at copying a big partition from HD to HD, isn't there a way I can get it to copy a few hundred bytes of MBR as well?

I guess the unix utility "dd" is on the GParted Live CD also - would that be a good way to do it?

Thanks again for all the great assistance. -Steve

7

Re: Copy MBR using GParted?

if you wanna use "dd" you can just type this within gparted livecd :

dd if=/dev/hda of=/tmp/whereyouwant/thefileyouwant bs=512 count=1

either you use ide and then type hda, either you use sata and then type sda, either all other possibilities smile

but after this you need to restore it to the other hd.
I assume you backup hda mbr and want to retore hdb mbr with hda one.
type the following :

dd if=/tmp/whereyouwant/thefileyouwant of=/dev/hdb

If hard drives are the same, it should work.

Larry
GParted-project Admin
Former GParted-LiveCD maintainer (2007)