Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!
Showing posts with label mbr. Show all posts
Showing posts with label mbr. Show all posts

Saturday, May 25, 2013

Basic and Dynamic Disks

msdn.microsoft.com/en-us/library/windows/desktop/aa363785%28v
Before partitioning a drive or getting information about the partition layout of a drive, you must first understand the features and limitations of basic and dynamic disk storage types. For the purposes of this topic, the term volume is used to refer to the concept of a disk partition formatted with a valid file system, most commonly NTFS, that is used by the Windows operating system to store files. A volume has a Win32 path name, can be enumerated by the FindFirstVolume and FindNextVolume functions, and usually has a drive letter assigned to it, such as C:. For more information about volumes and file systems, see File Systems.
In this topic:
There are two types of disks when referring to storage types in this context: basic disks and dynamic disks. Note that the storage types discussed here are not the same as physical disks or partition styles, which are related but separate concepts. For example, referring to a basic disk does not imply a particular partition style—the partition style used for the disk under discussion would also need to be specified. For a simplified description of how a basic disk storage type relates to a physical hard disk, see Disk Devices and Partitions.
Basic Disks
Basic disks are the storage types most often used with Windows. The term basic disk refers to a disk that contains partitions, such as primary partitions and logical drives, and these in turn are usually formatted with a file system to become a volume for file storage. Basic disks provide a simple storage solution that can accommodate a useful array of changing storage requirement scenarios. Basic disks also support clustered disks, Institute of Electrical and Electronics Engineers (IEEE) 1394 disks, and universal serial bus (USB) removable drives. For backward compatibility, basic disks usually use the same Master Boot Record (MBR) partition style as the disks used by the Microsoft MS-DOS operating system and all versions of Windows but can also support GUID Partition Table (GPT) partitions on systems that support it. For more information about MBR and GPT partition styles, see the Partition Styles section.
You can add more space to existing primary partitions and logical drives by extending them into adjacent, contiguous unallocated space on the same disk. To extend a basic volume, it must be formatted with the NTFS file system. You can extend a logical drive within contiguous free space in the extended partition that contains it. If you extend a logical drive beyond the free space available in the extended partition, the extended partition grows to contain the logical drive as long as the extended partition is followed by contiguous unallocated space. For more information, see How Basic Disks and Volumes Work.
The following operations can be performed only on basic disks:
  • Create and delete primary and extended partitions.
  • Create and delete logical drives within an extended partition.
  • Format a partition and mark it as active.
Dynamic Disks
Dynamic disks provide features that basic disks do not, such as the ability to create volumes that span multiple disks (spanned and striped volumes) and the ability to create fault-tolerant volumes (mirrored and RAID-5 volumes). Like basic disks, dynamic disks can use the MBR or GPT partition styles on systems that support both. All volumes on dynamic disks are known as dynamic volumes. Dynamic disks offer greater flexibility for volume management because they use a database to track information about dynamic volumes on the disk and about other dynamic disks in the computer. Because each dynamic disk in a computer stores a replica of the dynamic disk database, for example, a corrupted dynamic disk database can repair one dynamic disk by using the database on another dynamic disk. The location of the database is determined by the partition style of the disk. On MBR partitions, the database is contained in the last 1 megabyte (MB) of the disk. On GPT partitions, the database is contained in a 1-MB reserved (hidden) partition.
Dynamic disks are a separate form of volume management that allows volumes to have noncontiguous extents on one or more physical disks. Dynamic disks and volumes rely on the Logical Disk Manager (LDM) and Virtual Disk Service (VDS) and their associated features. These features enable you to perform tasks such as converting basic disks into dynamic disks, and creating fault-tolerant volumes. To encourage the use of dynamic disks, multi-partition volume support was removed from basic disks, and is now exclusively supported on dynamic disks.
The following operations can be performed only on dynamic disks:
  • Create and delete simple, spanned, striped, mirrored, and RAID-5 volumes.
  • Extend a simple or spanned volume.
  • Remove a mirror from a mirrored volume or break the mirrored volume into two volumes.
  • Repair mirrored or RAID-5 volumes.
  • Reactivate a missing or offline disk.
Another difference between basic and dynamic disks is that dynamic disk volumes can be composed of a set of noncontiguous extents on one or multiple physical disks. By contrast, a volume on a basic disk consists of one set of contiguous extents on a single disk. Because of the location and size of the disk space needed by the LDM database, Windows cannot convert a basic disk to a dynamic disk unless there is at least 1 MB of unused space on the disk.
Regardless of whether the dynamic disks on a system use the MBR or GPT partition style, you can create up to 2,000 dynamic volumes on a system, although the recommended number of dynamic volumes is 32 or less. For details and other considerations about using dynamic disks and volumes, see Dynamic disks and volumes.
For more features of and usage scenarios for dynamic disks, see What Are Dynamic Disks and Volumes?.
The operations common to basic and dynamic disks are the following:
  • Support both MBR and GPT partition styles.
  • Check disk properties, such as capacity, available free space, and current status.
  • View partition properties, such as offset, length, type, and if the partition can be used as the system volume at boot.
  • View volume properties, such as size, drive-letter assignment, label, type, Win32 path name, partition type, and file system.
  • Establish drive-letter assignments for disk volumes or partitions, and for CD-ROM devices.
  • Convert a basic disk to a dynamic disk, or a dynamic disk to a basic disk.
