Fix Windows when boot files (boot.ini,NTLDR)are missing
Posted Under: General
Today I saw a thread in ubuntuforums said someone lost ntldr file after ubuntu installed.And this tutorial shows how to fix Windows when you lost boot.ini,ntldr files.You do not need a Windows Live-CD,just need to boot into Ubuntu.
1.Mount the Windows partition.
Use this command to determine the device name of Windows,always Windows installed in first partition of first hard disk.
sudo fdisk -l
Create a mount point and mount the partition:
sudo mkdir /media/WinXP
sudo mount /dev/sda1 /media/WinXP -t ntfs -o rw
Change /dev/sda1 to the device name.
2.Download archivetar,and extract to the root directory of Windows partition.
Use following command to extract the package.
cd /media/WinXP
sudo tar -xzvf ~/Archive.tar.gz
And run this command,you should see the three files:boot.ini,NTLDR,NDETECT.COM
3.Edit boot.ini(if your Windows partition is sda1,skip this step).
sudo nano /media/WinXP/boot.ini
Change all “partition(1)” to “partition(n)”,for example,your Windows partition is dev/sda5,change all “partition(1)” to “partition(5)”.Ctrl+O and Enter to save file,the Ctrl+X to close.
4.Edit /boot/grub/menu.lst
gksudo gedit /boot/grub/menu.lst
Find this section:
title Microsoft Windows XP Professional
rootnoverify (hd0,0)
savedefault
makeactive
chainloader +1
and delete the line “makeactive”,if there’s no this section,add it to the end without “makeactive”.(hd0,0) stands for the first partition of the first hard drives.
5.Rebuild Boot sector.
Download the http://www.cgsecurity.org/testdisk-6.10.linux26.tar.bz2
Run following commands:
tar xvf testdisk-6.10.linux26.tar.bz2
sudo testdisk-6.10/linux/testdisk_static /dev/sda
Enlarge the terminal window and:
Press “enter” to “proceed”
Press “enter” to select “intel”
Use the “down arrow” and “enter” to select “advanced”
Use the down error 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.
Then just follow the instruction on the screen to save to quit testdisk.
Reboot.
Related posts:
- How to restore Grub 2 after reinstalling Windows XP/Vista/Win7
- How to uninstall ubuntu dual boot with windows
- Install Ubuntu without burning LiveCD from Windows 7 dual-boot(not wubi)
- How to install Windows 7 from Ubuntu without burnning a disc
- How to mount a partition(ntfs,fat32,.iso,and so on) in ubuntu

Reader Comments
Thank u very much
[Reply]
Thanks for writing this article! I did a dual boot to get away from Windows whenever I do not have to use the Adobe CS4 software, and once Ubuntu 9.10 was installed I could not load Win XP. I did not get any message/error – just a blank screen. Changing the line in the Grub 2 file (grub.cfg) rootnoverify (hd0,1) -to- rootnoverify (hd0,0) fixed Win XP. It saved me a ton of time and headaches of reinstalling all the windows software and customizing again. Many thanks!
[Reply]