Share |

3.4 Bootsector repair

About bootrecords

Several utilities can be applied to repair a bootsector and there is a lot that can be said about it.
I will only describe a few procedures for Windows and Linux bootsectors.

In a PC style (x86) environment there are 2 ways a machine can boot from a harddisk: Either from the MBR (Master Boot Record) OR from the bootsector on the active partition. Historically, Windows has always booted from the active partition bootsector, but it also writes some stuff to the MBR of the disk. I don't know all the internals of the different bootprocesses, so please correct me if this documentation has it wrong.
Continuing: Linux can boot in the two different ways: Either it writes its code to the MBR (e.g. /dev/hda), OR it writes it to the active partition (e.g. /dev/hda1).

Check partitioning

Sometimes the failure to boot can simply be a partitioning problem. In that case, refer to the previous section. If you rebuild your partitioning as it was before, it most likely will boot again.

Never forget to set the correct active partition!

Windows boot

Let's take a quick look at procedures on how to repair Windows bootrecords.
As I already said, Windows booting depends on both the MBR and the partition bootrecord code.

-
ms-sys
This utility can write new MBR code to your disk. Type 'ms-sys -h' to obtain some help on the different parameters, but in most cases you run it first to analyse your disk. 'ms-sys /dev/hda', will tell you about your MBR.
'ms-sys -m /dev/hda' will write an XP style MBR to your disk.
Remember that this utility deals only with the MBR.

For the windows bootsectors you must refer to other utils.

-
testdisk
I've tried testdisk to write new MBR code and it worked like a charm for me. What is also nice about it is that, when you go into advanced mode, you can also analyse the bootsector of the partitions and repair them if needed.

-
the Windows bootcd way
It might happen that none of these methods get you back into booting Windows, then there is one last method that you can try, which actually has nothing to do with TRK. Boot from the Windows XP cd and go to the recovery console. Make sure you know the password of the Windows system on the local disk. Otherwise, reset it first with 'winpass' on TRK.
-Now, once booted into the recovery console, it is a good thing to run checkdisk first:
'chkdsk c: /p'
-Next run 'fixboot'
-And finally run 'fixmbr'
-'exit' to reboot

-
if really nothing worked: FAT32
Finally, if nothing did the trick, it means something is wrong in some way, I don't know, your disk geometry was laid out, filesystem were created, etc, etc. Sometimes it is even a mystery to me why a Windows will not boot when everything else says that it should. However, it often happens after I have cloned a PC with clonexp or Partition Image. Sometimes it works, sometimes it does not.

In that case there is one last resort: recreate your Windows on a fat32 partition.
For documentation on that, see the section:
3.5 Manually cloning a Windows installation.

-ntfsreloc

Very handy tool if your bootsector geometry does not correspond to what the bios claims it to be (the bios is actually wrong). Yet Windows bootsector  finds it important it corresponds to the bios specifications.
This utility is invoked by mclone after cloning to make sure the bootsectors are exactly the same as they were (Linux adjusts them to LBA).

Here 's the help output of ntfsreloc 0.7:
adjust filesystem geometry for a NTFS partition
Usage: ntfsreloc [-h # -t #] [-s start [-b]] [-w] [-f] [-p] device
where device points to an NTFS partition

Options:
-w:        Write new start sector to the partition.
-h # -t #:    Specify number of heads and number of sectors per track
        If omitted, determined via ioctl.
-s start:    New start sector to write.
        If omitted, determined via ioctl.
-b:        Proceed even if the specified device is not a
        partition (e.g. a regular file)
-f:        Force the operation to occur even if device does not look
        like a valid NTFS partition or values are equal.
-p:        Print debug information (values read, values requested etc.)

This utility displays the current starting sector as defined by the
the filesystem.  No change will actually be made without the -w
option.

Exit status is 2 if an error occured, 1 if a change was made or is needed
or 0 if the filesystem already has the correct values.

 

Updated: July 28, 2010