iMBR_editor(8) | System Manager's Manual (x86) | iMBR_editor(8) |
iMBR_editor | <an iMBR bootcode file> <a device/file with an MBR to edit> <a device/file with the MBR to write> |
The bootcode present in the MBR typically examines the partition table with four entries, finds the partition that is marked ‘active’, loads into memory the first sector of that partition (this sector is called the Partition Boot Record or PBR), checks the signature of the PBR and passes control to the next stage bootcode stored in the PBR.
The traditional MBR bootcode can only boot from a single ‘active’ partition. iMBR(8) allows the user to interactively select a partition to boot from.
iMBR_editor is used to display or update the iMBR(8) options of the MBR.
The iMBR bootcode file: iMBR The device/file with an MBR to edit: mbr.fd0 The device/file with the MBR to write: fd0.mbr +-----------+----------+-----------+---------+ | partition | ID, hex | boot flag | OS name | +-----------+----------+-----------+---------+ | 0 | 00 | | | | 1 | 00 | | | | 2 | 00 | | | | 3 | 00 | | | +-----------+----------+-----------+---------+ +------------+------------+------------------+ | iMBR | default OS | timeout, seconds | +------------+------------+------------------+ | | | | +------------+------------+------------------+ <1> read the MBR <2> load the iMBR bootcode <3> set an OS name <4> switch a partition boot flag <5> set the default OS <6> set the timeout <7> write the MBR <8> print a partition geometry <Esc> exit press the key:
To configure iMBR(8) options (see Configurable options of iMBR) the existing MBR must be read and the iMBR(8) bootcode must be loaded (keys <1> and <2>):
+-----------+----------+-----------+---------+ | partition | ID, hex | boot flag | OS name | +-----------+----------+-----------+---------+ | 0 | xx | | | | 1 | xx | | | | 2 | xx | | | | 3 | xx | | | +-----------+----------+-----------+---------+ +------------+------------+------------------+ | iMBR | default OS | timeout, seconds | +------------+------------+------------------+ |############| | 1 | +------------+------------+------------------+
‘xx’ means a partition identifier (type) in hexadecimal notation (for example, ID for FAT32 is ‘0C’).
iMBR_editor keys functions are obvious from brief descriptions on the iMBR_editor screen (see above; for the key <7> see CAVEATS; for the key <Backspace> (or <BS>) see BUGS).
To install and configure the iMBR(8) bootcode on OpenBSD with boot disk ‘sd0’ run:
# iMBR_editor ./iMBR /dev/rsd0c /dev/rsd0c
To install and configure the iMBR(8) bootcode on NetBSD-i386 (tested on v7.1) with boot disk ‘wd0’ run:
# iMBR_editor ./iMBR /dev/rwd0d /dev/rwd0d
To install and configure the iMBR(8) bootcode on GNU/Linux (tested on Debian GNU/Linux-amd64, v9.3) with boot disk ‘sda’ run:
# iMBR_editor ./iMBR /dev/sda /dev/sda
To install and configure the iMBR(8) bootcode on Windows run ‘cmd.exe’ as ‘Administrator’, then in the ‘cmd.exe’ window run:
C:\TMP>iMBR_editor iMBR \\.\PhysicalDrive0 \\.\PhysicalDrive0
To save the existing MBR (on OpenBSD, boot disk ‘wd0’) to the file “saved_MBR” run:
# iMBR_editor ./iMBR /dev/rwd0c saved_MBR
and press <1>, then <7>.
To restore saved MBR (on NetBSD-i386, boot disk ‘wd0’) from the file “saved_MBR” run:
# iMBR_editor ./iMBR saved_MBR /dev/rwd0d
and press <1>, then <7>.
To prepare new MBR (on Windows) with iMBR(8) options and save it to the file “new_MBR” run:
C:\TMP>iMBR_editor iMBR \\.\PhysicalDrive0 new_MBR
press <1>, <2>, configure iMBR(8) options, then press <7>.
To install previously prepared MBR (on GNU/Linux, boot disk ‘sda’) with iMBR(8) options from the file “new_MBR” run:
# iMBR_editor ./iMBR new_MBR /dev/sda
and press <1>, then <7>.
The device/file read/write permission is necessary to read/write the MBR.
Before any MBR modifications save (!) the original MBR somewhere so it can be easily restored in cases of unexpected events.
There are operating systems which do not use PBR for booting (for example, some GNU/Linux distributions with “GRUB” installed as MBR). In these cases iMBR(8) will not be able to boot such operating system. But it is possible to replace the appropriate empty PBR with the MBR installed by this operating system, and then install and use iMBR(8). For the above example, if the installed GNU/Linux operating system has the root filesystem in the first primary partition of the boot disk ‘hda’ and uses “GRUB” as MBR for booting (and the appropriate PBR is empty!), then the following GNU/Linux command will replace the empty PBR with the original MBR:
# dd if=/dev/hda of=/dev/hda1 bs=512 count=1
January 28, 2018 |