A Dos primary partition for all boot loaders?


Results 1 to 12 of 12

Thread: A Dos primary partition for all boot loaders?

Threaded View

  1. #1
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978

    A Dos primary partition for all boot loaders?

    Edited 11/5/10 - Warning ! - The proposed primary Dos primary partition here is suitable mainly for new installation. It will not suit existing single MS installation due the the rigidity of drive letter created when the MS Windows was first installed. Please see Post #2 for further explanation.

    The single Dos partition is alright for new installations if one is prepared to retored Grub everytime a MS system overwriting the MBR. Also MS systems are backward compatible so install from old to new to minimise the work. For example Win2k's NTLDR cannot boot Xp so Xp must be installed after Win2k to avoid repair with the Recovery Console.



    A member of Justlinux once write in his signature that "a MS Windows may die one day but not Dos". This is quite accurate as I have found out.

    I have found many advantages of putting a Dos in the first partition sda1 in my boot disk. Inside it I have NTLDR, which boots only the Win2k and XP, bootmgr which boots the Vista and Win7 (but able to pass control to NTLDR too) and Grub which can boot all operating systems. Here is the content of my sda1
    Code:
    linux-8w65:/mnt/sdb21 # ls /mnt/sda1
    1st_bcd       boot         BOOTSECT.BAK        DRVSPACE.BIN  pagefile.sys  SUHDLOG.DAT
    1st_bcd.LOG   BOOT.---     BOOTSECT.DOS        IO.SYS        ProgramData   SYSTEM.1ST
    1st_bcd.LOG1  Boot.BAK     COMMAND.COM         MSDOS.---     $RECYCLE.BIN  System Volume Information
    1st_bcd.LOG2  boot.ini     CONFIG.DOS          MSDOS.SYS     Recycled      WINDOWS
    arcldr.exe    BOOTLOG.PRV  CONFIG.SYS          NETLOG.TXT    RHDSetup.log
    arcsetup.exe  BOOTLOG.TXT  d899a95043109a710a  NTDETECT.COM  service.log
    AUTOEXEC.BAT  bootmgr      DBLSPACE.BIN        ntldr         SETUPLOG.TXT
    I have highlighted the relevant boot loaders in different colors. As you can see they can live happily together. The Grub here is Grub1 or Legacy Grub. Grub2 is less versatile, has many restrictions, needs longer commands and is not preferred here.

    Red is for Dos own boot files

    Blue is for the NTLDR's essential boot loader files

    Purple is the bootmgr boot loader. Its BCD data is inside the /boot dirctory.

    Magenta is where Grub is housed

    The /boot (showed up as \boot in Dos) directory has both the bootmgr other files as well as the grub directory which has the 3 essential Grub1 files highlighted in magenta here.
    Code:
    linux-8w65:/mnt/sdb21 # ls /mnt/sda1/boot/grub
    bash1  menu.lst  menu.lst.backup  stage1  stage2
    Advantages

    (1) All the NT MS Windows systems can be placed in the logical partitions because they all need just their boot loaders in a primary partition marked "active" (or bootable in Linux term). In my case I have Win7 in sda6, Win2k in sda7, Vista-64 in sda8 and Xp in sda9. XP and Win2k can only be booted by NTLDR whereas Vista and Win7 are booted by bootmgr. Basically bootmgr takes over the bootsector and provide an alternative to switch to NTLDR within its booting menu. Naturally both bootmgr and NTLDR can fire up Dos in the sda1 too.

    (2) Grub can be conveniently house in sda1 as it can read a Dos partition with filing system in FAT32 (Type c). It only needs two files, stage1 and stage2, inside and optionally the 3rd file menu.lst. Without the menu.lst Grub boots to a Grub prompt. Any installed system can be fired up manually in a Grub prompt so it is a pretty powerful set up.

    (3) One can write a Grub boot menu before any other operating system is installed. That has to be the coolest thing to do and you know what you can generate such menu by a Bash script just like this
    Code:
    for ((i=1;i<=60;i++));do echo "title @ sda$i";echo "root (hd0,$(($i-1)))"; echo "chainloader +1"; echo " 
    ";done  > /mnt/sda1/boot/grub/menu.lst
    In the above I mounted the sda1 partition on a mounting point /mnt/sda1. The loop shows I intend to boot 60 partitions.

    I have only assembled the 4 MS system (all booted from sda1) and one Linux in sda19 and my menu.lst, after a few editings, currently stands as
    Code:
    title W2k/Xp, Vista/Win7 and MS Dos @ sda1
    root (hd0,0)
    chainloader +1
     
    title @ sda2
    root (hd0,1)
    chainloader +1
     
    title @ sda3
    root (hd0,2)
    chainloader +1
     
    # sda4 is an extended partition and not bootable
     
    # sda5 is the common swap used by all Linux
    chainloader +1
     
    title @ sda6
    root (hd0,5)
    chainloader +1
     
    title @ sda7
    root (hd0,6)
    chainloader +1
     
    title @ sda8
    root (hd0,7)
    chainloader +1
     
    title @ sda9
    root (hd0,8)
    chainloader +1
     
    title @ sda10
    root (hd0,9)
    chainloader +1
     
    title @ sda11
    root (hd0,10)
    chainloader +1
     
    title @ sda12
    root (hd0,11)
    chainloader +1
     
    title @ sda13
    root (hd0,12)
    chainloader +1
     
    title @ sda14
    root (hd0,13)
    chainloader +1
     
    title @ sda15
    root (hd0,14)
    chainloader +1
     
    title @ sda16
    root (hd0,15)
    chainloader +1
     
    title @ sda17
    root (hd0,16)
    chainloader +1
     
    title @ sda18
    root (hd0,17)
    chainloader +1
     
    title OpenSuse 11.3 @ sda19
    root (hd0,18)
    chainloader +1
     
    title @ sda20
    root (hd0,19)
    chainloader +1
     
    title @ sda21
    root (hd0,20)
    chainloader +1
     
    title @ sda22
    root (hd0,21)
    chainloader +1
     
    title @ sda23
    root (hd0,22)
    chainloader +1
     
    title @ sda24
    root (hd0,23)
    chainloader +1
     
    title @ sda25
    root (hd0,24)
    chainloader +1
     
    title @ sda26
    root (hd0,25)
    chainloader +1
     
    title @ sda27
    root (hd0,26)
    chainloader +1
     
    title @ sda28
    root (hd0,27)
    chainloader +1
     
    title @ sda29
    root (hd0,28)
    chainloader +1
     
    title @ sda30
    root (hd0,29)
    chainloader +1
     
    title @ sda31
    root (hd0,30)
    chainloader +1
     
    title @ sda32
    root (hd0,31)
    chainloader +1
     
    title @ sda33
    root (hd0,32)
    chainloader +1
     
    title @ sda34
    root (hd0,33)
    chainloader +1
     
    title @ sda35
    root (hd0,34)
    chainloader +1
     
    title @ sda36
    root (hd0,35)
    chainloader +1
     
    title @ sda37
    root (hd0,36)
    chainloader +1
     
    title @ sda38
    root (hd0,37)
    chainloader +1
     
    title @ sda39
    root (hd0,38)
    chainloader +1
     
    title @ sda40
    root (hd0,39)
    chainloader +1
     
    title @ sda41
    root (hd0,40)
    chainloader +1
     
    title @ sda42
    root (hd0,41)
    chainloader +1
     
    title @ sda43
    root (hd0,42)
    chainloader +1
     
    title @ sda44
    root (hd0,43)
    chainloader +1
     
    title @ sda45
    root (hd0,44)
    chainloader +1
     
    title @ sda46
    root (hd0,45)
    chainloader +1
     
    title @ sda47
    root (hd0,46)
    chainloader +1
     
    title @ sda48
    root (hd0,47)
    chainloader +1
     
    title @ sda49
    root (hd0,48)
    chainloader +1
     
    title @ sda50
    root (hd0,49)
    chainloader +1
     
    title @ sda51
    root (hd0,50)
    chainloader +1
     
    title @ sda52
    root (hd0,51)
    chainloader +1
     
    title @ sda53
    root (hd0,52)
    chainloader +1
     
    title @ sda54
    root (hd0,53)
    chainloader +1
     
    title @ sda55
    root (hd0,54)
    chainloader +1
     
    title @ sda56
    root (hd0,55)
    chainloader +1
     
    title @ sda57
    root (hd0,56)
    chainloader +1
     
    title @ sda58
    root (hd0,57)
    chainloader +1
     
    title @ sda59
    root (hd0,58)
    chainloader +1
     
    title @ sda60
    root (hd0,59)
    chainloader +1
    You will find I have arranged every partition to be chainloaded. Grub can chainload any operating system as long as there is a boot loader residing in the boot sector.

    Every MS system, from Dos to Win7, ever invented by M$ always has a boot loader inside its boot sector. Therefore they are always chainloadable. This is true for all BSD and Solaris systems that have to be installed in a primary partition.

    For Linux the system will be chainloadable if the boot loader, be it a Grub1, Grub2 or Lilo, is placed in the root partition where the Linux is installed.

    Therefore whenever I install a Linux all I need to do is to tell its installer that I want my boot loader to be inside the Linux partition and it will be fired up by my pre-fixed menu.lst like a clockwork.

    (3) The MS boot loaders NTLDR and bootmgr can be nuked and rebuilt without affecting their masters (Dos, Win2k, Xp, Vista and Win7). I have rebuilt these boot loaders manually just to ensure we can do it.

    (4) Dos partitions in Fat32 can be accessed by most of the operating systems invented for PC.

    (5) There is no better way to learn the MS boot loaders than starting with Dos which every MS Windows must support.

    (6) The Dos operating system can actually be omitted in the Dos partition if needed. This is to say the partition sda1 can be data only and has no operating system inside!

    (7) Grub does not need to occupy the boot sector of sda1, leaving the bootmgr fully functional to proceed to booting all MS systems.

    How to set it up?

    (1) Just make a partition sda1 of your chosen size and specify it to have Type "C". This can be done by either command
    Code:
    cfdisk /dev/sda
    or
    Code:
    fdisk /dev/sda
    make sure to mark it "bootable".

    (2) Format it by command
    Code:
    mkfs.msdos -F32 /dev/sda1
    This partition is ready for use but cannot boot itself. To make it bootable you need to run a Dos system, either from a CD or a floppy. The command to transfer a MS Dos across is just
    Code:
    sys c:
    This should transfer a booting code into the boot sector of sda1 and deposit three files "Command.com", "io.sys" and "MSDOS.sys"

    (3) Place Grub inside
    To do this you need to boot up a Linux Live CD. Find out where the two essential files "stage1" and "stage2" by asking the kernel with the command
    Code:
    find / -name stage1
    Once locate the directory containing stage1 (stage2 will be in the same location) change directory to it, make a mounting point for sda1, mount the sda1 partition, make the /boot /grub dircetory and copy the two files across
    Code:
    mkdir /mnt/sda1
    mount /dev/sda1 /mnt/sda1
    mkdir /mnt/sda1/boot
    mkdir /mnt/sda1/boot/grub
    cp stage* /mnt/sda1/boot/grub
    To setup Grub in the MBR is to invoke a Grub shell in a Linux root terminal with commands
    Code:
    grub
    root (hd0,0)
    setup (hd0)
    quit
    The above Dos partition in fact has lots of booting technology inside. Apart from able to boot any MS and Linux system it can used to demonstrate the difference of (hd0) and (hd0,0) which many users may not even know the difference. The (hd0) is the MBR and the (hd0,0) is the first partition of the first disk. Since my sda1 contains the MS boot loader bootmgr these command in a Grub prompt (obtainable by pressing the "c" key at a text Grub screen) will fire up the bootmgr residing in the boot sector of sda1
    Code:
    root (hd0,0)
    chainloader +1 
    boot
    whereas
    Code:
    root (hd0)
    chainloader +1 
    boot
    fires up the the menu.lst in the /boot/grub directory of sda1.

    The above information tells me that the MBR is occupied by the file "stage1". The command "setup (hd0,0)" I issued earlier modifies stage1 and hard-coded the hard disk address of "stage2". When the Bios reads the MBR it loads stage1 into memory. Grub is then able to load its stage2 which is its brain. With stage2 available Grub can check if a menu.lst is available and load it if there is one. When nothing is found Grub defaults to a Grub prompt and the user still has its full functionality.
    Last edited by saikee; 06-06-2010 at 07:01 AM.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •