(For Vista or Windows 7 see Post 4 )
This is a follow up on Herman's post on how to boot XP from a logical partion. His post is not only relevant if XP is on a logical partition, it also applies whenever the boot files for XP are missing. Let me summarize and refine his method
Step 1) Boot into Ubuntu and mount the XP partition.
Step 2) Download the attached file Archive.tar.gz. Extract the three files boot.ini , NTLDR and NTDETECT.COM to (the root of) the XP partition.
Step 3) Edit "boot.ini". The number in ``partition(1)'' needs to be changed to the correct number for your XP partition. Windows starts counting at 1 and counts partitions in the order of the partition table (so far that's the same way linux counts) BUT skips over extended partitions and empty partitions.
If XP is on a logical partition:
Step 4) Do NOT use ``makeactive'' in menu.lst.
Step 5) Use testdisk to rebuild the boot sector.
Remarks:
I) In theory one should be able to replace Step 3) by "bootcfg /rebuild" from the Windows Recovery Console. But this did not work out for me. bootcfg did not detect XP, probably since it was on a logical partition.
II) Step 5) seems to be unnecessary in some cases.
Detailed Instructions:
Step 1) Mount your windows partition in Linux
(here /dev/sda5 must be replaced by the device name of your Windows partition. Use "sudo fdisk -l" to determine the device name)Code:sudo mkdir /Win sudo mount /dev/sda5 /Win ls /Win
The last command lists all the files in the System directory of your Windows Partition. Look for the files "boot.ini", "NTLDR" and "NTDETECT.COM". If you already have these files, skip Step 2.
Step 2) Get the boot files and copy them to your Windows partition
Download this file: http://ubuntuforums.org/attachment.p...6&d=1212690573
and save it to your home folder (/home/your_username). Then
Make sure you now have the files "boot.ini", "NTLDR" and "NTDETECT.COM"Code:cd /Win sudo tar -xvzf /home/your_username/Archive.tar.gz ls /Win
Step 3 Edit boot.ini
Change all "partition(1)" to "partition(3)" (there are two of them) Do not change anything else. Here "3" must be replaced by the correct number for your XP partition. See this post for some examples.Code:sudo nano /Win/boot.ini (don't use "gedit", since it does not handle dos files correctly )
Save the the file.
Step 4 Add XP to the Grub menu
If you are using Grub 2
(if that does not work, try "sudo grub-mkconfig -o /boot/grub/grub.cfg)Code:sudo update-grub
If you are using Legacy Grub
UseCode:gksudo gedit /boot/grub/menu.lst
title XP
rootnoverify (hd0,4)
chainloader +1
Do NOT use "makeactive".
Of course (hd0,4) needs to be adjusted. The first number is the hard drive and the second number the partition. Grubs starts counting at zero, and counts the hard drives according to the order in the bios. So the boot drive is always (hd0). The second number is always one less than the number in the device name. So if Windows is /dev/sda5, then the second number is 4.
The "hd" is always "hd", even if the device name contains "sd".
If Windows is not on the boot drive, you need to add "map" lines:
title XP
rootnoverify (hd3,4)
map (hd0) (hd3)
map (hd3) (hd0)
chainloader +1
Save the file and reboot. Sometimes this does not work right away and you have to do the fifth step.
Step 5: Rebuild the Boot sector of the Windows partition.
Install and run "testdisk:
(Replace /dev/sda by device name of the XP partition without the number)Code:sudo apt-get install testdisk sudo testdisk /dev/sda
Press "enter" to "proceed"
Press "enter" to select "intel"
Use the "down arrow" and "enter" to select "advanced"
Use the down arrrow to select the "XP" partition and then "enter" to select "boot"
Use the "right arrow" key and "enter" to select "Rebuild BS"
This might take a while. Once done:
Use the "right arrow" key and "enter" to select "write". This will write a modified boot sector to the Windows partition.
Press q a few times to quit testdisk.
Reboot.
( You can delete "Archive.tar.gz" at any time, but I would wait until you successfully booted into XP)
If you do not have a working internet connection in Ubuntu
In Step 2: Download Archive.tar.gz on a different computer and use a flash drive to transfer it to your Ubuntu home folder.
In Step 5: Download the testdisk-6.10.linux26.tar.bz2 package on a different computer and use a flash drive to transfer it to your Ubuntu home folder. Then in a terminal
(Replace /dev/sda by device name of the XP partition without the number)Code:cd tar xvf testdisk-6.10.linux26.tar.bz2 sudo testdisk-6.10/linux/testdisk_static /dev/sda
Press "Enter" to "proceed" and continue as in Step 5.
Windows 2000
This tutorial also works for Window 2000 with one modification:
Each occurrence of "\Windows" in boot.ini must be replaced by "\WINNT"
This thread successfully used the method and contains some more information.
Bookmarks