LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   help - MBR wiped out (https://www.linuxquestions.org/questions/linux-general-1/help-mbr-wiped-out-159609/)

linuxify 03-18-2004 07:53 PM

help - MBR wiped out
 
hi,
my computer had been configured to multiboot into winme, xp and mandrake linux. yesterday, i tried installing mandrake 10 on a seperate newly created partition (was unpartitioned before) and wrote the bootloader to the MBR instead of a floppy - i was only installing it to play with it a bit.
When I tried to reboot back into windows, all I saw was a blank screen with the cursor blinking in the top corner. I then rebooted back into mandrake 9.2 from the cd - rescue. and re-installed the MBR. I still couldnt get into windows...

I have quite a complex partition scheme created over the years... :(
/dev/hda - 40GB
/dev/hda1 - c:
/dev/hda5 - d: -- windows me
/dev/hda6 - linux ext3 - root
/dev/hda7 - linux swap
/dev/hda8 - /usr
/dev/hda9 - /var
/dev/hda10 - /home
/dev/hda11 - fat32
/dev/hda12 - fat32
/dev/hda13 - ntfs -- windows xp
/dev/hda14 - fat32 -- important data
/dev/hda15 - fat 32
/dev/hda16 - linux ext3 -- mandrake 10

the reason the partition table is so crazy is due to me re-partitioning existing partitions to make space for windows data over the years.

With my ML 9.2 back, I then proceeded to reinstall the boot information on drive c: (/dev/hda1) from old ME starup disk, which I now believe had a boot sector virus.
I tried deleting the /dev/hda1 and recreating it. When I rebooted... nothing. upon further checking fdisk shows *only* the recreated /dev/hda1 (fat32)

a backup of the MBR i have is also very outdated. and unfortunately, my last data backup is over a month old. and i have been working on an important project over the last few weeks.

after some research on the web about gpart, i ran it. it shows all the old partitions correctly during the scanning, but then spits out information about 4 primary partitions which dont look right at all. I could recreate the partitions in fdisk, but the problem is gpart shows partitions in MB. Is there a utility that will show me the partition boundaries in sectors....

thanks in advance

Pauli 03-18-2004 08:08 PM

My advice, which may not be right, would be to get knoppix or something similar and get all of your files. Then FORMAT all of it. Your system looks cluttered like crazy to me, you have like 10 partitions! Thats just stupid, no offense here, but you want at max 4 partitions on a 40 gig HD. No more. I have 2, well three with the swap but that dont count.

linuxify 03-19-2004 12:28 AM

i tried knoppix, but as the MBR only has knowledge of /dev/hda1 - fat32, nothing else. Its no use.

ok, adding -v to gpart gives me more detailed info. e.g: an excerpt for the gpart log:-

Possible partition (DOS FAT), size(2008mb), offset (1529mb)
type: 006(0x06) (Primary 'big" DOS (> 32MB))
size: 2008mb #s(4112577) s(3132738-7245314)
chs: (195/1/1)-(450/254/63)d (195/1/1)-(450/254/63)r
hex: 00 01 01 C3 06 FE 7F C2 42 CD 2F 00 C1 C0 3E 00

this shows the start and end sector of the partition along with the size and also the start and end cyl. Can anyone tell me what the hex: line means.

Also, looks like had created more than one primary partition. I just wanted to know if the order of the primary and extended partitions matter. (when i first bought the pc, 40 gb looked like a lot and i did not (unknowingly) use the full size for the extended partition. And as its been over 3 years i dont remember exactly what i did :(

The entry for the extended partition does not cover the remainder of the entire disk (as I vaugely remember creating it like that)
So if a primary partition is created and then an extended partition followed with another primary, will it matter? or do the primaries need to created sequentially first, followed by the extended one last.
I will be creating the partitions according to the sector numbers.

am I proceeding on the right track ????

P.S. I promise to reformat the entire disk and have just 3/4 partitions *AFTER* I (hopefully) get my old partitions and data back.

Should i include the output of gpart for some guru to better understand what i'm talking about....

thanks again guys, I know I'll receive the correct guidance here.

linuxify 03-19-2004 04:19 AM

Solved. I was able to carefully build the partition table with the partition info from gpart. Now I can actually mount the data partition. will back up ASAP.

Still having trouble with c:, "no boot signature found", any solutions???

AutOPSY 03-19-2004 04:26 AM

work on it the best you can.
Obviously there is no shure fire solution to someone else helping you fix a drive that has overlapping partitions and such.

Still having trouble with c:, "no boot signature found", any solutions???

Where did you see that anyways? using fschk?

JZL240I-U 03-19-2004 06:44 AM

A DOS diskette with fdisk (Microsoft) should do the trick -- or possibly a rescue CD of a 16 bit Windows. Start it and type
Code:

fdisk /mbr
at the prompt. That will write a new MBR.

linuxify 03-19-2004 04:18 PM

tks for all the replies.

just wondering - will 'fdisk /mbr' overwrite the mbr and i loose mbr and lilo. it doesnt matter much as i plan on reinstalling linux/windows anyway....

thanks once again.

linuxify 03-20-2004 07:44 PM

hi again,

ok I rebuilt the partition table, tks to gpart and testdisk. I also backed up my data, after re-installing linux.

Now, I seem to be back at the same problem. Windows does not boot. I did a 'fixmbr' , 'fixboot' and 'bootcfg /rebuild', but when I try to boot into windows it still says 'Disk error'.

what can I do to make c: bootable to boot into winxp. I really dont want to reinstall XP. WindowsME Fdisk does not show an of the logical partitions...

I'm going to try and get a win95b boot disk and do a 'format c:/s' then try to 'bootcfg /rebuild', hope it works.

any suggestions.. . guys?

TIA

linuxify 03-20-2004 08:20 PM

i downloaded a windows 98 boot .img file and did format c: with a /s. I was able to boot into dos and it says cannot load command.com and asks for the complete path to it. giving 'C:\command.com' does not seem to work.

I then went back into linux using 'rescue' and tried to reinstall boot loader and it says cannot find root device. lsparts shows the partitions are all screwed up again.

Looks like I may still have a boot sector virus. I currently do not have access to a windows PC. what can do to make sure I do not have a boot virus and if I do how do I get rid of it.

I can rebuild the partition table and get linux to boot up again. but I really need to get back to my work in windowsxp (i'm in the middle of something really important.)

I need to get this problem sorted out ASAP. Please help me out.
thanks.

Pauli 03-21-2004 11:32 AM

Well. There is a little tool which comes with Slackware, it is bootmgr. It allows you to with a 3 1/2 floppy to change the drives about. Your windows one MAY be hidden, I do not know, but try it out. You can make other partitions hidden, read only etc etc. It is a useful tool, I cannot post it, for I do not have my Slack disks with me, but it is a rawwrite image so in linux you should be able to write it.

And then, I would hide all linux partitions (Maybe) and see if it will boot into windows. Try that, when I get back to my flat I will try to host the image so you can get it. I think you can also make the partitions bootable with this tool, but I am not positive. If worse comes to worse, many installers with linux (such as the one for Peanut linux) comes with a tool that allows you to set your drives as bootable or not. If I recall the name of it I will tell you, but all I remember is that is was in the installer for peanut.

linuxify 03-21-2004 02:01 PM

Thanks Pauli, I would add that to my newly created toolkit... :)

The ML rescue 'lsparts' would always show hda1 as type (0xffffffff) unknown', but fdisk show the same as FAT32. I rebuilt the partitions and this time made /dev/hda1 type FAT16. All this time it was FAT32.

I got my hands on a Win95b boot disk and 'Fdisk /mbr' followed with a Format c:/s' seems to have done the trick. I reinstalled the linux bootloader and all seems to be back to normal - i.e can boot into linux and windows. :)

I reduced the no of linux partitions to 2 from 4. My WinXP drive changed from F: to E: Now to the odd part - I did fixboot and bootcfg /rebuild, copied NTLDR and Ntdetect.com to the correct place. When I rebooted into windows I was taken directly to the Windows XP setup - (detecting devices). I *had* to complete the install ( tried rebooting and checked boot.ini).

But now none of the XP progs work (I guess they still reference F: /dev/hda8) I can rectify that, but the other problem is - It takes almost 15-20 mins to get from the XP login/password screen to a functional desktop. There is *no* way to change the system drive letter in XP. I also interchanged hda8 with hda9 in fdisk, no luck.
God, I just hate M$, cant they just get anything to work the way it should without screwing the consumer.

Maybe, I'll just have to fresh install XP :(.

FYI. There are just 2 reasons I go to windows - MS Office and TV-guide (+no ugly fonts prob)!!!! I cant wait for the day when: OpenOffice can read my MSOffice docs *and* preserve the same formatting..... And wine can run the few win progs without a hitch....


All times are GMT -5. The time now is 07:00 PM.