Unless specified otherwise, Windows initially partitions a drive as a basic disk by default. You must explicitly convert a basic disk to a dynamic disk. However, there are disk space considerations that must be accounted for before you attempt to do this. For more information, see How To Convert to Basic and Dynamic Disks in Windows XP Professional.
Partition Styles
Partition styles, also sometimes called partition schemes, is a term that refers to the particular underlying structure of the disk layout and how the partitioning is actually arranged, what the capabilities are, and also what the limitations are. To boot Windows, the BIOS implementations in x86-based and x64-based computers require a basic disk that must contain at least one master boot record (MBR) partition marked as active where information about the Windows operating system (but not necessarily the entire operating system installation) and where information about the partitions on the disk are stored. This information is placed in separate places, and these two places may be located in separate partitions or in a single partition. All other physical disk storage can be set up as various combinations of the two available partition styles, described in the following sections. For more information about other system types, see the TechNet topic on partition styles.
Dynamic disks follow slightly different usage scenarios, as previously outlined, and the way they utilize the two partition styles is affected by that usage. Because dynamic disks are not generally used to contain system boot volumes, this discussion is simplified to exclude special-case scenarios. For more detailed information about partition data block layouts, and basic or dynamic disk usage scenarios related to partition styles, see How Basic Disks and Volumes Work and How Dynamic Disks and Volumes Work.
Master Boot Record
All x86-based and x64-based computers running Windows can use the partition style known as master boot record (MBR). The MBR partition style contains a partition table that describes where the partitions are located on the disk. Because MBR is the only partition style available on x86-based computers prior to Windows Server 2003 with Service Pack 1 (SP1), you do not need to choose this style. It is used automatically.
You can create up to four partitions on a basic disk using the MBR partition scheme: either four primary partitions, or three primary and one extended. The extended partition can contain one or more logical drives. The following figure illustrates an example layout of three primary partitions and one extended partition on a basic disk using MBR. The extended partition contains four extended logical drives within it. The extended partition may or may not be located at the end of the disk, but it is always a single contiguous space for logical drives 1-n.
Three primary partitions and one extended partition on a basic disk using MBR
Each partition, whether primary or extended, can be formatted to be a Windows volume, with a one-to-one correlation of volume-to-partition. In other words, a single partition cannot contain more than a single volume. In this example, there would be a total of seven volumes available to Windows for file storage. An unformatted partition is not available for file storage in Windows.
The dynamic disk MBR layout looks very similar to the basic disk MBR layout, except that only one primary partition is allowed (referred to as the LDM partition), no extended partitioning is allowed, and there is a hidden partition at the end of the disk for the LDM database. For more information on the LDM, see the Dynamic Disks section.
GUID Partition Table
Systems running Windows Server 2003 with SP1 and later can use a partition style known as the globally unique identifier (GUID) partition table (GPT) in addition to the MBR partition style. A basic disk using the GPT partition style can have up to 128 primary partitions, while dynamic disks will have a single LDM partition as with MBR partitioning. Because basic disks using GPT partitioning do not limit you to four partitions, you do not need to create extended partitions or logical drives.
The GPT partition style also has the following properties:
  • Allows partitions larger than 2 terabytes.
  • Added reliability from replication and cyclic redundancy check (CRC) protection of the partition table.
  • Support for additional partition type GUIDs defined by original equipment manufacturers (OEMs), independent software vendors (ISVs), and other operating systems.
The GPT partitioning layout for a basic disk is illustrated in the following figure.
GPT layout
The protective MBR area exists on a GPT partition layout for backward compatibility with disk management utilities that operate on MBR. The GPT header defines the range of logical block addresses that are usable by partition entries. The GPT header also defines its location on the disk, its GUID, and a 32-bit cyclic redundancy check (CRC32) checksum that is used to verify the integrity of the GPT header. Each GUID partition entry begins with a partition type GUID. The 16-byte partition type GUID, which is similar to a System ID in the partition table of an MBR disk, identifies the type of data that the partition contains and identifies how the partition is used, for example if it is a basic disk or a dynamic disk. Note that each GUID partition entry has a backup copy.
Dynamic disk GPT partition layouts looks similar to this basic disk example, but as stated previously have only one LDM partition entry rather than 1-n primary partitions as allowed on basic disks. There is also a hidden LDM database partition with a corresponding GUID partition entry for it. For more information on the LDM, see the Dynamic Disks section.
Detecting the Type of Disk
There is no specific function to programmatically detect the type of disk a particular file or directory is located on. There is an indirect method.
First, call GetVolumePathName. Then, call CreateFile to open the volume using the path. Next, use IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS with the volume handle to obtain the disk number and use the disk number to construct the disk path, such as "\\?\PhysicalDriveX". Finally, use IOCTL_DISK_GET_DRIVE_LAYOUT_EX to obtain the partition list, and check the PartitionType for each entry in the partition list.
Related topics
About Volume Management
Basic Disks and Volumes Technical Reference
Dynamic Disks and Volumes Technical Reference
Basic Storage Versus Dynamic Storage in Windows XP

Sunday, May 12, 2013

All about MBR

