Find the answer to your Linux question:
Results 1 to 7 of 7
Hi All I know that dual booting is an over asked question, but I have a variation on the problem. I wish to dual boot XP and Linux. Approach 1 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2002
    Location
    London, UK
    Posts
    4

    Reverse Dual Boot


    Hi All
    I know that dual booting is an over asked question, but I have a variation on the problem.
    I wish to dual boot XP and Linux.

    Approach 1 : The standard approach suggested is to make space for the Linux install, install it, make a copy of the first 512 bytes of the boot sector to a file (bootsect.lnx), copy this file to the root of the boot partition, and add an entry to "boot.ini".

    Approach 2: Has anybody performed the reverse, on a machine where Linux is installed on the primary boot partition? Is there a way of making a copy of the WinXP bootsector to a file (say bootsect.wxp), copy this file to the linux boot partition and then reference it in the lilo.conf or grub.conf files.

    I have two hard disks ...
    hd0 - cntfs) win2k 10Gig , entfs) 10Gig
    hd1 - dntfs) winxp 10Gig , fntfs) 10Gig , gntfs) 20 Gig
    and I want to kill the 2K installation and install Linux in it's place, but I have problems ...

    I could try resizing c: down to a minimum to just contain ntldr, boot.ini etc and resize e: to take up the space and install linux there, BUT i can't find a tool to resize NTFS partitions AND there would be considerable waste of space since there is a minimum partition size for C:

    I can back up the ntldr, boot.ini and other NT boot files and copy them to the root of d:, but I am worried that if I reformat hd0 I will lose the boot sector code and possible the MBR code.

    Does anyone have any suggestions???

    Thanks

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Where exactly have you gotten the idea that using the windows boot loader is the standard approach? That sounds like extremely unneccesary work to me. The standard approach is to let LILO (or GRUB, but I've never used GRUB) lay on the MBR (by the way, I don't want to be picky, but the boot sector is exactly 512 bytes, so the first 512 bytes of it would be the whole of it) and let it boot the windows partition. This way has many advantages, too. Foremost of these would be that you don't have to extract your Win boot sector, LILO just boots straight off it, so there is never the need to update the boot sector image file.
    I think your idea of installing linux onto the 2k partition sounds just excellent. If you tell us what these problems that you mention are, we might be able to help you around them.
    So, say that you now have your linux system installed on hd0 (is that the primary master, btw?) and winxp remains on hd1 (is that the primary slave?). I assume that d: (which I assume is /dev/hdb1) contains a valid boot loader. In that case, appending the following to /etc/lilo.conf should do the trick:
    Code:
    other=/dev/hdb1
            label=winxp
    I hope that clears things up for you.

  3. #3
    Linux User
    Join Date
    Jul 2002
    Location
    Daytona Beach, FL
    Posts
    487
    dont forget to run lilo afteewards - just one of the reasons I prefer grub, you can edit /etc/grub.conf and go...
    majorwoo

    Quiet brain, or I\'ll stab you with a Q-tip.

  4. #4
    Just Joined!
    Join Date
    Nov 2002
    Location
    London, UK
    Posts
    4
    Quote Originally Posted by Dolda2000
    Where exactly have you gotten the idea that using the windows boot loader is the standard approach? That sounds like extremely unneccesary work to me. The standard approach is to let LILO (or GRUB, but I've never used GRUB) lay on the MBR (by the way, I don't want to be picky, but the boot sector is exactly 512 bytes, so the first 512 bytes of it would be the whole of it) and let it boot the windows partition. This way has many advantages, too. Foremost of these would be that you don't have to extract your Win boot sector, LILO just boots straight off it, so there is never the need to update the boot sector image file.
    I think your idea of installing linux onto the 2k partition sounds just excellent. If you tell us what these problems that you mention are, we might be able to help you around them.
    So, say that you now have your linux system installed on hd0 (is that the primary master, btw?) and winxp remains on hd1 (is that the primary slave?). I assume that d: (which I assume is /dev/hdb1) contains a valid boot loader. In that case, appending the following to /etc/lilo.conf should do the trick:
    Code:
    other=/dev/hdb1
            label=winxp
    I hope that clears things up for you.
    Sorry Dolda for not using the linux lingo but I'm a bit of newbie to linux.
    I thought the NT bootloader was the standard approach as that was all the documentaion I could find on the net.

    You mentioned "Foremost of these would be that you don't have to extract your Win boot sector, LILO just boots straight off it, so there is never the need to update the boot sector image file." If this is the case then things are going to be much easier for me, as I do not have to worry about the boot sector code for NT. However my understanding of the NT boot process is as follows ... BIOS load MBR code from the first hard drive (/dev/hda), MBR code then searches partition table to find active partition and loads the Boot Code from the boot sector of that partition (say /dev/hda1), the BootCode is file-system specific and knows how to load NTLDR from the root directory. NTLDR then reads boot.ini and will load the kernel from the selected directory. Now if the Linux boot process is similar then what should happen is --- BIOS loads MBR Code of first harddrive (ie. LILO/GRUB). GRUB Code then examines it conf file and then launches either the Linux kernel or the NTBootSector. This would mean that I would need to either have the NTBootSector stored in a file that grub.conf references, or grub.conf would need to know where the NT boot sector code resides. If it had resided in the boot sector of /dev/hda1 then I would have destroyed that during my linux install and repertition. If it resides in the boot sector of /dev/hdb1, then I might just be in luck as grub.conf could refer directly to that partition.


    Also you mentioned ... "So, say that you now have your linux system installed on hd0 (is that the primary master, btw?) and winxp remains on hd1 (is that the primary slave?). I assume that d: (which I assume is /dev/hdb1) contains a valid boot loader. In that case, appending the following to /etc/lilo.conf should do the trick:
    Code:
            label=winxp
    "

    Well, Linux would be on /dev/hda which is the primary master drive.
    WinXP will remain on /dev/hdb (or hdb1 to be more precise) which is a secondary master. I think that due to this configuration my XP boot loader was stored on c: or /dev/hda1 ie the XP install overwrote the 2K boot loader (NTLDR) with the xp version, as the file currently resides on c: but not on d:

    I think that I may have some misconceptions of how LILO/GRUB atually perform a boot. It appears from your line "other=/dev/hdb1" that LILO simply loads the boot sector code from the specified partition (/dev/hdb1), but if my XP boot sector code does not actually reside there and it resides in the BS of /dev/hda1 then I need a way of transferring the BS code from /dev/hda1 to /dev/hdb1 ... see hat I'm getting at.

    Thanx

  5. #5
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Sorry if it's confusing for you that I use the unix partition names, but it's much easier for me.
    I see... I thought win xp would have a valid boot loader on /dev/hdb1. If that is not so, it's going to be a problem indeed. If it would just be the boot sector code it would be easy to copy it from hda1 to hdb1, but I suspect that it doesn't even have ntldr or anything on hdb1, if it is as you say. I've never had a dual-booting windows system, so I can't say that I know much of how the NT boot process works.
    The easiest would probably be if you specifically tried to boot from the hdb1 boot sector code to see what happens. If you can boot a linux system on the box (such as the redhat rescue system), running "dd bs=512 count=1 </dev/hdb1 >/dev/fd0" that would copy the boot sector to a floppy. Then boot from the floppy to see what happens.
    Also, check for the presence of ntldr on /dev/hdb1.
    About the LILO boot process:
    1. The BIOS loads the MBR (the first sector of /dev/hda, usually), which contains the LILO primary code.
    2. LILO's primary boot loader sets up the stack and stuff, and loads the secondary loader, which can span several sectors.
    3. The secondary loads the config sectors and lets the user choose the image to boot from.
    4. If the image specifies an "other" image, the boot sector from the device is loaded in the same way as LILO's primary loader and is booted.

    I haven't used NT systems extensively, since I haven't liked the lack of DOS support, but there should be some command that makes /dev/hdb1 bootable and installs ntldr and stuff on it, right?

  6. #6
    Just Joined!
    Join Date
    Nov 2002
    Location
    London, UK
    Posts
    4
    Thanks for the advice Dolda.

    Yes, from what you have explained about the Linux boot process it seems very similar to a standard NT boot process...
    1. BIOS loads MBR code
    2. MBR code searches for active partition and loads BS code from that partition.
    3. File-system specific BS code loads NTLDR.
    4. NTLDR reads boot.ini. If user chooses to boot NT it goes ahead and loads nt kernel. If user chooses to boot say linux, then NTLDR loads the boot sector from the linux partition (or the file copy of the linux BS) and re-initialises as if the MBR had loaded the linux boot sector code. From here it would be the same as a standard linux boot.

    What I am going to try and do is to copy the NTLDR, boot.ini and ntdetect.com files to my d: drive and attempt to set /dev/hdb as the active partition in my BIOS to try and boot from hdb rather than from hda. If it works it means that the XP boot sector code resides in /dev/hdb1 rather than in hdb2. If it does not work, then I know that the XP BS code resides in /dev/hda1.

    Thanks for the advise on using a test linux boot to try and copy the boot sector code. I will give it a try and let you all know the outcome.

    thanx

  7. #7
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    That active partition stuff applies to all MS O/Ss, as I know. Probably they're using the same MBR code for all of them. LILO, on the other hand, doesn't do anything with the bootable flag.
    I don't think you can set it in the BIOS, though. You'll have to use fdisk for that, unless you have a very sophisticated BIOS.

Posting Permissions

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