Google Plus

How to Erase MBR In Linux

Written by Mel Kham on . Posted in Frequently Asked Questions

The Master Boot Record (MBR) is the information in the first sector of any hard disk or diskette that identifies how and where an operating system is located so that it can be boot (loaded) into the computer’s main storage or random access memory. The Master Boot Record is also sometimes called the “partition sector” or the “master partition table” because it includes a table that locates

each partition that the hard disk has been formatted into. In addition to this table, the MBR also includes a program that reads the boot sector record of the partition containing the operating system to be booted into RAM. In turn, that record contains a program that loads the rest of the operating system into RAM.

Question:

how to erase MBR in Linux ?

Answer :

# dd if=/dev/zero of=/dev/hda1 bs=512 count=1

 

bs = the first 512 bytes of the harddrive to remove the bootloader

For questions please refer to our Q/A forum at : http://ask.unixmen.com

Mel Kham

Founder of Unixmen, Living in Amsterdam. Am working in my free time to help people to understand the Opensource and to explain them in easy way how to make the fist steps to the the light. Working day and night with my Co-founder Zinovsky to keep this website live even with less resources.
  • shortbaldman

    If you use a figure of 512 bytes to be zeroed out, you will also zero out the disk’s partition table. The bs count needs to be less than 512 so that the partition table is retained. (I don’t have the actual figure with me at the moment. You should be able to Google for it.)

    • pirat9

      Tp wipe out the partition table also, change 446 to 512.

  • http://www.facebook.com/rbrockway Robert Brockway

    erasing 512 bytes like this will destroy the partition table.  set bs=446 to erase the boot loader and leave the partition table intact.

  • Pingback: Erase mbr | Figifoto

  • Piomar

    Shouldn’t the output be like this: of=/dev/hda not of=/dev/hda1 (the entire drive not the first partition)? Or it doesn’t matter?

    • creatron

      Please correct the above, the correct answer is indeed as suggested above
      dd if=/dev/zero of=/dev/sda count=1 bs=446

  • Andrew Ampers Taylor

    I have tried whole scripts trying to get my computer back, finally, I tried this in Live Ubuntu 13.05 and it workedd, after a small tweak.

    Just need to add sudo and a space before dd

    Thanks, you have evidently heard of the K.I.S.S. principle!

    Ampers

Like us on Facebook

This week Top Posts

Write for us

Recent Comments

Dominik Bauer

|

thx a lot!

Maximiliano Osorio

|

Osom. Thank you.

Sam

|

Thanks much. It worked like a charm.

HailsandNails

|

Actually, what I see too much of, and what Microsoft actually (sorta) did with Windows 8 is think forward. And let’s be brutally honest. Windows 8 is actually NOT as bad as people is making it out, they’re just freakishly afraid of change (which Linux users are as well, it seems)

SK

|

Yes i will. Keep visiting. Subscribe us to get daily updates. Thanks for the comment

 
IDG Tech Network
Copyright © 2008-2013 Unixmen.com .
Maintained by Anblik .