LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Wiping MBR progra,? (https://www.linuxquestions.org/questions/linux-software-2/wiping-mbr-progra-341687/)

JoshR 07-09-2005 05:03 PM

Wiping MBR program?
 
Here's what I want to do:

Sometimes I just want to wipe all partitions, MBR, and start from scratch.

The reason is that I play a lot with different OS's, including Linux.

What I'm doing now is using a debug script found in Win98SE Start-up disk, and forcing int 13 to start over, thus forcing fdisk to start fresh with the MBR.

Questions:

Since Dos doesn't read a Linux partition, am I wiping those, too? (are Linux partition tools fdisk based?)

I'm now using Darik's Boot and Nuke (written in Linux), but it takes a LONG time> Any thing else out there?

Anybody steer me to a way to write the debug script in a batch file, put it on a boot disc, and have it operate on auto? Will this even work on Linux?


My MBR is corrupted right now, and I'm a bit puzzled.........(naturally I messed up and let some lilo go there, or maybe Grub, or maybe GAG:)

Thanks for any guidance

JR

macemoneta 07-09-2005 05:24 PM

If you want to wipe the MBR, boot your favorite linux rescue disk and:

dd if=/dev/zero of=/dev/hda bs=512 count=1

Of course, replace "/dev/hda" with the drive whose MBR you want to wipe. This command will write one 512-byte block of binary zeros onto the specified drive in the first record (the MBR).

JoshR 07-09-2005 06:05 PM

Thanks Mac!

<gulp> I actually just found out the same thing using google. Although I tried it about a zillion times on the same subject. Maybe google is putting their *paid* subscribers to the front, heh?

anyway, here's the link....

http://www.linuxgazette.com/issue63/okopnik.html

I'm going to get a copy of Tom's boot disk and try it right now! And thanks again.

BTW, appparently the debug script also works in dos.

JR

XavierP 07-09-2005 06:10 PM

If you have a Win98 start up disk, why didn't you just boot from it and run fdisk /mbr? That would have replaced the existing mbr with a clean, new one. Also, the DOS fdisk (fdisk) command will wipe Linux partitions - they will show up as non-DOS, but are still wipeable.

JoshR 07-10-2005 01:20 AM

Quote:

Originally posted by XavierP
If you have a Win98 start up disk, why didn't you just boot from it and run fdisk /mbr? That would have replaced the existing mbr with a clean, new one. Also, the DOS fdisk (fdisk) command will wipe Linux partitions - they will show up as non-DOS, but are still wipeable.
Well, I did investigate this a few years ago. IIRC, fdisk /mbr simply rewrites a dos/win/xp version and doesn't wipe it. I forgot the problems it didn't fix.....but I think it used another copy stored on the drive.........so, I got ANOTHER windows mbr. The problems? Well, I was re-installing XP or something from an OEM disc and it wouldn't allow it. Also some third party boot managers wouldn't work. Also, any mbr virus stays...........Plenty of reasons to want to really wipe it. What's your experience? Plenty of people I know say it won't do anything except restore what was on it. Which is what I didn't want, naturally.

JR

JR

XavierP 07-10-2005 03:53 AM

Whenever I have used it, fdisk /mbr wiped the mbr clean and I could then start again. Many many people on LQ have used it.

syg00 07-10-2005 04:32 AM

Why does this keep coming up - don't people know how to search ???.
First up, the first sector on the primary disk (usually called the MBR) consists of exectable boot code, the partition table, *and* a 2 byte signature - it is NOT just boot code.

- MBRs rarely (if every) need wiping. A virus might be a reason.
- re-installing a boot-loader (any boot-loader) will invalidate the previous incumbent - including viruses. There is no need to erase first.
- there is no need to erase partitions - in fact generally there's probably no need to even delete them.
- formatting or mkfs will effectively erase a partition. Much quicker - unless you have security requirements to meet DoD specifications. In which case you shouldn't be asking here.
- do *NOT* use the above dd command. See this for some tests I did.

JoshR 07-10-2005 11:51 AM

Quote:

Originally posted by syg00
Why does this keep coming up - don't people know how to search ???.
First up, the first sector on the primary disk (usually called the MBR) consists of exectable boot code, the partition table, *and* a 2 byte signature - it is NOT just boot code.

- MBRs rarely (if every) need wiping. A virus might be a reason.
- re-installing a boot-loader (any boot-loader) will invalidate the previous incumbent - including viruses. There is no need to erase first.
- there is no need to erase partitions - in fact generally there's probably no need to even delete them.
- formatting or mkfs will effectively erase a partition. Much quicker - unless you have security requirements to meet DoD specifications. In which case you shouldn't be asking here.
- do *NOT* use the above dd command. See this for some tests I did.

Why does this keep coming up? Well, it seems obvious with your link...

You wrote "this is crap-programming. I'll submit a bug report..........."

Plus, most are generally not as expert in this area as you seem to be. There appears to be differences of opinion on what to do/why/ and how..........

I DID, however use Nuke and Boot on my other box. I have no idea if I can partition and format due to the "bug" in fdisc. has it been fixed? Also, one experiment I did last week involved formatting over a previous install (mandrake) and installing Debian. When it booted, it had Mandrake's screen in with Deb's logo ovverlayed (is this a word)? Weird stuff.

And yes, I searched this forum with all the keywords I could think of previous to the post........

JR

JoshR 07-10-2005 12:02 PM

OH, one more example...........

While trying to format previous built partitions with QTParted (found on CD rescue CD) the prog wouldn't touch other installs. That's right, it was designed to never remove any other Linux install. I think this is the reason I was looking to wipe the MBR.........(and about that 2 byte sig on the MBR) WHO use that and why? Just an identifier?

JR

JoshR 07-10-2005 01:07 PM

Update:


Since I ran "nuke and Boot" yesterday, I tried to use PqParted today to partition and reformat to better arrange my HD to my liking

So what happened? Nothing, Wouldn't work. so it indeed appears that using the dd command in Linux, or Nuke and Boot erases EVERYTHING, and some things that fdisk, etc requires in order to work.

I then tried to load my XP OEM to use fixmbr. No joy. Wouldn't load. Tried my XP start-up disk. No joy. No fdisk included apparently.

Next, I loaded the 98SE start-up and ran "fdsik /mbr". After that Qtparted worked fine (except it found an 8 gig partition (unknown format) I had to delete first)

Can anyone explain what happened here?? And maybe make it a sticky thread? That way, this topic wouldn't come up so much and everybody could leave their attitude at home:D

JR


All times are GMT -5. The time now is 12:41 PM.