http://www.ntfs.com/mbr-damaged.htm
MBR is damaged
The Master Boot Record (MBR) will be created when you create the first partition on the hard disk. It is very important data structure on the disk. The Master Boot Record contains the Partition Table for the disk and a small amount of executable code for the boot start. The location is always the first sector on the disk.
The first 446 (0x1BE) bytes are MBR itself, the next 64 bytes are the Partition Table, the last two bytes in the sector are a signature word for the sector and are always 0x55AA.
For our disk layout we have MBR:
Physical Sector: Cyl 0, Side 0, Sector 1
000000000   33 C0 8E D0 BC 00 7C FB  50 07 50 1F FC BE 1B 7C   3AZ??.|uP.P.u?.|
000000010   BF 1B 06 50 57 B9 E5 01  F3 A4 CB BE BE 07 B1 04   ?..PW?a.o¤E??.±.
000000020   38 2C 7C 09 75 15 83 C6  10 E2 F5 CD 18 8B 14 8B   8,|.u.??.aoI.‹.‹
000000030   EE 83 C6 10 49 74 16 38  2C 74 F6 BE 10 07 4E AC   i??.It.8,to?..N¬
000000040   3C 00 74 FA BB 07 00 B4  0E CD 10 EB F2 89 46 25   <.tu»..?.I.eo‰F%
000000050   96 8A 46 04 B4 06 3C 0E  74 11 B4 0B 3C 0C 74 05   –SF.?.<.t.?.<.t.
000000060   3A C4 75 2B 40 C6 46 25  06 75 24 BB AA 55 50 B4   :Au+@?F%.u$»?UP?
000000070   41 CD 13 58 72 16 81 FB  55 AA 75 10 F6 C1 01 74   AI.Xr.?uU?u.oA.t
000000080   0B 8A E0 88 56 24 C7 06  A1 06 EB 1E 88 66 04 BF   .Sa?V$C.?.e.?f.?
000000090   0A 00 B8 01 02 8B DC 33  C9 83 FF 05 7F 03 8B 4E   ..?..‹U3E?y..‹N
0000000A0   25 03 4E 02 CD 13 72 29  BE 46 07 81 3E FE 7D 55   %.N.I.r)?F.?>?}U
0000000B0   AA 74 5A 83 EF 05 7F DA  85 F6 75 83 BE 27 07 EB   ?tZ?i.U…ou??'.e
0000000C0   8A 98 91 52 99 03 46 08  13 56 0A E8 12 00 5A EB   S?'R™.F..V.e..Ze
0000000D0   D5 4F 74 E4 33 C0 CD 13  EB B8 00 00 00 00 00 00   OOta3AI.e?......
0000000E0   56 33 F6 56 56 52 50 06  53 51 BE 10 00 56 8B F4   V3oVVRP.SQ?..V‹o
0000000F0   50 52 B8 00 42 8A 56 24  CD 13 5A 58 8D 64 10 72   PR?.BSV$I.ZX?d.r
000000100   0A 40 75 01 42 80 C7 02  E2 F7 F8 5E C3 EB 74 49   .@u.B€C.a?o^AetI
000000110   6E 76 61 6C 69 64 20 70  61 72 74 69 74 69 6F 6E   nvalid partition
000000120   20 74 61 62 6C 65 00 45  72 72 6F 72 20 6C 6F 61    table.Error loa
000000130   64 69 6E 67 20 6F 70 65  72 61 74 69 6E 67 20 73   ding operating s
000000140   79 73 74 65 6D 00 4D 69  73 73 69 6E 67 20 6F 70   ystem.Missing op
000000150   65 72 61 74 69 6E 67 20  73 79 73 74 65 6D 00 00   erating system..
000000160   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ................
000000170   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ................
000000180   00 00 00 8B FC 1E 57 8B  F5 CB 00 00 00 00 00 00   ...‹u.W‹oE......
000000190   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ................
0000001A0   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ................
0000001B0   00 00 00 00 00 00 00 00  A6 34 1F BA 00 00 80 01   ........¦4.?..€.
0000001C0   01 00 07 FE 7F 3E 3F 00  00 00 40 32 4E 00 00 00   ...?>?...@2N...
0000001D0   41 3F 06 FE 7F 64 7F 32  4E 00 A6 50 09 00 00 00   A?.?d2N.¦P....
0000001E0   41 65 0F FE BF 4A 25 83  57 00 66 61 38 00 00 00   Ae.??J%?W.fa8...
0000001F0   00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 AA   ..............U?
What will happen if the first sector has been damaged (by virus, for example)?
Lets overwrite the first 16 bytes with zeros.
000000000   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ................
000000010   BF 1B 06 50 57 B9 E5 01  F3 A4 CB BE BE 07 B1 04   ?..PW?a.o¤E??.±.
When we try to boot after hardware testing procedures, we see just blank screen without any messages. It means the piece of code at the beginning of the MBR could not be executed properly.
That's why even error messages could not be displayed. However, if we boot from the floppy, we can see FAT partition, files on it and we are able to perform standard operations like file copy, program execution...
It happens because in our example only part of the MBR has been damaged which does not allow the system to boot properly. However, the partition table is safe and we can access our drives when we boot from the operating system installed on the other drive.
What will happen if sector signature (last word 0x55AA) has been removed or damaged?
Lets write zeros to the location of sector signature.
Physical Sector: Cyl 0, Side 0, Sector 1
0000001E0   41 65 0F FE BF 4A 25 83  57 00 66 61 38 00 00 00   Ae.??J%?W.fa8...
0000001F0   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ................
When we try to boot now, we see an error message like "Operating System not found".
Thus the first thing if computer does not boot is to run Disk Viewer and check the first physical sector on HDD, whether it looks like valid MBR or not:
  • check, may be it's filled up with zeros or any other single character
  • check whether error messages (like you can see above "Invalid partition table"...) are present or not
  • check whether disk signature (0x55AA) is present or not
The simplest way to repair or re-create MBR is to run Microsoft's standard utility called FDISK with a parameter /MBR, like
A:\> FDISK.EXE  /MBR
FDISK is a standard utility included in MS-DOS, Windows 95, 98, ME.
If you have Windows NT / 2000 / XP, you can boot from startup floppy disks or CD-ROM, choose repair option during setup, and run Recovery Console. When you are logged on, you can run FIXMBR command to fix MBR.
Also you can use third party MBR recovery software or if you've created MBR backup, restore it from there (Active@ Partition Recovery has such capabilities).
What will happen if the first sector is bad/unreadable?
Most likely we'll get the same black screen, which we got when trying to boot. When you try to read it using Disk Viewer/Editor you should get an error message saying that sector is unreadable. In this case recovery software is unable to help you to bring HDD back to the working condition, i.e. physical partition recovery is not possible.
The only thing that can be done is to scan and search for partitions (i.e. perform virtual partition recovery), and in case if something is found — display them and give the user an opportunity to save important data to another location. Third party software, like Active@ File Recovery, will help you here.
==========================
Master Boot Record (MBR) Repair
Infections in the Master Boot Record (MBR) are a tricky business, and may sometimes require a user to take additional steps to completely remove the infection.
 If available, the Description of the relevant malware may provide removal details tailored to the suspect malware or specific infection scenario.
If specific removal instructions are not yet available, this page provides more general actions for repairing an infected MBR. Click the link to jump to the relevant instructions:

Automatic Disinfection

 In some cases, F-Secure's security products can disinfect the MBR without further action from the user.

Alternatives

If a suspicious hidden file is detected and FSAV does not immediately remove the file, there are several actions you can perform by manually selecting one of the displayed option:
  • If you don't want to do anything about the hidden item, select "None" as the action
  • If you don't want to be notified about the file in the future, select "Exclude" as the action
  • If you are sure the item is not part of a normal program, you can rename it by selecting "Rename" as the action. This will prevent the hidden program from starting in the future. You should use the "Rename" action very carefully, because renaming important files may break the computer.

Contact Support

In certain cases, more complex malware (e.g., rootkits) may have sufficiently altered the MBR so that regular automatic disinfection is not possible, or not fully effective.
If you suspect this is the case, you may wish to send a sample of the suspect MBR to our Labs for further analysis.

Submitting a sample of an infected MBR

For detailed instructions on how to obtain a sample of the suspect MBR for submission, please see the following Support KB Article:

Advanced: Manual MBR Repair

Note: MBR repair, if incorrectly performed, may result in additional damage; it is only advisable for advanced users.
In certain cases, a user may attempt to manually replace the suspect MBR with a clean version.
Users attempting manual data recovery and repair may want to use our free utility program, the F-Secure Rescue CD, to do so.

Additional Options

Windows includes tools to replace an infected MBR with a copy of the original, clean MBR. To do so:
  1. Boot into the Recovery Console.
  2. Depending on the operating system in question, run the appropriate command on all infected drives:

    • On Windows XP, run: fixmbr
    • On Windows 7, run: bootrec /mbr
=============================
nstructions 1 Run MbrFix.exe from floppy drive, optical disk drive or from USB and follow the on screen instructions. 2 Check your boot preference in BIOS settings and select optical drive as a first preference. Now insert bootable DVD of windows into your optical disk drive and restart the pc. [BIOS_advancedBIOS] 3 Once boot process is completed, you will have to set “Language”, “Time” and “Keyboard” preferences, best option is to set them to default settings and continue. [windows-7-install-5] 4 Now you will come up with several options. Click on the “Repair Your Computer” option, it will give you access to a window used for System Recovery. Now select command prompt from here. You need to get into the command prompt to to run Bootsect.exe utility. This utility is located inside the boot folder of windows. You need to change your current directory to boot folder. The syntax to change the directory is “CD [/D] [drive:][path]”. 5 Now execute “bootsect /nt60 C:/ “ without including the quotes assuming that you had windows 7 installed in C: drive. This will repair your windows partition. Eject your windows DVD and restart your computer. Your windows will now boot normally.

