Posted by stringofthoughts on April 27, 2009
Hmm …. The first thing comes to mind when you see a topic like this one is why? why would anyone wanna do that ? Grub is way to awesome than NTloader and also NTloader is not designed to load anything but windows. Well lets just say for the sake of learning and a tip for very highly unlikely situation where you ‘ve a dual boot system and GRUB is not able to boot windows. In such a situation you can modify NTloader and boot Linux from windows boot loader and yes it’s true. I didn’t believe it myself at first, that’s why it’s so much fun learning new stuffs.
so here is what you ‘ll do. Assuming you ‘ve windows on /dev/sda1 and Linux on /dev/sda5. Linux and windows could be on separate disks.
$ sudo mount /dev/sda1 /mnt
$ sudo dd if=/dev/sda5 of=/mnt/ubuntu.bin bs=512 count=1
the dd command is a low-level copying tool. It copies a file and covert and format the data according to the options like bs and count in the above command. The command copies first 512 bytes to a file named ubuntu.bin .
Next you need to modify boot.ini . Assuming user has XP installed on his system.
$ sudo nano /mnt/boot.ini
and at the end of the file but in the new line (don’t leave a blank line in between) add this
C:\ubuntu.bin=”Ubuntu”
Save the file. Now you need to change the HDD priority and make the first boot device the disk which has XP installed in it. This time instead of booting directly inti windows it should show a menu with ubuntu as an option. Try booting ubuntu. If everything is fine change /boot/grub/menu.lst. There is a line #hiddenmenu change it to hiddenmenu (Just remove #).
That should do it.
Posted in Linux, tips 'n tricks | Leave a Comment »
Posted by stringofthoughts on April 27, 2009
I’ve 2 IDE disks in my computer. I used to have all my OS installed in one disk and use the other one as data disk. The problem was when say gurb fails or HDD fails i loose both OS simultaneously and that’s not a good situation cuz life without computer and internet sucks. So I installed Linux on one drive and XP on other but now there was another problem. See Linux was in my master drive and XP on slave drive. The problem with XP is that it need to be in the primary disk to be booted. So it can’t be booted from grub just by chainloading NTloader. The other option was to modify NTloader to boot linux from it, but the catch here is NTloader is not designed to boot anything but windows (typical behavior of Microsoft, thinks windows is the only OS). So for past 6 months i’ve been switching HDD priority in BIOS to boot into the OS i want. It’s not a very good way to go but it worked for me. Initialy it was a little annoying but later it became a habit.
Recently i found out that it’s possible to boot XP from the second drive using grub as primary bootloder. I’ll explain. My 2 IDE drives are connected to Primary IDE channel. Disk1 say (hd0) is Master drive and has linux+grub installed in it. Disk2 say (hd1) is slave drive with windows XP and it’s bootloader installed.
Disk1 (hd0) Linux Master_drive
Disk2 (hd1) Windows Slave_drive
From sudo fdisk -l I got windows installed in (hd1,0)
I added these lines to /boot/grub/menu.lst
title Microsoft Windows XP Professional
map (hd0) (hd1)
map (hd1) (hd0)
rootnoverify (hd1,0)
makeactive
chainloader +1
I’ll explain the commands. For windows to boot it should be on the primary disk. Map command virtually switches the primary and secondary disks. Something that we do physically by changing the jumper settings or putting drives in cable select mode.
map (hd0) (hd1) // mapping primary disk hd0 to secondary hd1
map (hd1) (hd0) // mapping secondary disk hd1 to primary hd0
Remark :: map command doesn’t work if your SATA drive needs special drivers.
After these commands now the slave drive with windows XP is the primary drive. rootnoverify (hd1,0) sets the GRUB’s root device, makeactive sets the active flag in the partition (hd1 in this case), chainload loads windows bootloader.
This is also possible with two SATA disks but if your system has one SATA and one IDE then i can’t say it would work. This was the problem posted on ubuntu forum from where i learnt about booting windows from second drive but it didn’t work for 1 SATA and 1 IDE drive.
Posted in Linux, tips 'n tricks | Leave a Comment »