Grub4dos Guide - Examples
There is often more than one way to boot an operating system under Grub4dos - there is no "correct" method. This is illustrated in the following examples, in which MSDOS is booted from the first partition on the first hard disk (hd0,0).
Example 1
- chainloader (hd0,0)+1 [enter] - boot partition boot sector.
- root (hd0,0) [enter] - mount partition, note feedback (see below).
- boot [enter]
NOTE(s) - Using the root command will fail if the filesystem is not recognised.
Feedback when inputting the above commands -
grub> chainloader (hd0,0)+1
grub> root (hd0,0)
Filesystem type is fat, partition type 0xe
grub> boot_
Example 2
- chainloader (hd0,0)+1 [enter] - as example 1
- rootnoverify (hd0,0) [enter] - set root partition but do not attempt to mount it, note lack of feedback (see below).
- boot [enter]
Feedback when inputting the above commands -
grub> chainloader (hd0,0)+1
grub> rootnoverify (hd0,0)
grub> boot_
Example 3
- root (hd0,0) [enter] - as example 1
- chainloader +1 [enter] - as root has already been set, relative paths can be used in the following commands. In this case +1denotes the first sector (the partition boot sector) of the current root device.
- boot [enter]
Feedback when inputting the above commands -
grub> root (hd0,0)
Filesystem type is fat, partition type 0xe
grub> chainloader +1
grub> boot_
Example 4
- find --set-root /io.sys [enter] - by using the find --set-root command, the boot options are not hard coded to a specific partition and will scan the root of all supported drives for the file io.sys. The device (or partition) containing the first located instance of the specified file will be set as the root device, and all other commands issued will be relative to this device. Although this allows for non-system specific menu entries in the configuration file, it should be remembered that if the file is present on more than one device (or partition) then the wrong device might be set as root. Consider searching for a unique marker file as opposed to a system file (e.g. find --set-root /hd00.tag).
- chainloader +1 [enter] - as example 3
- boot [enter]
Feedback when inputting the above commands -
grub> find --set-root /io.sys
(hd0,0)
Filesystem type is fat, partition type 0xe
grub> chainloader +1
grub> boot_
The command chainloader (hd0,0)+1 can be substituted with chainloader (hd0,0)/io.sys in examples 1 and 2, and the command chainloader +1 can be substituted with chainloader /io.sys in examples 3 and 4. E.g. -
- find --set-root /io.sys [enter]
- chainloader /io.sys [enter]
- boot [enter]
Feedback when inputting the above commands -
grub> find --set-root /io.sys
(hd0,0)
Filesystem type is fat, partition type 0xe
grub> chainloader /io.sys
Will boot MS-DOS 7.x from drive=0x80, partition=0x0(hidden sectors=0x3f)
grub> boot_
As previously noted in the guide, booting in this way makes no use of the MBR code, and no use of the bootsector code, as the operating system file is chainloaded directly. This means that, as long as the partition data in the bootsector is intact, grub4dos can recover a system when the booting code is corrupted, or points to another system file.