Read more at: How to Repair Corrupted Master Boot Record (MBR) on Windows 7 http://www.stepbystep.com/how-to-repair-corrupted-master-boot-record-mbr-on-windows-7-1249/
nstructions 1 Run MbrFix.exe from floppy drive, optical disk drive or from USB and follow the on screen instructions. 2 Check your boot preference in BIOS settings and select optical drive as a first preference. Now insert bootable DVD of windows into your optical disk drive and restart the pc. [BIOS_advancedBIOS] 3 Once boot process is completed, you will have to set “Language”, “Time” and “Keyboard” preferences, best option is to set them to default settings and continue. [windows-7-install-5] 4 Now you will come up with several options. Click on the “Repair Your Computer” option, it will give you access to a window used for System Recovery. Now select command prompt from here. You need to get into the command prompt to to run Bootsect.exe utility. This utility is located inside the boot folder of windows. You need to change your current directory to boot folder. The syntax to change the directory is “CD [/D] [drive:][path]”. 5 Now execute “bootsect /nt60 C:/ “ without including the quotes assuming that you had windows 7 installed in C: drive. This will repair your windows partition. Eject your windows DVD and restart your computer. Your windows will now boot normally.

Read more at: How to Repair Corrupted Master Boot Record (MBR) on Windows 7 http://www.stepbystep.com/how-to-repair-corrupted-master-boot-record-mbr-on-windows-7-1249/
nstructions 1 Run MbrFix.exe from floppy drive, optical disk drive or from USB and follow the on screen instructions. 2 Check your boot preference in BIOS settings and select optical drive as a first preference. Now insert bootable DVD of windows into your optical disk drive and restart the pc. [BIOS_advancedBIOS] 3 Once boot process is completed, you will have to set “Language”, “Time” and “Keyboard” preferences, best option is to set them to default settings and continue. [windows-7-install-5] 4 Now you will come up with several options. Click on the “Repair Your Computer” option, it will give you access to a window used for System Recovery. Now select command prompt from here. You need to get into the command prompt to to run Bootsect.exe utility. This utility is located inside the boot folder of windows. You need to change your current directory to boot folder. The syntax to change the directory is “CD [/D] [drive:][path]”. 5 Now execute “bootsect /nt60 C:/ “ without including the quotes assuming that you had windows 7 installed in C: drive. This will repair your windows partition. Eject your windows DVD and restart your computer. Your windows will now boot normally.

Read more at: How to Repair Corrupted Master Boot Record (MBR) on Windows 7 http://www.stepbystep.com/how-to-repair-corrupted-master-boot-record-mbr-on-windows-7-1249/
=============================
Instructions
  1. Insert the Windows 7 installation DVD and boot from your DVD drive. You may have to change the boot order through system BIOS to boot from your DVD. 
  2. Choose your default "Language," "Time" and "Keyboard Input" on the first window and click "Next."
  3. Click on the "Repair Your Computer" option to gain access to the System Recovery window. Now choose "Command Prompt" to run the Bootsect.exe utility. Bootsect is located inside the boot folder so change your directory to boot. Now run "bootsect /nt60 C:\" (without quotes) if you had Windows 7 initially installed in the C partition. Alternatively, you can run "bootsect /nt60 SYS" or "bootsect /nt60 ALL" (without quotes) to repair the system partition or all partitions. Eject the DVD and restart your computer. Your computer should now boot Windows 7 again.
=============================
Author: Systemintegrasjon AS
Version: 1.3.0.0  File Date: 8/5/2009  Number of Downloads: 291601  File size: 136 K

File Description:
Tool to fix or create Master Boot Record (MBR) on harddisks, for instance when using Windows PE. With an x64-edition as well as the 32-bit edition.
Now with support for Windows Vista and Windows 7 MBR's!
The new version has some new, cool features, like creating DOS boot sectors, changing partition types, etc!
Read more
=============================
Windows startet nicht, weil der Boot-Speicher keinen gültigen Eintrag enthält (Thumbnail)Auch wenn das Tool bcdedit auf den zweiten Blick weniger sperrig zu bedienen ist, als es auf den ersten scheint, kann es doch nicht alle Aufgaben abdecken, die nötig sind, ein nicht mehr startendes System wieder flottzukriegen. Ist der Boot-Speicher etwa korrupt, keine Partition aktiv oder kein gültiger Master Boot Record (MBR) vorhanden, behebt es solche Fehler nicht. Es ist eben nur für die Kon­fi­gu­ra­tion der zu startenden Systeme selbst zuständig, unter der Annahme, dass der Rest drum herum schon in Ordnung sei.

Stufen des Bootens: MBR, Bootmanager, Be­triebs­sys­tem

Windows startet nicht, weil der Boot-Speicher keinen gültigen Eintrag enthältSchuld ist die althergebrachte Technik des Bootens auf BIOS-basierten Rechnern, an der auch moderne Be­triebs­sys­teme nichts ändern können; die sind ja zu diesem Zeitpunkt noch nicht in Funktion. Der PC liest nach dem Einschalten zunächst die ersten 512 Byte der ersten Festplatte ein und kennt danach die darauf vorhandenen Partitionen sowie die Sektor-Adresse eines Bootloaders, zu dem er springt und dessen Code er abarbeitet.

Unter Windows seit NT führt dies dann dazu, dass der Bootmanager aufgerufen wird. Es handelt sich bei aktuellen Windows-Versionen um das Programm bootmgr an einer physisch festen Position auf der aktiven Partition, die in der Regel versteckt ist. Es liest den Boot-Speicher \Boot\BCD auf dieser Partition aus und präsentiert die daraus resultierende Auswahl an startbaren Be­triebs­sys­temen als Boot-Menü.
Gibt es nichts auszuwählen, etwa weil sich nur ein OS auf dem Rechner befindet und der Benutzer nicht ‹F8› gedrückt hat, sieht man von diesem Vorgang nichts. Vor Windows Vista/Windows Server 2008 hieß das Programm ntldr, wertete die Textdatei boot.ini aus und baute daraus das Boot-Menü.
Wenn man so will, handelt es sich dabei jeweils bereits um ein rudimentäres Be­triebs­sys­tem: Immerhin kann es Informationen anzeigen und Eingaben entgegennehmen sowie diese verarbeiten. Das mehrstufige Booten birgt jedoch auch einige Fehlerquellen, und zwar an jeder der Stufen:
  1. der MBR kann ungültig sein, das heißt er enthält nicht die Adresse eines gültigen Bootloaders,
  2. auf der aktiven Partition findet sich kein Programm bootmgr, etwa weil eine alte Windows-Installation wieder ntldr darüber geschrieben hat,
  3. bootmgr kann den Boot-Speicher \Boot\BCD nicht lesen, weil dieser beschädigt wurde,
  4. es ist keine Partition aktiv, was für Windows ein Problem darstellt. Andere Be­triebs­sys­teme wie Linux werten das „Aktiv“-Attribut nicht aus und benötigen es nicht.

