-
Junior Member
registered user
I am in hell, Trust me.
Sigh!
I have deleted the MBR. Yes i know, then everything is lost and unrepairable.
*BUT, the thing is that i have not yet booted my computer yet*.
When i do all will be gone forever, hda1, hda2, hda3, all of it. No harddisk recovery program will ever get the system back. I have (had?) a dualbootsystem that i have optimised for a half year or so. I feel sick when i think about it. But now everything works nice, i can access all partitions everything is still here, exept when i take a look on hda with qtparted. Then hda ofcourse is totally unreadable, because it tries to read from the actual master boot record (and not from memory and the post-booted info on disk.)
THE QUESTION :
Is there anyway that i can copy the data my computer is aware of right now when it still is unbooted and put it on the mbr? Something in the /boot folder? Anything that would make it possible to once more see that lovely Debian dualbootscreen once more? Can i make a startupdisk with the help of grub? And then copy the floppy to the hda bootblock?
How did this happend?
I was going to to copy a image of the mbr of my external drive to that very drive(sda1) but by fatal error i copied to hda. Adios partitions.
The limits of language fails to express how grateful i would be if someone could offer a glimpse of salvation out of this evil mess.
Thanks for reading this,
Björn.
-
Senior Member
registered user
Take some deep breaths and know that most of us can relate to this.
I have used this bootloader ( see link below ) to rescue systems I couldn't boot any other way
http://gujin.sourceforge.net/
My thought is if you can enter/boot the system with this bootloader you can
then create a floppy or reinstall grub from the running system itself.
I'm sure there are ways to do this with grub, at the command, line but my experiance
is mostly editing menu.1st. In fact I haven't found the grub command line to be so easy.
Good luck!
Note: It seems like most of the ideas put forth, after this post, focus on different tools which are fine.
But I'll just say that I have gujin on a floppy just for this type of situation and it never fails to boot a
reluctant system (as long as it's still there) I just like the lazy approach.
-
First, relax. Everything will be fine.
I've done the same thing before--accidentally overwritten my partition table but the rest of the files are there. Luckily there is a tool called gpart that can recover everything for you. When I give Knoppix talks, I actually purposely write zeros over my MBR with dd and then recover with gpart while the audience is watching. I go over the steps in my talk at http://greenfly.org/talks/knoppix_hacks/intro.html near the end, but here are the basic steps:
1) Open a terminal and type:
Code:
sudo gpart /dev/hda
2) The gpart program will scan your system for partitions and then recreate a partition table based on them. Check out what partitions it finds.
3) If you accept what it finds, run
Code:
sudo gpart -W /dev/hda /dev/hda
4) The -W option will write the new partition table onto /dev/hda, so run this when you are fine with what it says. If you see a minor discrepancy, don't edit it within gpart as it can get a bit complicated. I've found that it's easier to use cfdisk afterwards.
5) Run
Code:
sudo cfdisk /dev/hda
and check out your new partition table. You can make any changes you need to (I've noticed gpart doesn't always find the end of the partition correctly so it'll be a few megs off).
6) Try to get this far. I assume at this point that your partition table is restored. The next step is to restore the boot loader, but all of that depends on whether you use lilo or grub. You need to identify your root partition. Let's say it is /dev/hda2
7) Mount your root partition:
Code:
sudo mount -o rw /dev/hda2 /mnt/hda2
8a) If you use lilo:
Code:
sudo chroot /mnt/hda2 lilo
8b) If you use grub:
Code:
sudo chroot /mnt/hda2 grub-install /dev/hda
or if that doesn't work,
Code:
sudo grub-install --root-directory=/mnt/hda2 /dev/hda
9) reboot and everything should be normal
-
Administrator
Site Admin-
Re: I am in hell, Trust me.

