Technical details
Hard disk considerations
Most MS systems are designed to reside in a primary partition and there can be a maximum of four of 4 primaries in each hard disk. To get more partition a user “must” give up one primary to turn it into an extended partition. In Linux a Pata (or IDE) disk can have 63 partitions maximum and the limit of a Sata or SCSI disk is 15.
The number of partition plus the whole disk itself make up 64 and 16 devices repeactively.
An extended partition also consume a device name but cannot be used for storage because it is just the border defining the beginning and the finishing points of the logical partitions.
Linux can be installed and booted from either a primary or a logical partition so it pays to give the primaries to MS systems that dependent on them.
Linux always name the first logical partition as the 5th partition in any hard disk. Therefore theoretically in a Pata disk, say a hda, the maximum usage is hda1, hda2 and hda3 as the primaries, hda4 being the extended partition holding a maximum 59 logical partitions inside (from hda5 to hda63).
In practice some Linux programs stop to display beyond the 60th partition and some distros, like those from the Red Hat family, do not show partitions beyond the 15th, even the distros itself has been installed beyond this limit.
The maximum number of partition one can get out of 2 Pata and 2 Sata is 2*(63+15)= 156. Thus I could have 4 partitions more if I want.
The partitioning scheme
I let the MS systems to have all the primary partitions and Linux are house mainly in logical partitions. One swap, also in a logical partition, to serve all the Linux. For BSD and Solaris systems I use separate hard disks.
As a rule I always install an operating system in a single partition. It is easier to maintain, to boot and to understand. It may not the optimum solution but it works in every Linux I installed.
Here are the partition sizes I allocate to each system
(a) Dos in 1 or 2Gb (primary, type fat16 or fat32)
(b) XP and Vista in 25Gb and 20Gb (primary, type NTFS)
(c) For Win2k I used 15Gb (primary, type NTFS)
(d) For Win98 I used 5Gb (primary, type fat32)
(e) Linux 5Gb (majority) and 10Gb ( say for a few for big distros) (logical, either Ext3 or Reiserfs filing types)
(f) One swap 1 Gb common to all Linux
(g) Personal data 95Gb large fat32
Actual sizes can be seen in the fdisk -l output in Post #1.
I use exclusively one Linux partitioning tool “cfdisk” and use “fdisk” as a second check. Both programs are standard tools in a Linux Live CD. I specify the partition type number of 83, 82, 6, c and 7 for native Linux, swap, fat16, fat32 and ntfs partitions respectively. In using cfdisk for partitioning the partition type is 83 by default and this is recognised by every Linux installer.
I never format the partitions myself as every installer wouldn’t trust me and likes to format its own home.
At a later date I started to use a free partitioning tool called “gparted” which has been branched into “Parted Magic”. They are available as free downable iso files that could burn into a CD.
I believe it is a good strategy to have the partition ready and in the correect partition type so that it is recognised by the system installer. If you you make life easier for the installer. In return it will give musch less trouble.
The mother of all booting schemes - Grub in a data-only partition
This is really my suggestion and is completely unnecessary to a normal Linux user, who can lay his/her hand on the first Grub he/she comes across and make this Grub to do all the things I say below. However my proposal carries the following advantages if taken up
(1) Grub is not attached to any operating system and so it can be used manually as a mini operating system.
(2) Every operating system can be booted indirectly (known as chain loading) using an identical set of commands with only difference in the partition reference. It works for all the operating systems regardless it is a Dos, Windows, Linux, BSD or Solaris.
(2) Every MS system and Linux can control Grub if it is installed in a partition, say type fat16 or fa32, which every system can read, write and alter its boot menu.
(3) Grub is the only boot loader that can be arranged to boot a partition even before its is created, formatted and installed with an operating system. That has to be the coolest thing in booting.
(4) The data-only partition, where Grub resides, has no operating system inside but can be booted by any Linux. Any Dos or Windows MBR can also boot this Grub if it is housed in a “primary” partition with the bootable flag set active.
It should be understood that I propose to install Grub “WITHOUT” being attached to any operating system! Grub cannot read a ntfs filing system so it should be installed into a fat16 or fat32 partition. I put it in the 3nd partition of my 1st Pata disk. In Linux it is known as hda3, as my 1st, 2nd, 3rd and 4th disks are hda, hdc, sda and sdb respectively.
To install Grub into a data-only partition involving the following steps
(A) Format the data partition first say in fat16 format. Best way is boot up a Linux Live CD, click terminal mode and issue the command for formatting a partition hda3 in fat16
mkdosfs –F16 /dev/hda3
Alternatively the partition can be formatted by a Dos floppy, downloadable from Bootdisk.com, in a Dos command prompt with command
Code:
format c:/
, assuming any partition before hda3 is non-Dos or hidden.
The use of Fat16 is deliberate because with such a filing system a Dos cannot address hard disk beyond 2Gb, cannot recognise a Sata but we can still use Grub there to boot 145 systems in the PC.
(B) The next task is to get hold of 3 files Grub needs for installation. They are called stage1, stage1.5 and stage2, which are held together in a directory, and are available in any Linux Live CD that supports Grub. So just boot up a Live CD and ask Linux to report to you their position by command
Code:
find / -name stage1
you will find these files are typically held in the following directories
Red Hat, Fedora C2 to C6
/usr/share/grub/x86_64-redhat/stage1
/usr/share/grub/i386-redhat/stage1
Mandriva
/lib/grub/i386-mandriva/stage1
Mandrake
/usr/local/lib/grub/i386-pc/stage1
/usr/lib/grub/i386-pc/stage1
Suse
/usr/lib/grub/i386-suse/stage1
Gentoo, Knoppix, Mepis, Xubuntu, Ubuntu, Kubuntu, Debian
/lib/grub/i386-pc/stage1
Frugalware, Kanotix
/usr/lib/grub/i386-pc/stage1
Next stage is to create a temporary directory in the directory /mnt of the boot-up Live CD Linux, mount the data-only hda3 partition, create /boot/grub directory inside it, copy all the Grub’s stage1, stage1.5 and stage2 files into it, invoke a Grub shell, setup Grub in the MBR and exit. Using Ubuntu CD as an example the commands would be
mkdir /mnt/hda3
mount /dev/hda3 /mnt/hda3
mkdir /mnt/hda3/boot
mkdir /mnt/hda3/boot/grub
cp /lib/grub/i386-pc/* /mnt/hda3/boot/grub
grub
root (hd0,2)
setup (hd0)
quit
On a reboot the hda3 will be booted to a Grub prompt and nothing else. This indicates Grub is now in charge of the MBR, linked to partition hda3 and is controllable by the configurator file always named “menu.lst” if there is one in the /boot/grub or /boot directory of hda3. When Grub can't find it it defaults to a Grub prompt.
Note some versions of Grub, especially in the Red Hat family, can be modified to read "Grub.conf" instead.
Although the Grub Manual does not claim it but it is in my experience no PC operating system cannot be booted by a Grub prompt. It doesn’t look much at the first sight but there is seldom something so simple can be so powerful.
(C) Now is the time to write a menu to boot 145 systems. It is just a text file must named menu.lst to be stored in the subdirectory /boot/grub. Grub boots each system iy 3 lines as follow:-
A “title” statement to display the name of the system in the screen. Any ttext after the word "title" is displayed and has consequence to the booting except to remind you what the system is.
A “root” statement specifies the root of the operating system. This means the partition the target system residing. Grub counts everything from 0 so to boot a system at the 9th partition of the 2nd disk is “root (hd1,8)”. Similarly (hd0,0) mean the 1st partition of the 1st disk.
A “chainloader” statement which always ends with “+1”.
So you see there is nothing to it. Even a simpleton like me can cope with this.
Being lazy I wrote a small program to generate the booting menu because it is just doing 4 loops, each loop per hard disk in my case.
Therefore my menu.lst initially will look like this
title Empty @ hda1
chainloader (hd0,0)+1
title Empty @ hda2
chainloader (hd0,1)+1
title Empty @ hda3
chainloader (hd0,2)+1
title Empty @ hda4
chainloader (hd0,3)+1
and so on
The menu is edited whenever I wish to update it with the name of the operating system replacing the word “Empty”. Life could be so simple except the MS systems which needs extra work. That I shall go into later.
The simplified installation scheme
Linux is easy to install so I describe it first.
Linux rarely need to defrag its filing system because it makes use of a scratch area call swap. Thus a swap partition is needed for the first Linux system. Thereafter all the other Linux will proceed to use it without saying a thank you. There is nothing needed done except to create it using the Linux cfdisk program, to the size about twice the physical memory, and select it partition type as 82. Every Linux installer will know how to use it. Some insist on checking it, others ask you for permission to format it and many don’t even tell you what they do with it. I create one in partition hda5 so whenever an installer asks for it I just respond with “hda5”.
In the installation of every Linux we can “instruct” the installer to place Linux in any partition we want. This is done by nominating a single partition to mount the root or “/” of the Linux. If no more than one partition is given to an installer it will place a Linux's directories of /boot, /home, /usr…..as subdirectories to "/" inside the single partition, stacking them back to back so that you only need to worry only if the accummulative content starts to excced the overall partition capacity.
The choice of the boot loader, usually either Lilo or Grub, is immaterial to the proposed scheme.
When it comes to the location of the boot loader it is another matter. Every Linux installer would let the boot loader installed either in (a) the MBR or (b) the root partition of the Linux being installed. My proposed scheme “ONLY” works if the latter is chosen. Some naughty Linux could omit giving you a choice and steals the MBR position. You could also having tea and press the wrong button to lose the MBR. In such a case you can claim the original MBR back again by booting up the Live CD (with Grub inside), click terminal and fire these commands to restore Grub
root (hd0,2)
Setup (hd0)
which literally asking Grub to “source” the necessary file from the specified root and install itself in the whole of disk (hd0) and that could only be the MBR.
A word of caution on Linux’s ability to be installed/booted at high-number partitions or beyond 137Gb barrier in a hard disk
The systems that I arranged can all be booted as per menu.lst. Some older distros will have difficulties to recognise partitions higher than 16, not anticipating device names for high-number partitions and can’t access beyond 137 Gb in the hard disk. These distros have to be installed at the lower-number partitions and inside the first 137Gb of the hard disk. If you find a distro refuses to boot or install take a look at my menu.lst and check the partition position it is known to work.
Dos and Windows systems
There are many ways to install MS systems. For simplicity, ease of control and maintenance I recommend each system to be installed in a “C” drive as a stand-alone independent system. This is to say no dual booting among the MS systems by NTLDR. I have a mobile rack system so I can pull out all the other hard disks and leave only one to install a MS system. Thus every MS system in my case was installed as the first bootable disk. Once installed I do not change its partition position but can put hard disk in other positions. Grub has a facility to re-map the hard disk order on-the-fly and gives back the first bootable disk status to a MS system.
To install a MS system in a “C” drive means there should be no partition recognised by the installer except the partition for installation so it can rightfully claim the first partition status. If there is a partition the MS can recognised, say a Dos partition, then this can be overcome by hiding it, using the Live CD again. If one wants to hide the first disk’s 1st partition, unhide the 2nd partition and make it bootable for a MS system the command in Grub prompt are
hide (hd0,0)
Unhide (hd0,1)
Makeactive
Hiding a partition in a PC doesn’t physically hide the partition away. It just alters its partition type number. Normally a digit “1” is added. Thus if a fat32 and ntfs partition with type c and 7 will become invisible to a MS system when the type number is altered to 1c and 17 respectively. To unhide it is to strip off the digit “1”. It is the oldest trick in a PC, invented at the time Dos was the de facto operating system, to allow a user to bootmore than one operating system.
A MS system may need its own MBR for an installation. It has come to my notice that the MS systems share a common MBR. This MBR's function is to search each of the 4 primary partitions and load the one with the booting flag switched on.
As an example these are brief steps of how I installed Windows Vista in hdc3
Removed disk hda, sda and sdb disks and slide hdc into the rack previously occupied by hda. The original hdc3 partition is know as (hd0,2) to Grub.
Boot up a Dos floppy and restore the MS MBR into the hard disk by command
fdisk /mbr
Boot up a Grub floppy and hide the first two partitions and then check disk geometry
hide (hd0,0) Hide (hd0,1) Geometry (hd0)
The geometry command is to check everything is in order before installation. Hda3 should have already been created with sufficient space in type 7 for ntfs filing system.
Install Windows Vista and select the 3rd partition for its home.
Check Vista working satisfactory on a reboot after installation.
Power down the PC, add the hard disk that is intended for the permanent home for the Vista, say this is a slave drive called hdc already has in the third primary position a partition with identical size as hda3, insert a Live CD, boot up the system and clone the Vista system across by root terminal command
dd if=/dev/hda3 of=/dev/hdc3 bs=32768
I then power down again, restore all the hard disk, boot up a Live CD again and use it to amend the /boot/grub/menu.lst in hda3 with the following entries for booting hdc3 partition
title Vista @ hdc3 root (hd1,2) hide (hd0,0) hide (hd0,1) hide (hd0,2) hide (hd1,0) hide (hd1,1) unhide (hd1,2) makeactive map (hd1) (hd0) map (hd0) (hd1) chainloader +1
The two map statement instructed Grub to swap the (hd0) and (hd1) position so that when Vista boots it will find itself still in the first bootable disk as per the original installation. The 5 hide statements are necessary to hide the 5 Dos and Windows partitions which if Vista picks up can upset its “C” drive status.
I used the same principle on every other MS systems and managed to get 3 Versions of Dos and 5 versions of Windows in the same PC. More MS systems can be accommodated but these are all I got.
Ending notes
My original intention was to learn Linux, understand how it work and be able to boot it. It was a huge surprise to see how easy and logical in a Linux world. It almost seems everything I could not understand how a computer works, after all these years with MS systems, suddenly become comprehensible in Linux when the inner working of the system is a published public knowledge.
People can say anything they like about Linux but my 2.5 years with it has taught me using one of the oldest partition (fat16) to house an obsolete boot loader (as the Grub described here is known as the Grub legacy that the GNU/Grub maintainers had already declared cesation of support to move their effort to the new Grub 2 at the time I started Linux) to boot the 145 operating systems I can access. The scheme is laughingly simple.
I am hugely indebted to many GNU/Linux volunteers who unselfishly maintain and develop the open source software. I come to know some of them could risk litigations from the money-grabbing corporation because their effort has reduced our dependency on the commercial software.
From the 2.5 years into Linux I witnessed a huge leap in functionalties and user-friendliness in Linux. I am also inspired by so many nations contributing efforts in bringing this operating system to the public. Many of their distros are technically outstanding.