Reparatur mit diskpart und bootrec

Unter WinRE macht die automatische Sys­tem­start­repa­ra­tur im Allgemeinen einen wirklich guten Job, um diese 4 Probleme zu erkennen und zu beheben. Falls sie es doch einmal nicht tut, bleiben auf der WinRE-Kommandozeile 2 Tools, um das Problem manuell anzugehen: diskpart und bootrec.
  1. Ist der MBR ungültig, repariert dies der Befehl bootrec /FixMbr,
  2. bootmgr wird durch bootrec /FixBoot wiederhergestellt,
  3. einen komplett neuen Boot-Speicher baut bootrec /RebuildBcd, scannt danach nach Windows-Installationen und bietet die Möglichkeit, diese dem Boot-Speicher hinzuzufügen. Ist der Boot-Speicher an sich in Ordnung, und man will nur vermisste Einträge manuell hinzufügen, bietet bootrec /ScanOs einen nicht-schreibenden Modus, bei dem die beim Scan gefundene Systeme nur aufgeführt werden.
  4. Dass der Fehler an einem fehlenden „Aktiv“-Attribut liegt, erkennt man daran, dass die bootrec-Befehle der Punkte 2 und 3 den Fehler „Element not found“ ausgeben. In diesem Falle ruft man diskpart auf, und markiert mit der Befehlssequenz
    select disk 0
    select partition 1
    active
    exit
    etwa die erste Partition der ersten Festplatte als aktiv.
Die Befehle haben den Vorteil, dass man sie auch ohne Ursachenforschung eben mal so ausprobieren kann. Befehl 3 zerstört zwar ein eventuell angepasstes Boot-Menü, was aber in Anbetracht eines nicht mehr startenden Servers sicherlich verschmerzbar ist.

Borrando Ubuntu

http://wiki.ubuntuusers.de/Ubuntu_entfernen
Die prinzipielle Vorgehensweise:
  1. Backup wichtiger Daten
  2. Von der Windows-Installations-CD booten (DOS-Diskette)
  3. Reparaturkonsole benutzen, um den Linux-Bootmanager zu entfernen
  4. Partitionen neu strukturieren
Backups
Hierzu muss man nicht viel sagen. Backups wichtiger Daten sollten regelmäßig erstellt und unabhängig vom Rechner gelagert werden. Backups auf dem selben Computer zu speichern von dem sie stammen, bieten nur unzureichende Sicherheit! Am besten brennt man die Daten auf CD/DVD oder lagert sie auf einer externen Festplatte aus.
Welche Installations-CD, welches Passwort?
Man benötigt eine Windows-CD (ab Windows 2000) oder die Super Grub Disc, um den Bootsektor wiederherzustellen und so die Bootmanager Lilo bzw. GRUB (Ubuntu verwendet GRUB) zu entfernen.
Die Windows 2000-CD hat den großen Vorteil, dass sie es erlaubt, ohne Administratorpasswort eine Reparaturkonsole zu öffnen. In der Wiederherstellungskonsole der Windows XP-CD wird man im Gegensatz dazu nach dem Administratorpasswort gefragt, bevor man in die Konsole gelangt. Mit Administratorpasswort ist in der Tat das Passwort des Windowsaccounts "Administrator" gemeint. Es ist nicht möglich, sich als User mit Administratorrechten einzuloggen.
Ab Windows Vista ist das Entfernen des Bootloaders und Wiederherstellung des Windows-Bootloaders mit dem Hilfsprogramm "Bootrec.exe" in der Windows-Wiederherstellungsumgebung möglich.
Die Super Grub Disk hat den Vorteil, dass sie Open Source ist und kleiner als 5 MB groß ist. Mit einem Klick wird die Wiederherstellung vollzogen.
Windows Reparaturkonsole / Wiederherstellungskonsole
Windows XP
Bei Windows XP bootet man den Rechner mit der Installations-CD, danach
  • wartet man einfach bis zur ersten Abfrage (nicht F2 für "automatische Systemwiederherstellung" drücken). Bei der ersten Abfrage drückt man R und wartet, bis die Wiederherstellungskonsole gestartet ist; oder
  • drückt man beim ersten "blauen Bildschirm" F10 , um direkt zur Wiederherstellungskonsole zu wechseln. (Quelle siehe Links)
