MBRWizard!  The MBR Management Utility  

 





   

MBRWizard is a command line only application, no graphical interface is included with this program.  In order to run this from Windows you must start a command prompt, navigate to the location of the executable, then enter the name of the program "MBRWiz" with any desired command line options for processing. See Examples for a quick start to some basic operations.

A return code (errorlevel) will always be returned upon program exit to verify the success of any operation. A return value of 0 (zero) indicates success, values >0 will indicate failure. Specifying the /result switch will display the return code to the screen for troubleshooting.
 
The following is a list of available Command Line Options for MBRWizard.        Items in Blue are Windows options only.
/List - Display the partitions listed in the MBR, their order in the MBR, partition type, size, and whether active or hidden. The Pos field indicates the order the partitions are laid out on disk, while MBRndx shows them as they're listed in the MBR.

/Disk=# - Selects the disk to use for all operations. This switch is always processed first, verifying that all operations specified on the command line will use the disk specified here. If not specified, Disk 0 will be used by default.

/Part=# - Selects the partition to use for all partition based operations. If not specified, partition '0' will be used by default. All operations use the physical location of the partition on the disk (the first column in /list), not the MBRndx field which simply identifies the current position of the partition entry in the MBR.   Certain commands allow the action to be perfomed on all partitions, in this case /Part=* (asterisk) performs this functionality.

/Sector=# - Selects the sector to use with sector based operations. Sector 0 (MBR) will be used by default if not specified.

MBR Options

/Save=filename - Saves the current MBR to a file, where filename is the path+filename used to store the file.  Specifying /Sector=# on the command line will save the sector # specified rather than the MBR (Sector 0).  Additionally, specifying /sector=head will save the entire first head to file. 

/Restore=filename - Reads an MBR file from filename, where filename is an existing path+filename containing the backed up contents of the MBR sector. Optionally, specifying the /Sector=# parameter will restore the file to sector # rather than 0 (MBR).  Additionally, the entire first head will be resotred if the specified file contains 64 sectors.   

/Repair=# - Designed to fix a damaged, corrupt, or missing MBR.  Specifying an option of '1' will repair a PE/XP/2003 MBR. This may be expanded to other OS formats if the need exists.

/Show=x - Shows the partition structure from a backed up MBR.  Available options for x are a filename, the sector number containing the backup, or the word SECTOR if the contents have been previously saved to the hidden sector.

/Wipe=x - Selecting an option of 'mbr' will wipe the MBR clean, 'head' will wipe the first head or 63 sectors, and a range of sectors from x to y can be wiped by specifying /Wipe=x-y.  This will effectively remove all information from the specified sectors of the disk.

/Sort - It isn’t uncommon for the partition entries in the MBR to be unsorted after reinstalling Windows or restoring a Ghost image.  This means that the partition order in the MBR won't match the order on disk. Normally this wasn’t a problem until Windows NT/2K/XP came along with its new boot loader, and the requirement that each partition entry in the boot.ini must point to the actual partition number. This option will sort the entries in the MBR to match their physical order on disk.

/IsSorted - Queries the partition entry order in the MBR and  returns an ErrorLevel code based on the status of the partition entries: '0' = Sorted, '1' = Not Sorted

/Signature=x - Reads or Writes a new disk signature to the MBR.  Specifying 'Zero' will clear the existing signature, otherwise an 8 digit hex entry can be entered for the signature.  For example, /Signature= Zero, or /Signature= AC87AD87. Specifying /Signature with no options will display the existing disk signature.

/Copy=x - Copies the contents of one sector to another.  The /Sector=x command will specify the source sector, and will be copied to the sector specified by /Copy.  Please note, typically only the first 64 sectors (0-63) should be used as the destination, otherwise existing data on the hard disk may be overwritten. Selecting 0 as the target will overwrite and erase the contents of the MBR.

Partition Entry Options

/Hide=# - Hides or Unhides the specified partition to the operating system. An option of '1' or 'Yes' will hide the partition, while selecting '0' or 'No' will set the partition visible. If /Part=* is specified all partitions will be hidden/unhidden.

/Active=# - Sets the specified partition eithe active (bootable) or inactive. An option of '1' or 'Yes' will set the partition active, while an option of '0' or 'No' will set the partition non-bootable.  /Part=* can be selected to set all partitions inactive.  If setting the a hidden partition active, it will first be unhidden then set active. DOS and Win9x do not properly recognize multiple visible primary partitions, make certain any remaining primary partitions are unhidden if necessary.

