bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Win2K Multi-Boot Rev 1.1


From: Web Clark (RR)
Subject: Win2K Multi-Boot Rev 1.1
Date: Thu, 05 Oct 2006 00:02:03 -0400
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

I noticed that this went out in RTF, and so I am resending it in
plain-text.  I have also made a number of minor clarifying updates.

I expect to get questions and comments, so watch for updates with
a similar title.
---

How to Multi-Boot Windows2K
Rev 1.1 4 October 2006 23:27
RJC

Background:

  I went through this about six months ago and learned a great
  deal about what did and did not work.  There *are* several
  ways to do everything!  I did not keep notes :-(.  Below is
  recorded a procedure that works.  Missing are all of the
  variations, their pros and cons, and whether they work or
  not and why.  Well, a method that works is a powerful start!

  Everything I say here I very strongly believe is also applicable
  to Windows NT and Windows XP, especially XP.  But this is not
  tested.

  I am *certain* that there are mistakes here, ambiguities,
  and things I left out.  Please ask!

Goal:

  * Multi-boot large numbers (>= 8) of Windows 2000 systems.

  * ALL systems may be on any disk, in primary or logical partitions

  * Each system to be unaware of and unable to goof-up the others.

  * Systems able to be backed up, copied around from partition to
    partition, disk to disk, etc. even from primary to logical etc.

  * Scheme must encompass the same capabilities for Linux and FreeBSD.

Solution:

  Grub
     chainloads Linux, FreeBSD, or NTLDR
     NTLDR
        Boots up to 10 Windows 2K systems

  The setup described here has been used to host Windows 2K
  systems on all Primary and Logical partitions on both
  the Master and Slaves of the Primary IDE, and based on
  the techniques used, I don't see why it would not extend
  to any disk that grub and NTLDR scan access.

  Windows systems can be archived by booting Linux and copying
  their partition to somewhere else.  They can similarly be
  restored, and restored to any arbitrary location (primary,
  logical, first disk, second disk, etc.).

Tools:

  My examples will use these tools, but others can be used.
  As they say "Your milage may vary", but these seem to be
  the easiest and most fool-proof.

  Bootable Linux CD supporting network protocols to your
     supporting network store (NFS, SMB).  Suggest knoppix,
     but many would do just as well.  SMB in my experience
     only supports files up to 2GB, and so is worthless for
     copying OS partition images around.  I use NFS.  If your
     network store is a Windows sytem, Microsoft has a *free*
     suite of UNIX compatability tools that includes and NFS
     server.  Go find it and let us know if it works (It is
     not hard to find)!

  Bootable Grub CD from www.gnu.org/software/grub
     The grub manual tells you how to make one of these
     given a linux system.

  gparted Live CD from gparted.sourceforge.net/livecd.php
     to create partitions and manage various flags.  Linux
     partitioning programs seem to all have quirks, report
     things (like sizes) differently, and sometimes do
     strange things.  I have never been unhappy with gparted.
     Partition magic often complains about something not being
     quite right and wanting to fix it, or worse not wanting
     to proceed.  It has never caused me harm if I let it
     fix things.  I am not sure if it is right or the Linux
     utilities are right, but they are at odds.

  Partition Magic
     To re-size partitions (Optional but recommended)
     I know of no alternative.

  Windows 2K installation CD
     There is only one Windows!
        (Unfortunately, there are many copies...)

Partition disk

  Make all partiions an even number of cylinders long.
     (One cylinder = 263*63=16065 sectors)

  Desire is that systems be able to be moved around at whim.

  The first primary and all logical except the first have a
     track or cylinder stolen (depending on partitioning program)
     and so are not *quite* as large as you specify.  I recommend
     making the partitions with the "stolen" space one cylinder
     larger, and the systems created in (sized) to the smaller
     partitions (without the track stolen) so that they fit
     anywhere.  If you copy a partition image in a larger
     partition nobody notices; it works fine.  Actually, I expect
     sooner or later to run into something that notices and warns
     me, but this has not happened yet.

     I discuss below shrinking and expanding partitions using
     Partition Magic.  This is nice, but everyone may not own
     or want to own Partition Magic or want to fiddle with this.
     Make your systems in the StdSize partition (Primary #2).
     They will FIT in the StdSize+1 partitions, no re-sizing
     needed.  You will be able to copy them around wherever
     and whenever you want to.

  The first partition will be the boot loader partition for
     grub and ntldr.  Probably 64MB is plenty for this purpose,
     but I made mine 1GB arbitrarily.  The process will at one
     point have the Windows 2K installation files copied to it,
     so on the order of 512MB is probably a minimum (untested).

  For simplicity sake neither Windows nor Linux systems will
     use multiple partitions.  User files will be network
     mounts, or could be a common partition.  The root, var,
     usr, etc. all go in the one (root) file system.  The
     overwhelming reasons for having separate file systems
     went away with the arrival of free disks so large you
     can't even count the digits in the size!

  Decide on a Linux swap partition size.

  Decide on a "standard" partition size.

  Use GParted to partition and format all partitions:

     Partition      Use                        Size (In Cyl)

     Primary #1      Boot partition            130 (1GB)
     Primary #2      System building partition StdSize
     Primary #3      Available for use         StdSize
     Extended Partition
        Logical #1   Linux Swap                261 (2GB)
        Logical #2   Available for use         StdSize + 1
        Logical #3   Available for use         StdSize + 1
        ...

        Logical #N   Available for use         Remainder

     You can have a similar structure on other hard disks and
     boot from them also.

     Extra Credit:  MORE than Ten Windows 2K systems on one PC!

        You can have multiple partitions with NTLDR on them to
        boot more NT systems, but this consumes a primary
        partition each (I will *assume* that NTLDR has to live
        in a primary partition, although I might have run it
        out of a logical at one point.)  You would want to do
        this to boot more than the 10 systems maximum that
        NTLDR supports.

        Another more elegant method may be to replicate NTLDR
        (say NTLDR1, NTLDR2, etc) and change the configuration
        file string to boot1.ini, boot2.ini, etc.  Then put the
        PBR (First sector or all 3?) in multiple files (PBR1,
        PBR2, etc.), editing them to load the the corresponding
        NTLDR? files.  Finally, have separate grub menu.lst
        entries to chainload each.  Each gives you ten Windows
        2K systems.  This is completely untested, but I'll bet
        you can make it work since the PBR will be copied from
        the partition that the files will reside in.

     To enable you to install an archived system in a different
     (i.e. smaller) partition in the future, it is useful to
     "dd -if=/dev/zero of=zeros; rm zeros" to fill unused space
     with zeros then use Partition Magic to shrink it to a small
     size before archiving.  This means that you might want to
     use the Partition #3 space as flex to Partition #2 can
     grow or shrink as required.  So you might not want to use
     Partition #3 for systems.  But you can.  Whatever you do,
     be sure that it always exists (Say 1 cyl) or your grub
     menu.lst will need to be fiddled when it comes or goes.
     Heavy-duty partition-fiddling requires Partition Magic.
     Buy it, it is worth it.  These days it want to install
     under Windows, but it *used* to come with a DOS version
     on the CD that you could copy off (pqmagic.exe).  Check
     to be sure that this is still provided before buying.
     Bootmagic is not a bad boot manager if your needs are
     simple.  I am not sure you can install it or manage it
     without a host Windows system though.  Once you tackle
     grub, there is little reason to use bootmagic unless you
     are only comfortable with GUIs.

     Hide all partitions except for Primary #1.  Set Primary #1
     to be visible (Un-Hide) and "Active" or "Bootable".

  Create a Windows 2K disk image

     At some point you are going to have to install Windows :-(
     You could do this later, booting through Grub, but that
     would require a more involved explanation on my part telling
     how to reconfigure grub etc.  So I will do it here, have you
     save it, then just have you copy it back whenever and
     whereever you need it!

     Unhide and set Active (or Bootable) the second primary
     partition.  Hide all the others.

     Install Windows 2K, service packs, patches, and any and all
     drivers and software you consider to be your "base".

        I strongly suggest that you err on the side of not
        installing as much so as to minimize the probability /
        frequency of having to go through another Windows
        install :-).  You can always save your image at multiple
        points too.

     Save your image:

        Shrink the partition using Partition Magic to enable it
        to be restored and expanded into a smaller partition in
        the future.

        Boot Linux

        Mount your network store
           (nfs startup will vary with Linux distribution):

           /etc/init.d/portmap start
           /etc/init.d/nfs-common start
           mkdir /extra
           mount josiah:/extra /extra

        Save an image so you never have to do this again:

           cp /dev/zero zeros; rm zeros
           gzip -c < /dev/hda1 > /extra/Win2K.P1.xxxCyl.gz

        Expand the partition using Partition Magic to continue
        your install.

  Create boot partition compatible with NTLDR.

     You need a partition with the NT Partition Boot Record,
     ntdetect.com, and ntldr.  The NT (Windows NT, 2K, and XP)
     PBR is more than one sector long (3 if I remember correctly)
     and contains various information regarding the partition.
     I spent alot of time trying to learn how to use non-Microsoft
     software to build a suitable partition and finally gave up.
     You *are* doing this to run multiple Windows systems, so you
     *must* have a bootable Windows install disk.  So use it.
     That said, I am not sure that it is not possible to build one.
     If you manage to figure it out, please share that.

     Boot the Windows 2K CD.

     Choose to install it in Primary #1 (Should show up as C:
     and be the right size.  If you have other stuff on the disk,
     be careful!

     Let it format the partition, and have it formatted with FAT32
     since grub will need to use it too.

     When it tells you to remove the floppy from drive A: so it
     can reboot the system, stick the knoppix CD in and boot it
     instead.

     Mount the partition:

        su
        mkdir /b
        mount /dev/hda1 /b

     and

        cd /b
        rm -rf winnt pagefilesys arc*

     leaving only:

        boot.ini ntdetect.com ntldr

     Then

        cp /dev/zero zeros
        rm zeros

     Unmount your boot partition:

        cd /
        umount /b

     Mount your network store:

        /etc/init.d/portmap start
        /etc/init.d/nfs-common start
        mkdir /extra
        mount josiah:/extra /extra

     And save an image so you never have to do this again:

        gzip -c < /dev/hda1 > /extra/Win2KBootpart.130Cyl.gz

     At this point I detected that the ntldr file   is different
     in *many* places from a copy of ntldr that I saved six
     months ago.  This is especially disturbing because it came
     from the *same* Windows 2K install CD.  I would tend to
     say that this is not possible!  Yet it happened.  Both
     appear to work.  I have no explanation.

  Populate your boot partition

     Re-mount your boot partition:

        mount /dev/hda1 /b

     Copy the following files to your boot partition (presumably
        you prepared them on your network store):

        clearSN
           This is a shell script that clears the driver serial
           number in the MBR.  This causes Windows to re-ennumerate
           all the partitions on the disk on the next boot:

              #! /bin/sh
              dd if=/dev/zero of=/dev/hda bs=1 count=4 seek=440
              dd if=/dev/zero of=/dev/hdb bs=1 count=4 seek=440
              ...
              Whatever disks you want to do this to.

        boot.ini
           (Sample attached at the end of this dissertation)

        ntdetect.com
           Already in place
        ntldr
           Already in place

        grub
           Subdirectory:
              stage1
              stage2
              *_stage1_5
              menu.lst
                 (Sample attached at the end of this dissertation)

  Install grub

     I suppose you could do this from Knoppix, but I prefer to run
     the grub distributed by the grub team, so I boot the grub CD.
     I have used the knoppix one too.  It does not matter.

     setup (hd0) (hd0,0)

        (hd0) is the disk to install grub on.

        (hd0,0) is the partition from which to get the grub files.
        This would be the partition you just made and populated
        assuming it is the first primary partition on the primary
        IDE master.  If not, adjust accordingly.

        The grub "Install" command allows more flexibility and can
        easily be used successfully, but it is not clearly explained,
        the code is incomprehensible, and those who understand it do
        not seem to be inclined to invest in explaining it so that
        it can be clearly documented.  This *is* a primary reason
        that grub2 was started, so I can't say I blame them.  Setup
        works fine.

  Install Windows 2K

     I had you do this above.  If you did not do it there, then
     fiddle grub menu.lst to make the target partition Active
     (Bootable) and the only visible partition, install it and
     save and image, then fix menu.lst back.

     Restore an image if you like, then use Partition Magic to
     resize a partition to match the image if appropriate.

        Boot Linux

        Mount your network store
           (nfs startup will vary with Linux distribution):

           /etc/init.d/portmap start
           /etc/init.d/nfs-common start
           mkdir /extra
           mount josiah:/extra /extra

        Restore the image:

           gzip -c < /extra/Win2K.P1.xxxCyl.gz > /dev/hda1

        Expand the partition if appropriate using Partition Magic
        and continue your install.

  Production state

     Windows

        In order for Windows systems to not interact (Use each
        other's partitions) they can never know about each other.
        Very strange things can happen - booting one system,
        which APPEARS to be running out of the intended partition,
        yet if you zero one of the other partitions (even a hidden
        one!), the booted system will stop working!  It was using
        another partition's files!  Also poking around in the
        various dialogs under the Windows control panel, you will
        find that some system files are pulled from one partition,
        others on another when you have multiple Windows system
        partitions visible.  This does not change when you hide
        them again - it still assigns a drive letter and gets at
        them.  You can even change the partition type or overwrite
        the PBR and it will still happily (and successfully) access
        them.

        To break Window's connection to a partition, hide that
        partition and clear the drive serial number using the
        clearSN routine given above.  This will cause Windows
        to invalidate everything it knows about that drive and
        to re-ennumerate the partitions on the next boot.  It
        will write a new S/N to the drive (Sort of like a dog
        peeing on a fire hydrant), tell you that it is installing
        new hardware, and want to reboot afterward.  You don't
        have to.  Note that EVERY Windows installation will go
        through the same motions next time they are booted.  This
        makes me wonder... They will each write a different and
        unique S/N... I don't remember having problems with this.
        Perhaps they re-ennumerate every time you switch systems
        vs. booting the same one because the drive S/N is not
        now they left it?  I don't have multiple systems at this
        time and so cannot easily check this.  It is OK though.

        In normal production, configure grub menu.lst to set ALL
        partitions to hidden, including the one you are booting!
        Do not set ANY partition Active (Bootable).  Specifically,
        it would make sense to have your boot partition bootable.
        Don't do this or Windows will make the boot.ini visible
        and changable through the "Startup and Recovery" dialog.
        This dialog presents boot.ini from the Active partition,
        not relative to boot time, but actually checks the MBR
        partition table when it is run.  No active, no boot.ini
        access!  Access would allow a Windows 2K user to goof
        up your boot system!  (Windows NT/2K/XP systems are not
        real useful unless you are in the administrators group,
        and my purpose in doing this is to have a system for
        each of my children).

  Linux

        Configure grub to un-hide the Linux and Linux-swap
        partitions (The Linux boot partition is required to
        be unhidden by grub, I *assume* but have not tested
        that the other Linux paritions and the Linux-swap
        partition are required to be un-hidden by Linux),

NTLDR boot.ini

  [boot loader]
  timeout=30
  default=multi(0)disk(0)rdisk(0)partition(6)\WINNT
  [operating systems]
multi(0)disk(0)rdisk(0)partition(2)\WINNT="Template Win2K Development: MS W2K ARCPart 2 / (hda2)" /fastdetect multi(0)disk(0)rdisk(0)partition(6)\WINNT="Jared School: MS W2K ARCPart 6 / (hda7)" /fastdetect

  [Hidden Entries - Any Text]
multi(0)disk(0)rdisk(1)partition(1)\WINNT="MS W2K ARCPart 1 / (hdb1)" /fastdetect

  --- end of file ---

  There are many sources of information regarding the format
  and content of this file on the internet, one of the more
  credible looking (by a real company) being contradictory
  to the others.  But that are all worded somewhat ambiguously,
  so perhaps they all agree :-).  MS has a good knowledge base
  article.

  Notice rdisk(0) is for IDE Primary Master, rdisk(1) IDE Primary
  Slave.  The grub menu.lst file (below) has comments correlating
  NTLDR to grub to Linux partition naming conventions.

  Note that you can also boot files with NTLDR (out of scope
  of this document).

Grub menu.lst

  # 2006 10 02 21:19 RJC First cut at production for soco (Win2K PC)

  # Correct Partition Types (Reference)
  #   0c FAT32-LBA
  #   1c Hidden FAT32-LBA
  #   82 Linux swap
  #   83 Linux

  # To cause Win2K to re-enumerate partitions on a disk (zeros disk S/N):
  #   dd if=/dev/zero of=/dev/hda bs=1 seek=440 count=4

  # To set "Hidden Sector Count" in Win2K / MSDOS 4.1 FAT32 PBR to 63:
  #   echo 'abbb' | tr 'ab' '/077/0' | dd of=/dev/hda1 bs=1 seek=28 count=4

  # Put /basevga on boot.ini line to not use installed video driver

  # Favorite password:
  # password --md5 xxx

  # Partition Numbering:

  #  Grub       NTLDR           Linux      BSD

  #  (hd0,0)    partition(1)    hda1      (Not captured)
  #  (hd0,1)    partition(2)    hda2
  #  (hd0,2)    partition(3)    hda3
# (hd0,3) <See note> hda4 (Would be partition(4) if no extended)
  #  (hd0,4)    partition(4)    hda5
  #  (hd0,5)    partition(5)    hda6
  #  (hd0,6)    partition(6)    hda7
  #  (hd0,7)    partition(7)    hda8
  #  (hd0,8)    partition(8)    hda9
  #  (hd0,9)    partition(9)    hda10
  #  (hd0,10)   partition(10)   hda11
  #  (hd0,11)   partition(11)   hda12
  #  (hd0,12)   partition(12)   hda13
  #  (hd0,13)   partition(13)   hda14

  default 0
  timeout 60

title Win2K Systems through ntldr on grub:(hd0,0) NTLDR:partition(1) linux: hda1

  # Must hide all partitions not being booted.  Partitions must exist,
  #   so this list must be kept up to date and correct.
# It would be useful for grub to have a command to CLEAR the "Active" (Bootable) # flag so that NO partitions were bootable so that a booted Windows system # does not present its boot.ini for viewing and modification. Such a command # would enable us to clear them all here rather than trusting that none is set.
  hide (hd0,0)
  hide (hd0,1)
  hide (hd0,2)
  # Extended follows
  hide (hd0,4)
  hide (hd0,5)
  hide (hd0,6)
  hide (hd0,7)
  hide (hd0,8)
  hide (hd0,9)
  hide (hd0,10)
  hide (hd0,11)
  hide (hd0,12)

  hide (hd1,0)
  hide (hd1,1)
  hide (hd1,2)
  ## Extended follows
  hide (hd1,4)
  hide (hd1,5)
  hide (hd1,6)
  #hide (hd1,7)
  #hide (hd1,8)
  #hide (hd1,9)
  #hide (hd1,10)
  #hide (hd1,11)
  #hide (hd1,12)

  root (hd0,0)
  chainloader (hd0,0)+1
  pause Ready to boot!  Press any key to proceed...
  boot

  title Chainload kubuntu on /dev/hda5 ( grub (hda0,5) ) through PBR
  hide (hd0,0)
  hide (hd0,1)
  hide (hd0,2)
  # Extended follows
  unhide (hd0,4)
  unhide (hd0,5)
  hide (hd0,6)
  hide (hd0,7)
  hide (hd0,8)
  hide (hd0,9)
  hide (hd0,10)
  hide (hd0,11)
  hide (hd0,12)

  hide (hd1,0)
  hide (hd1,1)
  hide (hd1,2)
  ## Extended follows
  hide (hd1,4)
  hide (hd1,5)
  hide (hd1,6)
  #hide (hd1,7)
  #hide (hd1,8)
  #hide (hd1,9)
  #hide (hd1,10)
  #hide (hd1,11)
  #hide (hd1,12)
  root (hd0,5)
  chainloader (hd0,5)+1
  pause Ready to boot!  Press any key to proceed...
  boot

--- end of file ---





reply via email to

[Prev in Thread] Current Thread [Next in Thread]