Jetzt sollte ein Konsolenbildschirm erscheinen mit der Frage, an welcher Windowsinstallation man sich anmelden möchte. Nun einfach die Zahl vor der wiederherzustellenden Installation eingeben und mit bestätigen. Jetzt sollte man das Administratorpasswort parat haben. Einfach eingeben und wieder mit bestätigen. Anschließend die folgenden Befehle ausführen, wobei X: durch den Laufwerksbuchstaben zu ersetzen ist, das die wiederherzustellende Windowsinstallation enthält.
Befehle in der Reparatur- / Wiederherstellungskonsole
Dieser Befehl richtet den MasterBootRecord (MBR) neu ein:
fixmbr 
Dieser Befehl richtet den Startsektor (auch Bootsektor genannt) der Systempartition neu ein. Im Allgemeinen befindet sich diese auf dem Windows-Laufwerk C:
fixboot c: 
fixboot ohne Angabe eines Laufwerks schreibt einen neuen Bootsektor auf dem Laufwerk bei dem man sich beim Aufruf der Reparaturkonsole angemeldet hat.
Die Programme fragen in ziemlich beängstigendem Ton, ob man sich wirklich ganz sicher ist, da eventuell alle Daten auf der Festplatte zerstört werden können. In der Tat ist diese ganze Aktion nicht ganz ohne Risiko (siehe Backups), normalerweise sollte es jedoch keine Schwierigkeiten geben.
Administratorpasswort unter Windows XP eingeben
Unter "Start -> Systemsteuerung -> Verwaltung -> Computerverwaltung" findet man den Eintrag "Lokale Benutzer und Gruppen". Sollte das Fenster "Systemsteuerung" keinen Eintrag "Verwaltung" aufweisen, klickt man in der linken Fensterhälfte auf "Zur klassischen Ansicht wechseln". Ein Unterpunkt hiervon ist "Benutzer". Hier findet man den Account "Administrator". (Zugriff auf das Administrator-Konto hat man bei XP-Home nur im abgesicherten Modus unter Start/Systemsteuerung/Benutzerkonten.) Diesen mit der linken Maustaste anwählen und den Eintrag "Kennwort festlegen" öffnen. Jetzt sollte eine Warnung erscheinen, diese kann problemlos mit "Fortsetzen" beendet werden. In dem darauffolgenden Dialog vergibt man nun ein Kennwort und wiederholt dieses. Dann mit "Ok" bestätigen und den Rechner mit der eingelegten Windows XP-CD neustarten.
Windows Vista und Windows 7
Als erstes werden Linux-Partitionen unter Windows in der Datenträgerverwaltung gelöscht.
Bevor das Hilfsprogramm Bootrec.exe zur Wiederherstellung des Windows-Bootloaders ausgeführt werden kann, muss die Windows-Wiederherstellungsumgebung gestartet werden. Dazu geht man folgendermaßen vor:
  1. Windows-Installationsdatenträger in das CD- oder DVD-Laufwerk einlegen und damit booten
  2. Bei Aufforderung eine Taste drücken
  3. Sprache, Zeit, Währung sowie eine Tastatur oder eine Eingabemethode wählen und auf "Weiter" klicken
  4. "Computer reparieren" anwählen
  5. Im Dialogfeld Systemwiederherstellungsoptionen auf "Eingabeaufforderung" klicken
Befehle in der Reparatur- / Wiederherstellungskonsole
Dieser Befehl listet die Befehle in der Reparatur- / Wiederherstellungskonsole auf:
bootrec 
Dieser Befehl listet die installierten Betriebsysteme auf:
bootrec /ScanOs 
Dieser Befehl richtet den MasterBootRecord (MBR) neu ein:
bootrec /fixmbr  
Dieser Befehl richtet den Startsektor (auch Bootsektor genannt) der Systempartition neu ein:
bootrec /fixboot  
Dieser Befehl durchsucht alle Datenträger nach Installationen, die mit Windows Vista bzw. Windows 7 kompatibel sind. Außerdem kann man über diese Option die Installationen auswählen, die dem Speicher für Startkonfigurationsdaten hinzugefügt werden sollen. Diese Option wird verwendet, wenn die Startkonfigurationsdaten neu erstellt werden müssen:
bootrec /RebuildBcd 
System neu starten, Fertig!
Hier gibt es mehr Informationen: Microsoft Support Seite {de} .
Wiederherstellen des MBR ohne Windows CD
Achtung!
Eine fehlerhafte Verwendung der nachfolgend beschriebenen Anwendungen kann möglicherweise zu einem Totalverlust der Daten auf der Festplatte führen! Es wird dringend angeraten, die wichtigsten Daten in einem Backup zu sichern.
Wiederherstellen mit der Anwendung MbrFix
Hat man keine Windows-CD mit Reparaturkonsole zur Hand, hilft das Programm MbrFix.exe weiter (Download {dl} {en}, Anleitung {en}). Man installiert die .exe in Windows und öffnet dann unter Windows ein Terminalfenster durch die Eingabe von cmd.exe. Folgendes muss eingegeben werden:
MbrFix /drive  fixmbr 
wobei für die Laufwerksnummer (Zählung beginnt mit Null) anzugeben ist. Falls Windows Vista verwendet wird, lautet der Befehl:
MbrFix /drive  fixmbr /vista 
Wiederherstellen mit der Super Grub Disc
Eine weitere Möglichkeit, den ursprünglichen MBR von Windows wiederherzustellen, bietet die sogenannte Super Grub Disk.
Eigentlich wurde diese Disk konzipiert, um den Linux-Bootloader GRUB auf den MBR zu schreiben bzw. um die zu bootende Partition selber auszuwählen. Die Software eignet sich allerdings auch hervorragend, um einen bestehenden GRUB zu entfernen und den ursprünglichen, eventuell von Microsoft bereitgestellten Bootloader zu reaktivieren.
Auf der Homepage {en} findet man ein sehr ausführliches Wiki, wo man alles nachlesen kann und ein kleines ISO-Image, welches man am besten auf eine CD brennt. Ist im BIOS das Booten vom DVD- bzw. CD-ROM Laufwerk aktiviert, startet das Programm und man kann mit einem ENTER-Klick die ganze Sache wiederherstellen.
Wiederherstellen unter VISTA und WINDOWS 7
Um den MBR für Windows VISTA bzw. Windows 7 wieder herzustellen, ist die Windows-Anwendung EasyBCD oder ein vergleichbares Tool anzuwenden, das auf die speziellen Gegebenheiten des Bootmanager bcdedit abgestimmt ist. Die Anwendung EasyBCD hat einen eigenen Menüpunkt ("BCD Backup/Repair") zum Wiederherstellen des MBR. Dieses Tool berücksichtig auf welcher Partition das Windows installiert ist bzw. wo ein Recovery abgelegt wurde.
Auf der Homepage {us} findet man eine kurze Beschreibung {en} und den EasyBCD {dl} Download.
Ubuntu_entfernen/EasyBCD-Setting.png Die Anwendung wird wie unter Windows üblich, mit Doppelklick auf die exe-Datei (oder unter Berücksichtigung von Administrator-Rechten im Terminal) installiert. Nach dem Start der Anwendung wird der entsprechende Menüpunkt "BCD Backup/Repair" aufgerufen. Bei den
  • BCD Management Optionen
(siehe Abbildung) wird der zweite Button
  • Re-create/repair boot files
ausgewählt und mit "Perform Action" (Anwendung ausführen) der MBR neu geschrieben. Bei mehr als einer Festplatte wird zusätzlich noch die relevante HDD abgefragt.
Nach der Reparatur / Wiederherstellung des MBR und einem Reboot kann diese Anwendung wieder über die Systemsteuerung problemlos entfernt werden.
Neustart ohne Linux
Der Rechner kann jetzt einfach per Reset neu gestartet werden. Das Boot-Menü sollte nun nicht mehr angezeigt werden, da der MBR ja wieder mit dem Windows-Bootmanager überschrieben wurde.
Möchte man nun auch wieder den Speicherplatz - den Linux nach wie vor belegt - unter Windows nutzen, so können die Linux-Partitionen - auch nachträglich - gelöscht werden. Dazu öffnet man
  • "Systemsteuerung -> Computerverwaltung -> Datenträgerverwaltung"
