LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Is it safe for me to delete the MBR on my HDD? (https://www.linuxquestions.org/questions/linux-general-1/is-it-safe-for-me-to-delete-the-mbr-on-my-hdd-591170/)

Vegetaman 10-11-2007 05:31 PM

Is it safe for me to delete the MBR on my HDD?
 
Windows XP SP 2 just crashed brutally on me and it keeps saying my MBR is corrupt. Well I tried installing linux over it, but it doesn't seem to want to take, and I think that I need to delete my MBR and then just install Linux. And /fixmbr didn't really do the trick...

I don't have any data on this drive that I am in fear of losing, it is pretty much just a blank 160GB Western Digital 7200 Caviar SE hard drive. If I delete the MBR, will I be borking my drive permanently (like actual damage to it), or will installing Windows XP or whatever distro of Linux put something back into the MBR and my drive should work again?

Also, I was going to use DBAN to do this, as I assume it will delete my MBR?

I intend to do this over the next day or two, because I really want to get my computer back up and running again.

custangro 10-11-2007 05:34 PM

1) Boot into Windows Installation Disc
2) When It asks you what kind of installation you want type "R"
3) When you are in the recovery console type: "fixmbr" then "fixboot"
4) Reboot and take out the Installation disc

matthewg42 10-11-2007 05:39 PM

As I understand it, when you try to install Linux, if you install a boot loader into the MBR, any existing data there will be over-written, effectively erasing it and installing what is necessary to boot Linux. Many installers at least check if you want to do this, and some offer other options like making a boot floppy.

If that part of the drive is so corrupt that data written to it cannot be later read, then you will not be able to boot from the hard disc. Any corruption like this is not a good sign for the drive, and it's generally good advice to replace it (since failures can cascade across the disc over time, spreading from the bad parts to corrupt fresh data, and ALWAYS at the worst possible moment).

You could write your boot loader files to a floppy, and boot with that in the machine, which then instructs the boot to continue from the partition rather than the MBR... this way the floppy/USB key will be necessary to boot but if the rest of the disc is OK you should be able to use it.

Vegetaman 10-11-2007 06:27 PM

Okay, now I went back to try and reinstall Windows via XP SP 2 and it tells me that it cannot format my drive because it may be damaged and then some blah-blah about SCSI devices...

I suppose my hard drive is probably dying, then, and I should get a new one? D:

matthewg42 10-11-2007 06:35 PM

It doesn't sound very good. Unless you made some sort of hardware change which might cause the BIOS to mis-identify the drive, I think it sounds like it is dying. Try booting from a live CD and see if you can recover anything that way.

syg00 10-11-2007 07:33 PM

When I have issues like that, and I can't get at the disk from a liveCD, I take the disk out and try it in another box. Eliminates issues like bad cable, controller chip dying, that sort of thing.
If you can get the data off, go ahead and scrub the disk - if not, toss it in the bin.

Scrubbing the MBR is "safe" - I have successfully re-installed both Windoze XP and recent Linux after testing a zeroed MBR. Older versions may or may not work.

Vegetaman 10-11-2007 09:08 PM

Currently booting and nuking and then will delete MBR and try one last reinstall. I don't know what happened but I think my hard drive is giving up the ghost. I have an alternate hard drive I am going to try in this box, since I don't have another computer to try it in.

saikee 10-12-2007 08:36 AM

I would say it may not be safe to delete a MBR but it is safe to let another or the same boot loader overwriting it.

Reason : The MBR has the partition table embedded in the last 66 bytes (4 partitions each 16 bytes + 2 spare bytes). Unless one knows how to delete the correct portion of the MBR the accidental removal of the partition table can render the disk unusable, at least temporarily. I have not come across any standard command to delete the MBR too.

Observed practice : Every PC boot loader can restore its MBR and always keeps the partition table intact. Thus it is safe to let one MBR overwrite the other using the system's own command.

Finally the MBR, less the partition table, is replaceable. It is the interior of the partitions that is of value and should be protected and should have a back-up. The MBR is the first sector of the hard disk and is only 512 byte large. If a user keeps a copy of the partition table then the entire MBR is dispensible. The destruction of the partition table only destroys 64 bytes but the partitions' interior is not touched. Therefore the MBR can be retored and the partition table can be rebuilt without any consequence. Done this a lot of times.

---------------------------------------------------

It is common for an operating system to reject a hard disk if it cannot cope with the error in the partition table. If an operating system reads a hard disk then unofficially it implies that the integrity of the data can be guaranteed. Most OS opt for not touching it than trying to solve the problem.

Linux is superior in handling hard disks because of its rich set of Bash commands. When other systems cannot cope with a hard disk with big problem in the partition table "cfdisk" could normally still be able to read it. If all others fail then Linux's last line of defence is "fdisk" . From my experience while all others refusing to touch a dodgy disk Linux's fdisk will still handle the disk, reports the problem and most importantly can be use to delete the dodgy partitions and to bring back a healthy disk again.

If Linux's fdisk refuse to read the disk then in my experience that disk is likely to have a mechanical/hardware problem and on its last leg to a junk yard.

Try this command when everything fails
Code:

fdisk -l
If you see an output then fdisk is usable for changing the partition table.

To rescue a hard disk with an accidentally delected or partially deleted a partition table use "testdisk"

Vegetaman 10-13-2007 06:33 PM

Well I ran western digital's utility and it said my disk was 100% fine. I ran windows XP SP 2 reinstall and it won't touch my disk because it says it may be damaged. I ran Darik's Boot And Nuke (DBAN) and it craps out towards the very end saying "DBAN finished with non-fatal errors" and says something about bad sectors.

I will see what I can do with Linux, now.

saikee 10-13-2007 07:00 PM

Let's see if it is true that Linux can reach the parts that Windows can't.

Hard disk manufacturer utilities have no interest in the filing system and conduct test mainly on the hardware. Many of their utilities software are just Dos programs.

Vegetaman 10-13-2007 07:35 PM

Well Linux did detect something wrong with my partition table, and it fixed it. I went on to install Slackware 12...

But when I got done and tried to boot linux, it came up and said "uncompressing linux..."

And then after a few more seconds "crc error - system halted!".

I am about ready to try a new hard drive.

syg00 10-13-2007 08:24 PM

Maybe run badblocks over it - preferably from fsck. See the man pages.


All times are GMT -5. The time now is 12:38 AM.