Using MBR.EXE To Set Up A Restore Partition
Using MBR.EXE To Set Up A Restore Partition
Copyright (C) 2005, TeraByte Unlimited. All rights reserved.
MBR.EXE is a DOS-based command line utility that can manipulate a hard drive’s master boot record (MBR). Among other things, it can install a modified version of the MBR code to facilitate the setup and use of a hidden system restore partition. This document will focus on using MBR.EXE for that purpose, and will concentrate on the issue of initially getting a restore partition set up and working. Please note that MBR.EXE is a TeraByte Unlimited program, and is to be used only for the purpose of supporting the use of TeraByte Unlimited products, such as Image For DOS.
Once properly set up, the restore partition will be hidden, and the system will normally boot into the regular operating system. However, if a specified key (such as F9) is pressed within a specified time during boot, the MBR code installed by MBR.EXE will boot the restore partition instead, so that the restore operation can take place. On the next reboot, the system will again boot into the regular operating system, unless the specified key is pressed again. Optionally, a text message can be displayed on the screen while the specified key is active. This message can be used (for example) to inform the user as to which key to press to boot the restore partition.
Setting up the restore partition consists of the following generalized steps. Each of these steps will be covered in detail in the remaining sections of this document.
• Step 1 - Set up the partitions, including creating a primary restore partition.
• Step 2 - Install an appropriate operating system on the restore partition.
• Step 3 - Set up the MBR with MBR.EXE to provide a means to boot the restore partition.
• Step 4 - Set up the restore partition to reset the partition table (if necessary).
The following software tools are suggested for setting up and implementing a restore partition:
FreeDOS Bootable Images – these bootable floppy disk and CD/DVD images are included in the zip archive with this document. They can be used to install either FreeDOS or TBOS as the restore partition’s operating system, and also to set up the MBR with MBR.EXE. Some batch files and other software are included to help automate some of the tasks involved, or to display information needed while setting things up. Please note that the use of TBOS and other software contained in the images is governed by their respective license agreements. See Appendix A for more information on the software included, how to use it, and the license agreements involved.
BurnCDCC - free utility available from TeraByte Unlimited that can be used to burn the bootable FreeDOS CD/DVD from the ISO image in this archive. Please see Appendix A for additional information.
IMGFLPYD - free utility available from TeraByte Unlimited that can be used to create the bootable FreeDOS floppy disk from the floppy disk image in this archive. Please see Appendix A for additional information.
BootIt NG - for partition creation, resizing, moving, and other partition manipulation as needed. See Appendix B for a primer on accomplishing some common partitioning tasks with BootIt NG. The complete BootIt NG Manual is available on the TeraByte Unlimited web site.
Image For DOS - for creating and restoring images interactively, or via the command line. The use of Image For DOS, including the command line options, is fully covered in the Image For DOS/Windows User’s Guide, which is available on the TeraByte Unlimited web site.
The remainder of this document works through setting up a hidden restore partition as outlined in the four steps listed above. The procedure outlined below, while workable, is primarily intended to serve as an example of how to use MBR.EXE to set up the restore partition. It makes use of batch files in the bootable floppy/CD images to combine and automate some of the tasks involved, but there is no particular requirement to use them if you would prefer to run individual (or customized) commands for each task.
Step 1 – Setting Up The Partitions
Quick Summary For This Section:
• Set up the partitions on the hard drive, including creating the new restore partition.
• Use a FAT32 or FAT16 primary partition as the restore partition.
• Leave the new restore partition visible (not hidden) for now.
• Set the restore partition active to ensure that it will be drive C: in the next section.
• BootIt NG is suitable for creating the partition, and for any partition manipulations needed to make room. It can also be used to manually set a partition active. See Appendix B for more details.
The first step is to set up the partitions on the hard drive, including creating a restore partition. While other partition layouts are certainly possible, one of the following two layouts is suggested:
Partition Layout #1
Partition 0 - Primary partition containing the bootable OS.
Partition 1 - Primary partition to serve as the restore partition.
Partition Layout #2
Partition 0 - Primary partition containing the bootable OS
Partition 1 - Extended partition containing one or more volumes.
Partition 2 - Primary partition to serve as the restore partition.
The numbering of the partitions above (0, 1, 2) is referring to their position in one of the four possible partition table slots. 0 is the first slot, 1 is the second slot, and so on. The PTVIEW.BAT batch file on the bootable FreeDOS floppy/CD can be run at any time to view the current partition table. It will show the primary partitions numbered in the same manner as shown above (i.e. the four slots are numbered 0 through 3).
Both of the partition layouts shown above place the restore partition after the OS partition(s). That is not a requirement, but you may find it has some advantages. For one thing, placing it last on the drive will simplify any partition manipulations needed to make room for the restore partition – especially if you are starting with the OS partition(s) already existing. If resizing or moving of the OS partition(s) is required, the BootIt NG program from TeraByte Unlimited can perform those operations on NTFS, FAT32, and FAT16 partitions. See Appendix B at the end of this document for a primer on using BootIt NG to manipulate partitions, and perform common tasks such as setting a partition active.
A FAT32 primary partition is suggested to serve as the restore partition, although FAT16 is also an option as long as the 2 GB maximum size of FAT16 will be large enough. If the system has more than one hard drive, the restore partition should reside on the first drive so that the MBR code installed by MBR.EXE can boot it.
When initially creating the restore partition, the partition should be left as a visible (not hidden) partition so that an operating system can be installed, and so that files can be copied to it in the next step. The partition should also be set active at this point. That will ensure that the restore partition will be seen as drive C: from the FreeDOS bootable floppy/CD in the next section.
Step 2 - Installing An Operating System To The Restore Partition
Quick Summary For This Section:
• Boot from the FreeDOS floppy or CD
• Verify that drive C: is the restore partition.
• Choose which operating system (TBOS or FreeDOS) to use for the restore partition.
• Run OSSETUP.BAT to automatically format the restore partition and install the OS.
• Optionally, you can format the restore partition and install the OS manually.
• CHKTBOS.BAT can be used to display partition identifiers (if using TBOS).
• PTVIEW.BAT can be used to display current partition table.
The next step is to boot the system from the FreeDOS floppy or CD mentioned earlier. Doing this will leave you at a FreeDOS command prompt on the Z: drive, which is a RAM drive set up automatically when booting from the disk. You will be in the Z:\TBU directory, which contains MBR.EXE, TBOSSYS.EXE, PARTINFO.EXE, four batch files, and a README.TXT file, which details the command line options for MBR.EXE. It also contains the FWLIC.TXT and LICENSE.TXT license agreements.
The FreeDOS floppy or CD is set up to give you a choice between TBOS and FreeDOS as the restore partition’s operating system. FreeDOS is intended as a full-featured alternative to commercial DOS operating systems. TBOS is a minimal OS that will automatically, on boot, run commands from a text file named TBOS.STR located in the root directory. The other thing about TBOS is that, unlike FreeDOS, it does not require the restore partition to be unhidden and set active in order to boot into it.
Installing TBOS or FreeDOS automatically by using OSSETUP.BAT:
The OSSETUP.BAT file was written to automate the installation of either FreeDOS or TBOS with the use of either one or two command line parameters. The first parameter represents the OS you want to use. The second parameter is only needed if you are using TBOS, and it is the partition identifier for the restore partition. Here’s the OSSETUP.BAT command line:
OSSETUP OS PartID
To install FreeDOS: OSSETUP FD
To install TBOS: OSSETUP TBOS PartID
“PartID” above is the partition identifier for the restore partition. It is required by TBOSSYS.EXE, which is the program that installs TBOS to a partition, and makes that partition bootable (similar to the SYS command for DOS). The partition identifier can be determined (or verified) by first running CHKTBOS.BAT, which will display the partition table on HD0 as TBOSSYS sees it. It uses the command TBOSSYS 0 0.
TBOSSYS will identify the four possible primary partition slots as 01, 02, 03, and 04. You need to determine which one is the restore partition, and use that number as “PartID” in the command line above. The number needs to be in the form of 0x01, 0x02, 0x03, or 0x04 on the command line. For example, if you are using Partition Layout #1, as described in the first section of this document, running CHKTBOS will show something similar to the following:
NO NAME 2996MB Pri (01) FAT-32
RESTORE 1098MB Pri (02) FAT-32
In this case, the restore partition is 02, so the actual command line would be: OSSETUP TBOS 0x02
When the OSSETUP command is executed, the restore partition will be formatted, and then made bootable with either SYS or TBOSSYS. An important thing to realize at this point is that the OSSETUP.BAT file assumes that drive C: is the restore partition. If this partition was set active before booting the floppy/CD, then it should be drive C: now. This, however, should be verified, or obviously you could wipe out another partition by formatting it accidentally with this batch file.
If using FreeDOS, a subset of the FreeDOS distribution will then be copied over to the restore partition, including default autoexec.bat and config.sys files. The default autoexec.bat file will already be set up with the required MBR 0 /RESET command to reset the partition table. (See Step 4). It also contains an example confirmation prompt using the free MSGBOX.EXE program from TeraByte Unlimited, and some basic examples of Image For DOS command lines for restore operations.
If using TBOS, a default copy of TBOS.STR will be placed in the root directory. This is a text file of similar function to autoexec.bat in DOS, and it must be modified so that it contains the command(s) that you want executed when the restore partition is booted. To execute a program, the complete file name must be used (for example IMAGE.EXE), and there can be no blank lines between commands. The default copy does not contain any executable commands, but it does contain some example command lines for Image For DOS.
Installing TBOS or FreeDOS manually with individual commands:
The commands listed below for each OS represent the same commands executed by OSSETUP.BAT when formatting the restore partition and installing the OS. These are listed as a reference for those who would prefer to run the commands manually, and/or need to customize them to better suit their needs.
Formatting the partition and installing TBOS:
format c: /v:restore
tbossys 0 partid
xcopy /e /h /q z:\tbosroot\*.* c:\
On the TBOSSYS command line, the 0 (zero) indicates HD0, and “partid” is the partition identifier for the restore partition as described above. Again, you can determine (or verify) the restore partition identifier by running CHKTBOS.BAT, and the value used on the command line must be 0x01, 0x02, 0x03, or 0x04. You can view an explanation of the TBOSSYS command line options by running ‘TBOSSYS /?’
Formatting the partition and installing FreeDOS:
format c: /v:restore
sys c:
xcopy /e /h /q z:\freedos\*.* c:\freedos\
xcopy /e /h /q z:\tbu\mbr.exe c:\tbu\
xcopy /e /h /q z:\tbu\partinfo.exe c:\tbu\
xcopy /e /h /q z:\tbu\ptview.bat c:\tbu\
xcopy /e /h /q z:\tbu\readme.txt c:\tbu\
xcopy /e /h /q z:\tbu\fwlic.txt c:\tbu\
xcopy /e /h /q z:\fdroot\*.* c:\
Step 3 - Setting Up The MBR With MBR.EXE
Quick Summary For This Section:
• Run SETMBR.BAT to install the MBR code and set up the partition table.
• This step will hide the restore partition, which will have to unhidden again to add or modify files.
The next step is to set up the MBR and partition table with MBR.EXE. As mentioned in the summary above, it is important to note that this step will HIDE the restore partition. So if any files need to be added or modified afterwards, the partition will have to be unhidden again to do that. The partition can always be unhidden by using a partitioning program like BootIt NG. It can also be done with MBR. EXE. For example, the command
‘MBR 0 1 /UH’ will unhide the second partition on HD0.
The Z:\TBU directory contains a batch file named SETMBR.BAT to automate the job of setting up the MBR. You need to run that batch file with two command line parameters as follows:
SETMBR Part1 Part2
Part1 is the OS boot partition – typically this value will be 0 (for partition 0)
Part2 is the restore partition – typically this value will be either 1 or 2 (for partition 1 or 2)
Again, these partition values correspond to the partition table slot that the partition occupies, as explained in the Step 1 section of this document. For example, if you use partition layout #1 shown in that section, your Part1 value will be 0, and your Part2 value will be 1. You can view your current partition table at any time by running the PTVIEW.BAT batch file. That should help you determine (or verify) the partition values used above.
This batch file runs three MBR.EXE commands, and then calls the PTVIEW.BAT batch file to show the resulting partition table. The three MBR.EXE commands do the following:
1) Set the normal OS boot partition active (to prepare for next reboot)
2) Hide the restore partition by setting it to the appropriate hidden partition type
3) Install the MBR.EXE code to the MBR
The first command sets the normal boot partition active. For the most common case where the OS boot partition is partition 0, the following command MBR.EXE would be used:
MBR 0 0 /A
The second command hides the restore partition. For example, if the restore partition is partition 2, the following command would be used to hide that partition:
MBR 0 2 /H
The third command installs the MBR code. It uses a different MBR.EXE command line, depending on whether you are using TBOS or FreeDOS. The batch file determines which OS you are using, by making use of the OS environment variable that is set to either “FD” or “TBOS” when OSSETUP.BAT is run in the previous step. (Can also be set manually if needed – i.e. SET OS=FD or SET OS=TBOS).
If using FreeDOS, the exact command line also depends on what type of restore partition you are using. There are 4 possibilities supported by SETMBR.BAT:
1) FAT16, non-LBA (completely within the first 8 GB) is type 0x6
2) FAT16, LBA (partially or completely beyond the first 8 GB) is type 0xE
3) FAT32, non-LBA (completely within the first 8 GB) is type 0xB
4) FAT32, LBA (partially or completely beyond the first 8 GB) is type 0xC
For each of the 4 types listed above, the partition is hidden by adding a 1 in front of it, so the corresponding hidden partition types will be 0x16, 0x1E, 0x1B, and 0x1C respectively. As an example, if you are using FreeDOS and an LBA type FAT32 restore partition, the following MBR.EXE command line is used:
MBR 0 /INSTALL SELM 3 9 “Press F9 To Restore” 0xC 0x1C
As shown above, the 0 (zero) indicates HD0, and F9 is the restore hotkey, which is available for 3 seconds on boot. The message “Press F9 To Restore” will be displayed for those 3 seconds. The SELM indicates that the restore partition will be unhidden and set active when it is booted. This is required when using FreeDOS as the OS. The 0xC is the visible partition type that the restore partition will be set to when it is unhidden. The 0x1C is the hidden partition type that the MBR code will look for in the partition table in order to locate the restore partition and boot into it. Once the restore partition is booted, the MBR 0 /RESET command in the autoexec.bat file will change the partition type back to 0x1C, and set the OS partition active again.
If you are using TBOS, the following MBR.EXE command line is used:
MBR 0 /INSTALL SEL 3 9 “Press F9 To Restore”
Again the 0 (zero) indicates HD0. F9 will be the hot key available for 3 seconds, and the “Press F9 To Restore” message will be displayed for those 3 seconds. The SEL indicates that the restore partition will NOT be set active and unhidden when it is booted. TBOS does not require this, and so no partition type parameters are needed on the command line.
If you need to customize these MBR.EXE commands to better suit your needs, you can refer to the README.TXT file located in the Z:\TBU directory. It contains a full explanation of the MBR.EXE command line options. In addition, the SETMBR.BAT file has provisions at the beginning of the file to modify the values for the timeout, the restore hot key, and the message to display while the key is active on boot. Note that when you run SETMBR.BAT, it will display the exact command line used for the third MBR.EXE command (the command that installs the MBR code).
Step 4 - Setting Up The Restore Partition To Reset The MBR Automatically
Quick Summary For This Section:
• Set up the restore partition to automatically run MBR 0 /RESET when booted.
• This step is not needed if using TBOS for the restore partition’s OS
As stated in the summary above, this section only applies if you are using FreeDOS as the OS. Resetting the MBR after booting into the restore partition is not required if using TBOS.
The restore partition will actually already be set up to do this if you installed FreeDOS by using the OSSETUP.BAT file in the Step 2 section of this document. If not, you just need to know that the following MBR.EXE command needs to be run (typically from autoexec.bat) in order to reset the partition table:
MBR 0 /RESET
That tells MBR.EXE to rehide the restore partition, and set the normal boot partition active again. The 0 (zero), just means it is doing this on HD0. To hide the restore partition, MBR.EXE will use the hidden partition type that was specified when installing the MBR code in the previous section.
Summary
This completes the setup with the exception of setting up Image For DOS for the actual restore operation. The default AUTOEXEC.BAT and TBOS.STR files contain some example command lines and other tips. Complete information can be found in the Image For DOS/Windows User’s Guide.
Appendix A – Additional Information On Using The Bootable Images
This section is intended to provide additional information on using the bootable floppy or CD/DVD images contained in this zip archive. The two image files included contain exactly the same software. MBRSETUP.FLP is a floppy disk image file for creating a bootable floppy disk, while MBRSETUP.ISO is an ISO file that can be used for burning the equivalent bootable CD or DVD.
License Information For The Included Software
MBR.EXE – This program is provided by TeraByte Unlimited to manipulate the MBR for the purpose of setting up a hidden restore partition, which in turn makes use of Image For DOS to carry out the actual restore operation. MBR.EXE is to be used only for the purpose of supporting other TeraByte Unlimited programs such as Image For DOS. The use of MBR.EXE is governed by the Freeware License Agreement, which is contained in the file FWLIC.TXT located in the TBU directory of the bootable images.
TBOS – This is an operating system provided by TeraByte Unlimited, which can (optionally) be used as the restore partition’s OS. The program TBOSSYS.EXE is used to install TBOS, and that file is included in the bootable images. The use of TBOS is governed by the TBOS Add-On License Agreement, which is contained in the file LICENSE.TXT located in the TBU directory of the bootable images. That file will be copied to the root directory of the restore partition by OSSETUP.BAT if TBOS is used as the OS.
PARTINFO.EXE and MSGBOX.EXE - These two programs are provided by TeraByte Unlimited as an aid in setting up and implementing the restore partition. Their use is governed by the Freeware License Agreement contained in the FWLIC.TXT file.
FreeDOS – This is a free operating system used to boot and run the bootable images, and can also (optionally) be installed as the restore partition’s OS. FreeDOS is licensed under the terms of the General Public License (GPL). A copy of that license is included in the FREEDOS directory of the bootable images in the file GPL.TXT. If FreeDOS is installed to the restore partition, the file GPL.TXT will also be included in the FREEDOS directory there.
How To Create The Bootable Floppy Disk From MBRSETUP.FLP
The program IMGFLPYD can be downloaded from the free software page at the TeraByte Unlimited web site. Once downloaded and unzipped, place the file MBRSETUP.FLP in the same directory as IMGFLPYD.EXE, and then run the following command from that directory to create and validate the floppy disk:
imgflpyd a mbrsetup.flp /write
Note that you can run ‘imgflpyd’ without parameters to get an explanation of usage, including the command line options. The included README.TXT file contains similar information.
How To Create The Bootable CD Or DVD From MBRSETUP.ISO
The program BurnCDCC can be downloaded from the free software page at the TeraByte Unlimited web site. This is a Windows program that will burn a CD or DVD from an ISO file. After unzipping the archive, you can run BurnCDCC by simply double clicking on BURNCDCC.EXE. From there, you need to point it to MBRSETUP.ISO by using the Browse button next to the File Image window. Then after making sure that your burner device is selected in the Device window, click on Start to burn the CD/DVD. The additional options are explained in the README.TXT file included in the zipped archive.
Miscellaneous Notes On Using The Bootable Images
The EDIT.EXE program is included if you need to edit or create text files while running from the bootable images. If you install FreeDOS as the restore partition’s OS, it will also be available when booted from that partition, as will all FreeDOS commands included in the bootable images.
The SETMBR.BAT file has provisions for customizing three MBR.EXE parameters by editing the file. Those are the timeout value in seconds (TO), the specified function key to press on boot (FKEY), and the message to display while the specified function key is active (MSG). These variables are initialized to their default values near the beginning of the file, so you can simply edit them to your needs. SETMBR.BAT will always display the actual MBR.EXE command line that installs the MBR code after the command is executed, so any changes you make will show up there.
When using the SELM option of MBR.EXE to install the MBR code (as when FreeDOS is the restore partition’s OS), you have the option of using hidden partition types other than the four (0x16, 0x1E, 0x1B, and 0x1C) supported by the SETMBR.BAT batch file. This will require running the command manually (or customizing the batch file). See the README.TXT file in the TBU directory for more information on MBR.EXE usage and options.
If the target system’s OS is Win2K or WinXP (or newer), leaving the restore partition unhidden once while booting into Windows will cause that partition to always be visible to Windows, even after it is subsequently hidden in the partition table. While this can be helpful when setting things up on the restore partition, you will eventually want to get the partition hidden again. One way to do that is to use BootIt NG’s Clear Sig feature. See the last item in Appendix B for more information on that.
Appendix B – Using BootIt NG For Partitioning Tasks
It is not necessary to install BootIt NG to the hard drive in order to use it for partitioning tasks. Instead, it can be run from the installation media (a bootable floppy disk or CD) by canceling out of the Setup prompt and entering Maintenance Mode. From there, the Partition Work icon can be chosen to work on partitions. If you have more than one hard drive, the first drive (HD0) will be selected by default.
Here is a list of tips for accomplishing the partitioning tasks that are most likely to be needed when setting up a hidden restore partition:
Creating a partition: In Partition Work, highlight the free space (unpartitioned space) where you would like to create a new partition. Choose the Create button, and then choose the desired partition type from the File System drop down list. For the restore partition, the FAT32 file system should be chosen. In the Size dialog box, enter the desired size for the new partition, then choose OK.
Resizing a primary partition or a volume in an extended partition: In Partition Work, highlight the partition or volume you would like to resize, and then choose the Resize button. After a file system check, you will be presented with the Resize dialog box. Enter the desired new size in the New Size box, and click OK. Note that to increase the size of a partition, there must be free (unpartitioned) space available immediately following (below) the partition.
Resizing an extended partition: In Partition Work, highlight the extended partition, and then choose the Resize button. A dialog box will come up that will allow you to change the Beginning or End point of the extended partition. For example, if you had 2000 MB of free space at the end that you would like to move outside of the extended partition (thus making the extended partition smaller by 2000 MB), you would enter 0 in the End /Free Space Inside box, and then choose OK.
Sliding (moving) a primary partition or a volume in an extended partition: Highlight the partition or volume that you would like to slide, and then choose the Slide button. In the dialog box that comes up, enter the amount of free (unpartitioned) space you would like to have before/after the partition when the slide is completed. Then choose OK. Note that a slide operation requires that the necessary free space already exists immediately before/after the partition you are sliding.
Setting a partition active: In Partition Work, choose View MBR. This window will display the current partition table, and will show up to 4 possible primary partitions. The 4 possible partition entries in View MBR, correspond to primary partition slots 0 through 3, as described in the Step 1 section of this document. If one of them is already set active, this status will be shown next to the partition. To set any partition active, highlight that partition, choose the Set Active button, and then choose Apply. You can verify the results by opening View MBR again.
Hiding or unhiding a partition: In Partition Work, highlight the partition and choose Properties. Depending on the current hidden/unhidden status, there will be either a Hide or Unhide button available to toggle the status.
Clearing the Win2k/XP disk signature: After setting up a system using the procedure outlined in this document, the restore partition will be hidden. However, if during the process Windows should be booted up while the partition is still visible, the partition will continue to be visible in Windows even after it is hidden. One way to correct this is to go into View MBR and choose the Clear Sig button, and then choose Apply. Doing this will erase the disk signature stored in the MBR, and will cause the restore partition to be hidden from Windows (assuming that it is already marked as hidden in the partition table).
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- verification batch language design
- using to set up a restore partition
- configuring a java development environment
- pi batch file interface
- unix batch job system proposal sourceforge
- multi batch help and overview bentley communities
- this tip will show you how to augment the pmrep command s
- pi batch file interface nt vax and unix
Related searches
- how to set up a resume
- how to set up a small business
- how to set up a business
- how to set up a mla paper
- how to set up a consulting business
- how to set up a reference page
- how to set up a youtube channel
- how to set up a nonprofit foundation
- how to set up a web page
- how to set up a 501c3 organization
- how to set up a mutual fund
- how to set up a website