Grub4dos tutorial. From Grub4Dos Wiki. Jump to: navigation, search. 1 Introduction. 1.1 What is GRUB for DOS. Then copy grldr to C:, and create the GRUB4DOS configuration file at C: menu.lst. Next time you start windows, there is a new option 'Start GRUB4DOS' which can be used to start GRUB for DOS.
Please read post #21 of this thread first -Edited 19 Jan 2006-reference to 'Just booting tips' added- -Edited 30 Dec2006 -A ' is now avaibale - I apologise for this long thread. To simplify it I have cut it into separate posts Part 1 - main menu of 100+ systems Part 2 - special menu for BSD and Solaris systems Part 3 - Q & A So that you don't have to bother with the bits of no interest to you.
Edited addition: After this thread I have since put together a collection of booting tips in If you have an issue with Windows and desire Grub not to take over the MBR then may be relevant Linux and its boot loaders are relentlessly under continuous improvement. The purpose of the thread is to document in 2005 how easy for a newcomer like myself to mulit-boot different operating systems in a PC because up to 1.5 years ago I knew nothing about booting or Linux after being served exclusively by the MS systems. It is hope that the thread may be of use to the newcomers who are unsure if the inherently powerful Linux can also be easy to learn and boot. Edited note -The above para. Has been colored red after the thread has been incorrectly reported/interpreted in the Internet. My intention is to demonstrate that Linux is easy to learn, powerful to use and simple to boot. This may be my personal view but at least I offer proof.
Part 1 of 3 - (A) One Grub menu that boots 100+ systems The 100+ systems comprise of 3 Dos 3 Windows 5 BSDs (in Part 2 Menu) 2 Solaris (in Part 2 Menu) 97 Linux including 2 versions of NetBSD I have kept all the boot loaders of the above systems. Grub is used to boot all of them because it is the only one capable of handing a large number of systmes. I had no access to a commercial boot loader and relied solely on the standard facilities within Linux. Initially I hope to have one menu for all the above systems but ran into technical problems with the BSD and Solaris system because their conflicts with the extended partition in a disk. I had to separate the BSD and Solaris into their own hard disks and the menu is described in Part 2.
Here is the Grub menu that boots 100+ systems. Code: mkdir /mnt/hda9 mount /dev/hda9 /mnt/hda9 chroot /mnt/hda9 lilo-b /dev/hdaI mention replicating the boot loader here because 83% of the 100+ systems have been 'chainloaded' using Grub to boot another boot loader. Chainloading works only if a system keeps a copy of its boot loader in its root partition. (D) Booting techniques involved There are only two methods available to Grub to boot an operating system.
(D.1) Direct booting When Grub can read a filing system it goes into the required partition to load its kernel and also the ram disk file 'initrd' if used. This is how Grub boots all Linux and some BSDs when being employed as their boot loader. Typical instructions to tell Grub to carry out this task are. Code: title rPath 0.99 @ hdc31 kernel /boot/vmlinuz-2.6.13.4-1.x86.i386.cmov ro root=/dev/hdc31 quiet initrd /boot/initrd-2.6.13.4-1.x86.i386.cmov.imgThe first line identifies the root partition to be booted.
The second line 'kernel' command is to fetch the kernel named as 'vmlinuz-2.6.13.4-1.x86.i386.cmov'. The initrd command of the third line is to load the ram disk file 'initrd-2.6.13.4-1.x86.i386.cmov.img'. (D.2) Indirect booting When Grub can't read a file system foreign to itself it boots that system's own boot loader instead. It is up to that boot loader to boot its own master.
This method is known as chainloading in which the first 512 byte of Grub is 'cut' and 'paste' with a second boot loader starting at its 513th byte position. This is the 'general' method used by all other boot loaders, like NTlrd and Lilo, capable of multi boot. Every boot loader needs to have a stage-1 and stage-2 because the former is always 512 bytes large ready to be read by the BIOS if this boot loader is in the MBR. The duty of Stage-1 is to load the Stage-2 which in turn does the actual loading of the system. The following systems appear to have no problem for being booted indirectly by Grub;- Dos, Windows, BSD, Solaris and Darwin x86 A Linux can also be booted indirectly but the distro may fail if it were installed but has not been designed beyond 137Gb barrier in a hard disk or in a partition number higher than 16. In such case it may be still bootable by directly method.
Both recent versions of Lilo and Grub have no problem crossing the 137Gb barrier or high partition number or I have not met one that has an issue with it. It is a common mistake to blame on the boot loader even if it is the kernel that fails to locate the root partition. The main advantage of indirect booting is that the partition number is the 'sole' information needed to boot that system, with 3 generic lines needed. Code: title This is a system in jth partition of ith disk root (hdi,j) chainloader +1Grub counts from 0 and so the 3rd partition in the second disk will have root (hd1,2) One can actually say the success of the booting of the 100+ systems was made possible essentially by Grub's ability to 'chainload' the boot loaders of the other systems. It should also be stated here the indirect method used by Grub is no different from any of the boot loaders in the above 100+ systems except Grub is the simplest of them all. (E) Some featues of Grub In using NTldr, Lilo, Loadlin, BSD and Solaris boot loaders I found Grub excels others by the following features (E.1) Grub can be implemented unattached to an operating system to carry out the booting manually. It acts simply as a mini operating system of its own prior to a user asking it to boot the 'main' system of his/her choice.
This feature is unique amount the boot loaders of the above-mentioned 100+ systems. When booting manually step by step the process is extremely fast as Grub is a very small program. This combination allows a user to know his/her mistake immediately at every steps. By entering the amended command a user is able to boot a system up virtually by trial and error without wasting time to reboot the computer repeatedly. (E.2) The automation of booting in Grub is done by executing a script file which is always stored as /boot/grub/menu.lst or /boot/menu.lst. Thus a user totally ignorant of how to boot a Linux by Grub can ask Grub to display this file on the screen and type in the same instruction to boot the system manually.
As one can ask at a Grub prompt to see the partitioning scheme of any disk, display the configuration file showing how a Linux is to booted, search the partition that has the appropriate booting configuration file (the equivalent to Grub's /boot/grub/menu.lst for Lilo is /etc/lilo.conf and so Grub can boot a Linux served by Lilo) therefore a user can, with the use a Grub floppy or CD, to boot any PC system in a computer totally new to him/her. Unlike Lilo, which checks the accuracy of its configuration file /etc/lilo.conf every time a change has been made, the entries in a Grub's menu.lst does not need to be 100% operable. Thus one can compile the 100+ systems menu, copy it in a PC even before any of the 100+ systems is installed, as Grub can be installed in a partition on its own.
By instructing a Linux installer to put its boot loader inside its root partition the Linux become instantly bootable on completion of the installation by the previously-prepared menu. The Grub menu above still have 20 empty partitions ready for this purpose. (E.3) Grub has 'hide', 'unhide' and 'map' commands to make unwanted partition invisible to the booting system.
These commands allow systems originally not designed to co-exist together can still be installed and booted in one machine. For example MS own boot loaders are incapable of booting all versions of Dos and Windows together and a BSD system can have conflict with the second and third BSD installed into the same hard disk, yet with Grub all these become possible. (E.4) Grub has a scrolling screen able to accept 100+ booting entries. This is far more powerful than the Solaris/BSD's boot loaders, Windows' NTldr and Linux's Lilo which have a static boot screen with a maximum of 4, 10 and 27 entries respectively. (E.5) Grub can be installed anywhere in a bootable media like a floppy, a CD, the MBR of the first bootable disk, any root partition of a system (Grub is used by Dos, Linux, BSD or Solaris).
When it is installed and attached to a system it always boots to that system. However Grub can also be installed without a system in a tiny partition with nothing except itself. Last edited by saikee; at 06:54 AM. (F) A few points to watch out in booting (F.1) All Dos, Windows, Solaris and BSDs need to be installed and booted from primary partitions.
The only exception I am aware of from this group is NetBSD which can be fitted inside a logical partition. I have two versions installed in partitions sda11 and sdb5. (Edited addition:I have been made aware that it is possible to install MS systems in logical partitions by amending MS MBR by ). (F.2) The Unix systems have an inner subdivisions treated as logical partition by Grub. Linux conforms to PC standard by disallowing more than one extended partition and so the fifth partition and above are always used to denote logical partitions.
The extended partition can only be created when one of the 4 primaries is not used. This means both MS and Linux systems have no mechanism to distinguish from which of the 4 primaries the logical partitions come from. BSD and Solaris on the other hand can name their inner subdivisions uniquely according to their primary partition position. This creates a problem for Grub if more than one Unix system is installed into a hard disk because the Unix inner subdivisions are named as 'a', 'b', 'c'.etc. Two BSD systems in the same disk will have two 'a' inner subdivisions and BSD's boot loader appears to only boot the first one it encounters. Thus hiding/unhiding technique is needed for booting several BSDs in the same hard disk. More details are given in Part 2.
(F.3) The Unix uses an alphabet system to name the inner subdivisions and therefore the maximum number of BSD-subparts is limited by the number of alphabets available. Linux permits up to 60 logical partitions in an IDE (and 15 partitions for a Sata/SCSI disk). It appears that a BSD cannot tolerate the presence of such large number of logical partitions and would not install or operate. My current solution is to use BSD and Solaris on their own disks, as described in Part 2. (F.4) Many Linux have not been engineered to cross the 137Gb barrier or to cope with a partition number higher than 16 in a hard disk. If such system can be installed beyond its designed limit it usually fails to boot and cannot be chainloaded because some of its components cannot find its own root partition. This type of Linux can still be booted using the direct method.
Details are obvious inside the 100+ system Grub menu. In extreme cases I had to use the kernel from another Linux to boot them.
(F.5) There is a potential confusion that a user may mix up a Grub shell with a Grub prompt. The former is what you get when typing at Bash shell the command 'grub'. At which time the Linux would have already been in operation in a 'protected' mode and many Grub's booting instructions would have been disabled to protected the Linux. Small amount of commands are still usable. A Grub prompt is obtained after booting Grub only and 'without' a Linux presence.
At a Grub prompt one can choose any system to boot and all the Grub commands are operable. (F.6) The actual maximum number of partitions permitted in Linux for an IDE disk is actually 60 including the extended partition.
The maximum partition number 63 can be reached when no primary partition is used so that the 5th to 63th plus the extended partition itself amount to 60 again. The extended partition exists in name only and has no usable storage area inside. (G) Some statistics of the 100+ systems (G.1) Linux is a system by the people for the people. The 97 distros installed in my box originated from 27 countries and 3 different regions.
The contributions are from Argentina(1), Asia(1), Australia(4), Austria(1), Belgium(1), Brazil(1), Canada(6), China(2), Czech(1), Europe(1), France(5), Germany(10), Global(3), Hungary(2), Isle of Man(4), Israel(2), Italy(1), Japan(3), Netherland(2), New Zealand(1), Norway(3), Poland(1), Puerto Rico(1), S Korea(1), Sweden(1), Switzerland(1), Syria(1), Taiwan(1), UK(3), USA(32). (G.2) The main menu boots 103 systems. 85 (83%) of the 103 systems were indirectly booted by chainloading while the remaining 18 (17%) require direct booting. (G.3) The average size of the Linux is only 2.24Gb.
Minimum size is 0.4Gb while the biggest dsitro Quantian 0.7.9.1 at sdb10 has 7.57 Gb. Quantian has been pre-packed with a lot of educational software and should be regarded as an exception. The next largest Linux is Knoppix 4.0.2 with 5.1Gb. All the rest are below 5Gb. (G.4) I have only one personal data Fat32 partition in sda14 accessible by all systems.
The one swap partition hda5 is picked up by every Linux in installation without my intervention. (G.5) Out of the 97 Linux distros 60 use Grub while 37 use Lilo as the boot loader. There are only a few distros that offer both choices from which only one can be nominated. (G.6) For those who wonder if a user needs to compile a kernel and search for drivers in order to use a Linux I have some news for them. I have never had a need to compile a kernel (got over 90 of them to choose from, haven't I?) and never had to find a driver for all of my distros.
The only bit I have done over and above what is provided by the Linux was to download the latest Grub and built it into the distros to help me to boot them. (H) Recommendations for users intending to multi boot (H.1) It is always better to partition the disk first. You will know exactly where the systems are going to reside in. Your own data in other partitions are safer from inadvertent damage. You are less likely to be confused by the installer. (H.2) Try not to mix your personal data with an operating system.
An operating system can go down any time so it pays to keep the personal data on a separate partition that can be read and written by all systems. The personal data will be a lot easier to backup and maintained. (H.3) I prefer to use one partition per Linux and have not met any resistance and suffered any drawback. It is definitely easier to boot and maintained. (H.4) Learn to boot the system manually. This will force you to use Grub because other boot loaders do not have manual booting capability. You will have a much better appreciation of how a system is booted.
Grub will always warn us with an error message if it has found an instruction difficult to comply. It is therefore a lot easier to be confronted with one hurdle at a time instead of looking at a compound problem as a result of several faults. Part 2 of 3 (BSD/Solaris systems) - (2A) The Grub menu. Part 3 of 3 (Q&A) - (H) Q & A Q1: How long did it take you to boot the 100+ systems? A: I started my Linux adventure 18 months ago. I have been trying to “retain” what I have installed from the free downloads.
Q2: Are you from the computer industry? A: No just an average user of a PC. Trained as a civil engineer by profession. Use the computer to 'calculate'mainly. Q3: Why did you do such a stupid thing? Nobody in his right mind needs 100+ systems to work on.
A: I found booting with Linux easy and simple. Just to want to see what is the limit for Grub to boot other systems. Q4: What is your point of showing off 100+ systems booted by Grub?
A: To help people still with problems with 'dual boot', 'tri boot' in Linux. Q5: This Grub floppy sounds fantastic but I haven’t got a Linux in my PC how can I make a copy? A: Easy piece, just download a Linux Live CD that supports Grub and use it to generate the Grub floppy Q6: Which Live CD can I find Grub support? A: Mepis, Puppy,Damn Small Linux, Linux rescue CD, Ubuntu, Arch Linux, Q7: Can you give the instructions for making a Grub floppy with a Live CD and no installed Linux? A: Boot up the Live CD, click terminal, ask Linux to find the directory that holds stage1 and stage2 files, change directory to it, pop in a floppy and use Linux’s dd command to write the Grub’s atge1 and stage2 files onto the floppy.
For Mepis 3.3.2 Live CD you will find the files stage1 and stage2 in /linux/lib/grub/i386-pc directory or any directory you find stage1 in the Live CD of your choice. The file stgae2 is always in the same directory. You then type (using /linux/lib/grub/i386-pc as the directory as an example here so please adjust to suit your own circumstance).
Lilo -b /dev/hda6 Q11: How do I replicate the boot loader for a Dos, Win3x, Win9x, Win2k and XP? These systems must be installed in an active primary partition and will automatically have their boot loaders installed in their root partitions by default. Q12: How do I replicate the boot loader for a BSD and Solaris? A: During installation of these system do not permit the boot loader into the MBR and each system will automatically place its boot loader in the root partition. Q13: How is your method differs from my Linux’s Grub in booting Windows?
A: My method is same as how Grub boot every Windows. With a Grub floppy you do it manually but the process is automated by a script file always stored as /boot/grub/menu.lst. Putting Grub in the MBR save you the typing work, that is all. Q14: So all the instructions of how to boot a Linux or Windows manually are already inside the /boot/grub/menu.lst of my Linux?
It is all there. Except in manual booting you always end the instruction with a statement. Title My Linux in hda7 chainloader (hd0,6)+1 Q18: So the “label” statement in Lilo is same as “title” statement in Grub? A: Except Lilo has a fixed field limiting the number characters in the label statement.
You can put any thing in Grub’s “title” statement. Q19: Why are you so keen on the indirect booting or chainloading? A: I am a simple guy who can't cope with complications.
Naturally one one set of instruction to boot all the systems is easy on me. Q20: Grub seems to be a nice boot loader, it is a shame we haven’t got it in FreeBSD. A: The standard Grub can be built into all Dos, Linux and BSD.
Just follow the instruction from the GNU/Grub site. I have it installed in FreeBSD, PcBSD, DesktopBSD and DragonflyBSD. I just follow the instruction given by Appendix A of the Q21: Having installed a large number distros yourself which one is the best? A: There are horses for courses so it is up to the individual to sample and pick the ones he/she likes. The big distros are always well put together, robust in variety of situations and well supported by documentations.
For newcomers any distro will do. By exposing to more than one distro one can pick on the common commands easier and able to survive better in a new environment. Q22 Is Grub the best boot loader to use? A I can’t confirm that even after I have used it extensively.
It is definitely the easiest among the boot loaders in the above 100+ systems. I am just surprised that I could get so much out of it when others don’t seem to bother.
Q23: How does Grub measured against the commercial boot loaders that claim to be able to do just as many type of systems? A: Never have the cash to try them out myself but I am reasonably certain that it is an easy task for any boot loader to boot a PC system indirectly.
To boot directly the boot loader has to understand a filing structure in order to go inside a partition to pick out the kernel and ram disk file to load them directly. Since Grub is engineered for the Linux and BSD I doubt if a third party boot loader can carry the booting duty better than Grub. There are things Grub can do while other simply can’t. One example is we can ask Grub to use the kernel of Linux A to boot Linux B.
I would be interested in knowing a commercial boot loader having a better ability than Grub (or Lilo) to pass on parameters at boot time to a kernel. Last edited by saikee; at 06:57 AM. I am humbled by the public interest in this thread in the last 2.5 days. Previously the thread received just over 42 views per day in its 48-day existence. In the last 2.5 days it received about 10,000 views per day. In view of the public interest I shall put together an easy HOWTO later. So far the information above is just a demonstration type which may be sufficient for the experienced readers to piece the picture together.
I shall append a easy HOWTO to the same thread. So watch this space. Hopefully it should available in before April 2006 as I am away till mid March. I also take this opportunity to thank the viewers rating this thread. julzian12321, Am I supposed to provide a response to you? Last edited by saikee; at 06:10 AM.
This thread has attracted a lot of attention but also has been incorrectly reported. Some reporters may lack the understanding of my thread and reporting it as (1) a Howto and (2) runs 100 operating systems at once Although I have made sure sufficient materials have been put forward for any interested reader to go through the same process again the thread is not a tutorial or a HOWTO because I have never provide step-by-step instructions.
I shall offer a real 'HOWTO' in another post later in this thread but since I shall be away for 3 weeks soon it will not happen immediately (it is already under preparation). The running 100+ system at once is a mistake by others as I never gave a slightest hint such thing could be done in my write-up. My thread is exactly what it says in the title - A grub menu booting 100+ systems of Dos, Windows, Linux, BSD and Solaris. I have investigated the possibility of running them together. The current technology is to use virtual machine in which each OS is assigned a portion of memory to operate.
It is basically a 'red herring' to most of us! The standard system offered by the vendor normally limits something like no more than 4 systems to be run at any one time, without massively upgrading the memory. One should have no difficulty in seeing why this application isn't ideal if he/she suddenly has only 1/4 of the ram to run the same OS. Basically in virtual machine we introduce one more operating system to control the rest of the systems and every one of them need memory to function.
Whatever you want to run can only be done with a fraction of the installed physical memory in a PC. Broardly speaking if we run 4 systems at once we must operate each one at 1/4 of the resource. Only big servers with massive amount of rams and multi core CPU can afford to running a modest number of systems 'at once'. Whichever way one looks at it 'running 100+ systems at once' isn't a viable solution at today's technology. Even if the motherboard can take it and we are happy with the slow speed of say running each system with 512Mb ram in a queue of 100 systems we would be talking 50Gb of ram of having all of them available 'at once'! My thread of 100+ systems is for having 100+ systems 'installed' and available for selection by 'one' menu.
Only one system is run at any one time. It is regretable that it has been mis-reported beyond the original scope. Edited addition 14:33GMT 15/2/06 - One Web site has agreed to replace 'at once' with 'in a PC' in the reporting title after being alerted of the inaccuracy. edited 16 Feb 06 A future prediction I could be wrong but from the interest expressed so far in this thread I can see a new trend coming. Dual-boot and tri-boot could soon be in history if users switch to multi-boot.
I am seeing more Linux and Windows users are starting to retain the systems after they have tested them. Instead of removing operating systems after it isn't used regularly a user may opt to 'retain' the system if hard disk storage is cheap and there is no problem in booting it. In my case I even dug up old dead Dos and Win9x to load them back into the PC so that I can refresh and access my previous knowledge again. It is noteworthy to point out that time is ripe if a user wishes to keep a large number of Linux in a PC, possibly assisted by the following points (a) Large capacity hard disks are affordable - Despite UK prices are always higher than those in USA we can get an OEM 300Gb IDE or Sata for 84GBP now (Maxtor DiamondMax Plus 10 series). To store a Linux in a 5Gb partition costs 1.40GBP and such money is not enough even to buy a beer. So drink one beer less per day and one can run 100+ systems in 3 months. (b) Today's multi-booting is a lot easier than in the past - The Linux has improved considerably since I started in June 2004.
At that time the majority of distros could not cross the 137Gb barrier in the hard disk or mount a partition higher than the 20th. This was already a huge improvement over the past when various methods had to be developed just to keep the Linux boot loaders below the 1024 cylinders limit (about 8.5Gb). Both current Lilo and Grub can boot at the end of a 300Gb disk. In Feb 2006 it is a minority that is still having the same trouble with 137Gb barrier and high-number partitions.
(c) Multi-installation helps a user to have immediate functionalities of the operating system without being stuck with hardware not recognized - Standard Linux distros use generic drivers and many are not well put together to fire up all the hardware in a PC. My experience is that some distros are better than other in kicking start the hardware and so there is no need to pull the hair out if one Linux fails to activate one piece of the hardware while the others have no problem with it. By comparing the settings of them one can resolve the hardware problem quicker and easier. (d) Multi-installation is an alternative method to learn an operating system - There is a huge choice of 'free' Linux and BSD distros available further supplemented by the open-source Solaris and Darwin X86. A user will need to expose himself/herself to several systems in order just to form an 'informed' opinion on one distro. There is no better way to learn one operating system if one is able to use several and able to see the similarities and understand the reason why things have to be done in a certain way. Surviving in multiple installations requires a user to know the commands common to all distros instead of the commands particular to one distro.
This is a definite benefit to the newcomers. Thanks for the patience of reading this long thread and hope you have found something useful or informative. My opinions and views are not representative of those of Justlinux which in this area has a lot more real experts from whom I learn all my stuff from. Do enjoy JustLinux as much as I do. Last edited by saikee; at 02:21 PM. Well I took your advice and download BeOS 5.
Had it installed in Windows in two different machines, made different floppies for booting but it didn't work. My guess is BeOS may not have Sata support as the floppies did try to load but gave up at the end. I have Windows in Sata in both PCs. When I have a bit of time I shall try it on an IDE disk. It is a weird system living inside a Windows partition almost like a parasite (hope I am not offending the BeOS lovers). It is going to be a challenge to boot it as it doesn't use the boot sector or the MBR. You're correct, BeOS does not support SATA (yet).
Since you already have Linux installed, rather than trying to run it inside a windows file, grab the Linux installer version from BeBits: and install it. It installs into a file inside of Linux, but once you are running BeOS you can select to install it into its own BFS partition.
Then you can get a real feel for what it can do. There's instructions there telling how to install it. To see if your hardware is supported check the BeOS hardware matrix at: -scottmc.