MBR/ Partition Table

On my dual boot system, I accidentally formatted (i know i should have been careful!) my /dev/sda1 on which windows was installed.Somehow when i try to reinstall it, i get a “invalid partition table” error.So i restore the bootloader from my opensuse dvd (repair option)and boot into linux.
fdisk -l returns the following:

Disk /dev/sda: 80.0 GB, 80026361856 bytes
240 heads, 63 sectors/track, 10337 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Disk identifier: 0xe010e010

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        2709    20480008+   7  HPFS/NTFS
/dev/sda2            2710        5418    20480040    7  HPFS/NTFS
/dev/sda3            5419        8127    20480040    7  HPFS/NTFS
/dev/sda4   *        8128       10338    16707600    f  W95 Ext'd (LBA)
/dev/sda5            8128        8330     1534176   82  Linux swap / Solaris
/dev/sda6            8331       10338    15173361   83  Linux

As you can see, /dev/sda1 does not have the boot flag set.Is that the reason i am not able to install M$ on it?Is it possible to tell where the partition table and MBR are currently residing?

When you boot the XP cd it should show you that ntfs partition in the install setup
Or is this Vista? In which case what I had to do was use an XP cd to format the partition to ntfs (I know - it already is). Typical M$

Then Vista will install

Yes, it is winXP and the setup does detect the partition.After copying the setup files, when it asks for a reboot.I remove the CD and press enter.When it reboots,i get “invalid partition table”. This is what made me think XP is looking for a bootable /dev/sda1(i.e C drive) while the fdisk output shows otherwise.

If i leave the CD in the drive, the whole process repeats:
Install setup–>reboot–>invalid partition table

I even deleted C, reformatted it (all insided the XP setup program) and tried, all in vain…

If you no longer intend to have grub manage booting then you need to make active the sda1 partition with the bootable flag. Use a utility disc like parted magic to do that.

Otherwise once windows has installed - reinstall grub using the SUSE dvd. And make an entry in if necessary in /boot/grub/menu.lst

title Windows bootloader menu # <-- put whatever you want here
    rootnoverify (hd0,0)
    chainloader (hd0,0)+1

This assume sda1 is the actual XP partition if it’s sda2 or sda3 then the code above changes to hd0,1 or hd0,2 respectively.

Have a look at the fdisk table you posted. The presence of the asterisk beside sda4 is preventing xp from installing properly.

Sda4 is the extended partition (a “container” for the logical partitions sda5 and sda6). The asterisk beside sda4 is the boot flag which marks it as the bootable partition. Windows xp requires the bootable partition to be the first partition – but Suse installer has shifted the flag to partition 4. You must shift it back again. Here’s how:

Boot into Suse and open a console window and enter su to become the root user. Then enter cfdisk, and a screen showing the partitions will open. Be very careful not to delete any partitions or to damage the filesystems. The only thing you want to de here is move the “boot” flag from beside sda4 to beside sda1.

Vertical arrows will shift focus from one partition to another. Navigate to sda4. Tab key will navigate you among the options listed at the bottom. Tab to the [Bootable] option. Press enter and you can toggle the boot flag on and off for sda4. Toggle it off. Then navigate to sda1 and toggle the boot flag on for sda1. Then Tab to the [write] option and press enter. Then tab to the [quit] option and press enter.

OK, before you leave Suse you must adjust the bootloader to accommodate the changed boot flag. Go to Yast → System → Bootloader and click the tab labelled “Boot Loader Installation” and select to “Boot from the Master Boot Record”. Deselect any options to boot from other partitions like sda4. Then click Finish to save the changes and install the reconfigured Grub into the hard drive’s MBR.

I hope that’s the problem. Let us know if it’s not.

Now you can install windows. Most likely it will replace the green Grub boot screen with windows boot screen but that’s a smallish tweak and we could discuss that when and if you get that far.

Sorry for the late reply.
I tried to execute cfdisk as root but it gives me the following message:

FATAL ERROR: Bad primary partition 3: Partition ends in the final partial cylinder.Press any key to exit cfdisk 

I have attached a screen screenshots of the MBR installation from the repair setup from the suseDVD. Perhaps u could say the right choices i have to make in it:
1.ImageShack - Image Hosting :: 17978645.jpg
2.ImageShack - Image Hosting :: 92378133.jpg

Else may be some other way to toggle the boot flag for /dev/sda1 ?

Update:I made /dev/sda1 as bootable and cleared the flag for /dev/sda4 using parted.In spite of that got the same old grub screen showing suse and failsafe options.So i kept pressing Esc until i got to grub and gave a rootnoverify (hd0),chainloader +1 and boot.Voila, XP installation started.

After reboot,XP was again not getting detected.So i had to add the above commands to menu.lst. Now all is fine.

Interestingly, i think this is a makeshift solution 'cause cfdisk still returns error and parted still displays:

ravionlinux:/home/ravi # parted
GNU Parted 1.8.8
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: ATA HITACHI HTS54328 (scsi)
Disk /dev/sda: 80.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
 1      32.3kB  21.0GB  21.0GB  primary   ntfs         , , , , , , , , , type=07, ,
 2      21.0GB  41.9GB  21.0GB  primary   ntfs         , , , , , , , , , type=07, ,
 3      41.9GB  62.9GB  21.0GB  primary   ntfs         , , , , , , , , , type=07, ,
 4      62.9GB  80.0GB  17.1GB  extended               boot, , , , , , lba, , , type=0f, ,
 5      62.9GB  64.5GB  1571MB  logical   linux-swap   , , , , , , , , , type=82, ,
 6      64.5GB  80.0GB  15.5GB  logical   ext3         , , , , , , , , , type=83, ,


.So boot partition is still sda4.I am still confused:if MBR is in sda1, how does /dev/sda4 get called?
Where is grub installed?
Even though i made sda1 bootable through parted, how i did i get the grub screen as mentioned above ?My only guess is grub overrides all boot flag options and goes according to whatever is there in menu.lst

MBR is a section of the drive before any partitions. So MBR is not on sda1 or sda4 or anywhere else but the first track of the drive, separate.

The code in the MBR says to look for the bootable flag. That’s on sda4 I think, depending which pics are current. Sda4 has a pointer to the file menu.lst located at /boot/grub/menu.lst. Thats’s the method ATM.

So i kept pressing Esc until i got to grub and gave a rootnoverify (hd0),chainloader +1 and boot.Voila, XP installation started.
But does the installation complete?

Yes it is complete.But like i said i had to manually add the details to menu.lst.

Well, Yes. That is what I said earlier
MBR/ Partition Table - openSUSE Forums