Originally Posted by
Schopenhauer101
I have deleted the MBR. Yes i know, then everything is lost and unrepairable.
.....
When i do all will be gone forever, hda1, hda2, hda3, all of it. No harddisk recovery program will ever get the system back........
Not at all. The first question is just how did you delete the MBR, and did you delete just the MBR or the entire first sector?
If I recall right, The first sector of your hard disk contains both the mbr and the partition table. If you've just deleted the MBR (the first four hundred and some bytes of the sector), you can easily fix it. "FDISK /MBR" from the DOS command line is one way. You might also look at it as an excelent oppertunity to install Smart Boot Manager to the hard disk MBR; think of it as an upgrade with no down side risk.
If the entire first sector is blown, including that the partition table is gone, then you would need some way to rebuild the partition table. Turns out there's a handy linux command to do just that! It scans your hard drive, figures out where the partitions are and their type and size and recreates the table for you. If only I could remember the name of that command (but then what fun would Linux be without all of the cryptic commands that only geeks know?) Sadly, I'm sure the program is there but not as sure of the name, but you might look and see if there is a command called "gpart" or somethings very similar to that (I'm on Windows at the moment and can't boot Knoppix because of other things running that shouldn't be stopped) . And, of course, after fixing the partition table, you'll want to do one of the above to replace the MBR too.
Good luck and please post back to let others know how it goes (and what you did to kill the MBR in the first place).
-
Administrator
Site Admin-
Ah, I see that while I was typing greenfly posted and confirmed that it is gpart! Great.
-
Junior Member
registered user
Hi and thanx alot for your advices and concern. Well im writing this from a knoppix cd so i think that pretty much gives a clue about how my system (and nervous system too) is doing. Well everything isnt death and despair anyway after all.
Let me tell. First i burned a backup-cd of the entire /boot folder with grub and all inside. About 12 megs. Then i created a grub bootfloppy with stage1 and 2 whatever that is supposed to mean. then i downloaded and created a GAG boot disk. And then i found out something great. In the grub folder there is always a file called "boot.0300" That file is actually a mbr-image. I googled around a bit more and then after a while i felt secure enough to add the image to my hda. Then i opened qtparted again. YES, all partitions back again looking just the way they are supposed to.
Relifed i rebooted my decitefull little darling just too get struck by the famous 99 99 99 99 99 99 99 screen. Sigh. I inserted the grubdisk and it showed all that i wanted. But it couldnt launch linux, it complained about the stuff not being on my harddrive. I tried the GAG disk and reached a very limited grub shell. The XP partition worked however. I then used knoppix and found my linuxpartitions and everything on em to be alive.
If anyone knows how to make grub come alive again it would be great. I really miss my linux system and hope to be able to stay away from XP as much as possible exept when using my music/midi equipment.
Thanx for all help. The partition table seems to be ok, and if anyone knows how to get things working with grub it would be great help coz the stuff i get when i google is so contradictory.
Take care/
Bj;rn
-

Originally Posted by
Schopenhauer101
<snip>
If anyone knows how to make grub come alive again it would be great. I really miss my linux system and hope to be able to stay away from XP as much as possible exept when using my music/midi equipment.
Thanx for all help. The partition table seems to be ok, and if anyone knows how to get things working with grub it would be great help coz the stuff i get when i google is so contradictory.
Take care/
Bj;rn
Congrats! I bet you feel a lot better now. I'm glad you were able to find a backup copy of your MBR. The steps are slightly different since you have a separate /boot partition. Assuming your /boot partition is /dev/hda2 here is what you do:
1)
Code:
sudo mount -o rw /dev/hda2 /mnt/hda2
2)
Code:
cd /mnt/hda2; sudo ln -s . boot
this creates a recursive symlink called boot, as the grub-install tool expects to be pointed to a directory that contains a boot directory inside.
3)
Code:
sudo grub-install --root-directory=/mht/hda2 /dev/hda
this should restore grub completely to your boot code.
4) Reboot and hopefully you should see your old grub menu.
-
Junior Member
registered user
Thank you, really!!! When shit like this kind of crashes happens i wonder why i bother to care about linux or even computers in general. But when i get suprised the other way around, by the effort, friendliness and solidarity from people stuck in the linux swamp im really quick to re-remember why it fun and worth it.
I will try out to reinstall grub but im first going to check out the smart boot manager, just because ive never tried it before. I do not by the way have a separate boot partition. I got a boot folder under / on hda. Should that make anything very different from what you recommended?
Take care, and thanx once more.
/Bj0rn
-
If /boot is under your root partition and not on a separate partition, you can simply skip the step that makes a boot symlink inside your /boot directory.
-
Junior Member
registered user
Thanx for all help!
This is a great forum. Everythings works fine. This night i will browse around the forum and see if i can help some people that got some very newbie questions:
Take care all.
/Björn
Similar Threads
-
By sakiZ in forum Hdd Install / Debian / Apt
Replies: 5
Last Post: 12-02-2006, 02:58 AM
-
By dvryknopper in forum General Support
Replies: 1
Last Post: 03-16-2006, 09:59 PM
-
By fcamisa in forum Hardware & Booting
Replies: 0
Last Post: 06-24-2004, 12:58 PM
-
By Arkaein in forum Hdd Install / Debian / Apt
Replies: 12
Last Post: 03-30-2004, 04:00 AM
-
By Jackson5 in forum General Support
Replies: 6
Last Post: 05-30-2003, 05:02 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules

Kingston 32GB 64GB 128GB 256GB USB 3.0 Flash Drive Thumb Memory Stick Pen lot
$285.90

SK Hynix 32GB 4Rx4 PC4-2133P-LD0-10 HMA84GL7MMR4N-TF TD DDR4 Server Memory RAM
$110.00

TF/SD Card Adapter Camera Reader Android Type-c For iPhone17 Pro Max Plusm lot
$573.98

RAMAXEL Lenovo 32GB LPDDR5X CAMM2 7500MHz Laptop RAM | UNTESTED
$445.00

Lot Of 16 X 16GB ECC DIMM Server Memory SK Hynix HMA42GR7MFR4N-TF PC4-17000 DDR4
$800.00

Lot of 20 SK Hynix 32GB 2Rx4 PC4-3200AA ECC DDR4 RAM HMA84GR7DJR4N-XN
$5300.00

USB 3.0 Flash Drive 32GB 64GB 128GB Memory Stick Thumb Stick Lot Pack
$826.09

SAMSUNG 64GB 4dRx4 PC4-2666V-LD2 DDR4 ECC SERVER RAM M386A8K40BM2-CTD7Y
$300.00

128GB (8x16GB) DDR4 PC4-2133P-R ECC Server Memory RAM Upgrade HPE Z640
$516.26

1 PC MS 2024 Office USB STANDALONE COMPLETE FULL VERSION PACK
$69.99