und löscht dort die Linux-Partitionen. Der nun freie Speicher kann beliebig in neue Partitionen aufgeteilt und formatiert werden. Bei Bedarf kann man mit kommerziellen Programmen wie Partition Magic oder Acronis Disk Director den freien Speicher auch bestehenden Paritionen zuordnen.
MBR mit DOS-Diskette wiederherstellen
Es gibt auch die Möglichkeit, den MBR mit Hilfe einer DOS-Bootdiskette und des Programms fdisk wiederherzustellen.
Dazu von einer solchen Diskette booten und den Befehl
fdisk /mbr 
eingeben.
Sollte nur ein Windows XP zur Verfügung stehen, um die Bootdiskette zu erstellen, so wird kein fdisk auf diese kopiert. In diesem Fall kann XFDISK {de} genutzt werden. Das .zip-Archiv herunterladen, entpacken und zusätzlich auf die Diskette kopieren.
Achtung!
Diese Variante wurde nur mit Windows XP getestet. Ältere Windows Versionen sollten ebenfalls keine Probleme bereiten. Ein solches Vorgehen unter Windows Vista und neuer führt möglicherweise nicht zum Erfolg oder richtet sogar Schaden an!
Der Befehl lautet dann:
xfdisk /MBR 
Linux Partitionen sichern und in NTFS oder FAT32 rückkonvertieren
Falls noch Linux-Partitionen (inklusive der Swap-Partition) vorhanden sein sollten, können diese unter Windows in ein kompatibles Dateisystem wie beispielsweise NTFS konvertiert werden, wobei dabei allerdings sämtliche Dateien auf der Partition verloren gehen.
Möchte man die Daten von einem Ext2 oder Ext3 System sicherstellen, kann man diese Linux-Partitionen mit der Freeware EXT2 IFS {en} unter Windows lesen, beschreiben und gegebenenfalls archivieren, bevor man die Partitionen löscht bzw. umwandelt.
Gibt man in der Windows-Eingabeaufforderung
diskmgmt.msc
ein, öffnet sich die Datenträgerverwaltung, wo man nun Linux-Partitionen und Swap in NTFS oder FAT32 rückkonvertieren kann.

Friday, May 10, 2013

delete grub2, recover windows mbr

http://www.sevenforums.com/tutorials/20864-mbr-restore-windows-7-master-boot-record.html
If you have been dual booting with Linux, then you probably know one of the Linux boot managers like Grub or LILO has been installed in the MBR of your hard drive. What can you do when you no longer want Linux on that hard drive? This tutorial will show you how to use your 7 DVD and BOOTSECT.EXE to restore the "bootsector code" of the MBR and allow you to begin booting to Windows 7 again.

1. Boot your computer to the Windows 7 DVD (or to a "Repair CD"). At this screen choose to install now. 
2. Select your language and click next.3. Click the button for "Use recovery tools".
Load drivers if you have a SoftRAID

4. Then select "Command Prompt".

5. When open, the command prompt will look like this:

6. The command we will use, bootsect.exe, is in a folder (named boot) on the DVD.
We need to know what drive letter has been assigned the DVD drive to access the folder.
Code:
Type: diskpart
and press Enter
 
Type: select disk 0 (zero)
and press Enter
 
type: list volume
and press Enter
In this screen shot, the 7 DVD is letter: G

7. Use your DVD drive letter and
Code:
Type: exit
and press Enter
 
to close Diskpart
 
Type: G: (use the letter of your DVD drive)
and press Enter
 
Type: cd boot
and press Enter
 
Type: dir
and press Enter
to verify that bootcect.exe is there (if you really need to)

8. To restore the "bootsector code":
Code:
TYPE: bootsect /nt60 SYS /mbr
and press Enter
NOTE: If this method fails to restore the MBR, you can try the bootrec command as it is also a tool for repairing the MBR.
9. When completed successfully,
Code:
Type: exit
and press Enter
This will close the command prompt window.
10. Now select Shut Down or Restart

11. Then you can reboot your computer into Windows.

============================
http://tech.reboot.pro/showthread.php?tid=2145
Insert the win7 recovery disc inside a CD/DVD or flash drive (use YUMI)
after booting the disc, go to the command prompt and type the following:
This part makes sure that "access denied" won't show up when restoring mbr.

Diskpart
list vol
sel vol Z (The Z changes according to what drive letter your WINDOWS installation exists)
act
exit

This part is the actual input to restore mbr. Again, "X" changes depending on your WINDOWS installation

bcdboot D:\windows /s X:
bootsect /nt60 D: /mbr

===========================
http://tech.reboot.pro/showthread.php?tid=1424
If you have a Windows 7 installation disk, or also known as a repair disk, which every Windows 7 user should take the time to burn off to a CD from their Windows 7, you can boot from the disk through your boot menu or changing the boot order to boot from that disk.

In here there's an option for command prompt. It will start you off in a System32 drive for the Windows machine it previously found on the window before it allows you to choose cmd prompt as an option, and it labels this as X but don't be alarmed. 

From here you want to navigate to the boot dir, so using this command, that can be done:
cd Boot

Then in here there's a file called bootsect.exe. This is what our lifesaver is going to be... Since we run (Or I) Windows 7, you need to remember the parameter /nt60, this basically is short for the Windows NT 6.0 and greater. Any earlier, and you would have to use /nt52 which should be anything below Vista if i'm correct.

Here's the command we're going to use:
bootsect /nt60 SYS /mbr

There's a force command, but I would recommend not using it, since it's not really needed for this and it is a little dangerous.

This command basically tells you to repair/update the boot record for the SYSTEM drive allocated to your Windows OS found during the CD's startup. Once this is done, you can use the exit command to close the window, and then choose to Reboot your machine.

You should now be able to get back into Windows, and no more annoying Grub boot menu asking you if you want to boot from Linux or Windows. I never used my Linux is the thing, so I finally decided to get rid of it after some thought, and now I can just use my Windows. :)
===========================
http://askubuntu.com/questions/131168/how-do-i-uninstall-grub

WARNING: EXTREMELY DANGEROUS

Do not do this. The first command will wipe out the partition table (as the OP mentioned), but the second command will cause undefined behaviour if the MBR is not configured properly. 
1 You can use dd command from Linux itself (it removes partition table):
 # dd if=/dev/null of=/dev/sdX bs=512 count=1
2 Just remove MBR, without the partition table (see comment below):
# dd if=/dev/null of=/dev/sdX bs=446 count=1
Replace /dev/hdX with your actual device name such as /dev/hda. Use fdisk -l command to find out device name:
# fdisk -l
Source
  1. http://www.cyberciti.biz/faq/linux-how-to-uninstall-grub/