/Type=# - Allows the partition type to be modified.  This is most useful if a partitioning or backup/restore program modifies the partition type and it needs to be restored back to the original type.  The # specified must be directly followed by either a d (decimal) or h (hexadecimal) in order to properly identify the new type.  This option must be used with /Partition in order to identify the partition being modified.

/Del - Deletes the specified partition.  Specifying /Part=* removes all partitions on selected disk, while specifying both /Disk=* /Part=* removes all partitions on all disks

The following items have been removed in order to remain OS independant, but will shortly be included in a new application.

/Mount=x: - Mounts selected volume with a specified drive letter. 'x:' identifies the drive letter to use for the mount.  The desired partition to mount can be selected either by /Part=# or /Vol=label

/UnMount=x - UnMounts the drive letter from the selected volume.  'x' identifies the partition #, volume label, or drive letter (x:) for the volume to unmount.

/Label=x - Modifies the Volume Label.  The new label is identified by 'x', and the correct volume is specified by either /Part or /Vol.

Miscellaneous Options

/Shutdown=# -An entry of '1' will force Windows to shutdown, '2' will force Windows to shutdown and reboot. '3' shuts down without force, and '4' reboots without force. Note, using the Force options may cause data loss if open programs contain unsaved data. NT/2K/XP/2003 version only.

/WipeDisk=# - Wipes (overwrites) each sector on the disk in order to securely erase all data. Selecting an option of '1' write zeros to all sectors. Additional methods coming. Wiping the System partition (C: drive) is not recommended under Windows as it will effectively crash Windows with a BSOD!  This option is currently only available under the Windows version, but will be expanded to DOS and Linux in the future.

/Status=x - Stores or Retrieves the status byte located at offset 0x1b0 in the MBR, which is widely recognized as an unused section of the MBR.  Specifying a value for 'x' will set the status byte, valid options are 0-255.  Selecting /Status with no options will return the current byte upon program exit.

/Confirm - Any operation that performs a change to the MBR will now ask for user confirmation before making the change.  Specifying /confirm on the command line overrides this request and defaults to Yes for each operation without prompting.

/BootMenu -This option will list the available, bootable partitions to the user, and set one active by secting from the menu

/Msg=# - Hides the status messages shown upon program exit.  An entry of '1' indicates that no messages should be shown, '2'=No error messages, and '3'=No status messages displayed on success.

/Ignore - Attempts to continue the specified operation if an error occurs.

/Result - Displays the return code for visual verification of success/failure.

/HideErrors - Hides the display of any errors that may occur. See /Msg.

/? - Show command line options


CommandFile - If no switches are specified on the command line, and a file by the name of mbrwiz.opt exists in the same folder as the executable, then the mbrwiz.opt file will be parsed for possible switches. Switches can be located on the same line, or dispersed across multiple lines. This option can be used when it's not possible to pass switches on the commandline. The following is a sample option file to save the disk 1 mbr to hidden sector, then reboot the machine
----------------------------
/disk=1 /save=sector
/shutdown=2
----------------------------

 

Notice!
MBRWizard only supports Primary and Extended partitions, there is no support for logical partitions.
Also...please remember that all disk and partition operations are zero based!
 
Examples

MBRWiz /part=0 /active=yes /shutdown=2
Sets the second partition on the first disk active and reboots the machine


MBRWiz /disk=1 /part=1 /hide=1
Hides the second partition on the second disk

MBRWiz /sort
Sorts the partition entries in the MBR based on physical disk location

MBRWiz /part=2 /del
Deletes the 3rd partition

MBRWiz /Save=a:\mymbr.dat
Saves the current MBR to a floppy disk with the filename mymbr.dat

MBRWiz /Sector=13 /Save=c:\sect13.dat
Saves contents of sector 13 to file sect13.dat

MBRWiz /show=13 
Displays the copied MBR structure at sector 13

MBRWiz /Disk=1 /Part=1 /Mount=Z:
Mounts the second partition on the second disk, assigning drive letter Z:

MBRWiz /Repair=1
Repairs the boot record on disk 0
 

MBRWiz /Part=2 /Type=7h 
Changes the partition type of the third partition on disk 0 to type 7 hex (NTFS)
MBRWiz Sector=2 /Copy=13  
Copies the contents of sector 2 to sector 13

MBRWiz /Restore=mbr.dat  
Restores the contents of file mbr.dat to sector 0 (MBR)
MBRWiz Sector=2 /Restore=mbr.dat  
Restores the contents of file mbr.dat to sector 2
 
 

 

 

 

 

 

 

 

 

Design downloaded from FreeWebTemplates.com
Free web design, web templates, web layouts, and website resources!


1