------------------------------
dump the raw MBR data
sfdisk -d /dev/sdb > sdb.out
-------------------------

you can render the device not bootable simply by making the first few bytes of the disk 0x00.
Typically (and this is true for both grub, grub2 and ntldr iirc) the very first byte of your drive is going to be an x86 jmp instruction. This occurs before even the disklabel, because when passing execution to the device to bootstrap it, it simply sets the CPU to suck in the device information as code. If it has invalid code it triggers an interrupt and the BIOS handles the exception and goes to the next bootable device.
For instance, the beginning of my disk starts with:
00000000  eb 63 90 d0 bc 00 7c fb  50 07 50 1f fc be 1b 7c  |.c....|.P.P....||
The first part is eb 63 which is Jump to offset 0x63.
00000060  00 00 00 00 ff fa 90 90  f6 c2 80 74 05 f6 c2 70  |...........t...p|
00000070  74 02 b2 80 ea 79 7c 00  00 31 c0 8e d8 8e d0 bc  |t....y|..1......|
Execution continues from here.
The end of the sector looks like this:
000001b0  cd 10 ac 3c 00 75 f4 c3  ed db 96 d6 00 00 80 01  |...<.u..........|
000001c0  01 00 83 fe ff ff 3f 00  00 00 c1 07 a6 0e 00 fe  |......?.........|
000001d0  ff ff 83 fe ff ff 00 60  00 11 00 00 38 29 00 fe  |.......`....8)..|
000001e0  ff ff 82 fe ff ff 00 08  a6 0e 00 58 5a 02 00 00  |...........XZ...|
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
If your disk is formatted as an MBR partition table then it only needs two things to be present, the partition table which is at offset 0x1be and the MBR signature, 55aa which occurs at the very end of the sector at offset 0x1fe0x1be is decimal 446.
The following will (of course) make the device unbootable. But this is what you want. If you don't want to make your device unable to be booted then don't do this mmm-kay? I'm assuming your device is /dev/sdz, simply because not many people have a /dev/sdz, and this lowers the risk of some idiot newb blindly copy pasting commands.
First, copy the MBR to a file for a backup.
sudo dd if=/dev/sdz of=/some/where/safe/preferably/not/on/dev/sdz/backup.mbr bs=512 count=1
Next, make a copy of that file:
cp backup.mbr backup.mbr.test
Next, we have to create a loopback device (so that the contents don't get truncated.) And apply the changes on our fake sector 0 as a test:
sudo losetup /dev/loop7 backup.mbr.test
sudo dd if=/dev/zero of=/dev/loop7 bs=446 count=1
sudo losetup -d /dev/loop7
Hexdump the file and make sure that the entire partition table is intact:
sudo hexdump -C backup.mbr.test
You should see something like:
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 80 01  |................|
000001c0  01 00 83 fe ff ff 3f 00  00 00 c1 07 a6 0e 00 fe  |......?.........|
000001d0  ff ff 83 fe ff ff 00 60  00 11 00 00 38 29 00 fe  |.......`....8)..|
000001e0  ff ff 82 fe ff ff 00 08  a6 0e 00 58 5a 02 00 00  |...........XZ...|
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200
Now, 0x1be is where you see 80 on the hexdumped output, this can also be 00 and still be valid. (It's the "bootable" flag in the partition table, you can leave it alone, because it's completely ignored by most modern BIOSes...) The byte at 0x1bf though will almost NEVER be 0x00 (it's most commonly 0x01 but it can take other values) you can compare this against your backup.mbr to make sure that nothing past 0x1be is changed.
Once you're satisfied that you applied the change correctly then you can directly copy the file over the first part of the disk. The reason why you want to do the file rather than /dev/zeroagain is for safety against typos. If you accidentally omit count=1 you're gonna have a bad time, copying a file on the other hand will never run past the EOF, ever. So it's safer.
sudo dd if=backup.mbr.test of=/dev/sdz
Next hexdump your disk to make sure that the changes took as expected.
hexdump -C /dev/sdz | head
Compare up to 0x200 against backup.mbr.test to make sure it's what you want.
Finally, if anything screws up for whatever reason you can simply copy the backup of the MBR back onto the drive via:
sudo dd if=backup.mbr of=/dev/sdz
================

After reading the Wikipedia article on the subject I'd like to propose a few additional solutions:
  1. Change boot order in BIOS :)
  2. The best and the safest one: use fdisk to remove "bootable" flag from any partitions on that drive. Most MBRs look for a "bootable" partition to chain-load from, so I would expect GRUB to just do nothing if there are no such partitions. Haven't tested though.
    If the above does not help, try installing a free clone of standard MBR code:
  3. Install mbr package and use install-mbr command like this:
    sudo apt-get install mbr
    sudo install-mbr -i n -p D -t 0 /dev/sda
I mean, from reading the Wikipedia article, I have an impression that the only thing which identifies the MBR is its signature which is at the very end of the sector (bytes 510 and 511). The first 446 bytes of MBR supposed to contain machine instructions. The BIOS is supposed to transfer control to the bootloader regardless of the actual contents of the first 446 bytes, provided that MBR signature is present:
On IBM PC-compatible computers, the bootstrapping firmware contained within the ROM BIOS loads and executes the master boot record.[14]... Thus, the beginning of the MBR is expected to contain real mode machine language instructions.[14] The BIOS reads the MBR from the storage device into physical memory, and then directs the microprocessor to the start of the boot code.
Due to the restricted size of the MBR's code section, it typically contains only a small program that copies additional code (such as a boot loader) from the storage device into memory. Control is then passed to this code, which is responsible for loading the actual operating system.
...
The bootstrap sequence in the BIOS will load the first valid MBR that it finds into the computer's physical memory at address 0x7C00. The last instruction executed in the BIOS code will be a "jump" to that address, to direct execution to the beginning of the MBR copy. The primary validation for most BIOSes is the 0xAA55 signature on the end, although a BIOS implementor may choose to include other checks, such verifying that the MBR contains a valid partition table without entries referring to sectors beyond the reported capacity of the disk.
So my understanding is that MBR always supposed to contain a bootloader, and zeroing the first 446 bytes of it would not stop BIOS from trying to boot from the disk - but it is likely to make the computer hand while trying to execute invalid code.
UPDATE: Also, this article suggests that to make the disk to look "un-bootable" for BIOS you should actually edit the MBR signature at the and of the sector (using any disk editor). I'm not sure if it's going to affect OS seeing the partition table on the disk though... but at least you can always modify those bytes back...