Re: Boot Windows XP from high block number?

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

 



On Sat, Mar 21, 2009 at 5:13 PM, Rangeen Basu <sherry151@xxxxxxxxx> wrote:
> On Sat, Mar 21, 2009 at 9:32 AM, Jonathan Ryshpan <jonrysh@xxxxxxxxxxx> wrote:
>> I have installed Linux and Windows XP on my hard drive and am trying to
>> set up a dual boot.  Unfortunately XP is installed at a high sector,
>> namely block 204438565.  The partition table starts:
>>
>>   Device Boot      Start         End      Blocks   Id  System
>> /dev/sda1              63     2040254     1020096   83  Linux
>> /dev/sda2         2040255   104438564    51199155   83  Linux
>> /dev/sda3   *   104438565   206836874    51199155    b  W95 FAT32
>> ...
>>
>> I have set up grub.conf as follows:
>>
>> ...
>> title Windows
>>        rootnoverify (hd0,2)
>>        chainloader +1
>>
>> The grub initialization screen starts OK, but when I select Windows,
>> grub fails with a disk read error.
>>
>> Questions:
>>
>> (1) Is grub.conf set up right for this partition table?
>>
>> (2) Is it possible to boot XP at this location, or do I have to
>> reinstall Linux and XP with their partition reversed, so as to get the
>> XP partition to a smaller block number?
>>
>> (3) Is there some quicker way to get the partitions reversed other than
>> reinstallation?
>>
> I read somewhere that windows needs to be the first partition to boot
> properly. So you may try installing windows at hd0,0 and try again.

Jonathan, I may have better news:

It is widely-quoted advice that (#1): a Windows boot partition must be
the first partition on the drive. Most advice suggests installing
Windows first. I found this  annoying in several scenarios.

However recent problem solving activity on this machine led me to
experiment and discover that while this is close to the truth, it is a
"sufficient" but not "necessary" condition.

What apparently _is_ essential for the Windows boot loader is
specifically that (#2): the Windows boot partition is the first entry
in the drive partition table.

In most situations without intervention, the requirement (#2) is
achieved as a consequence of (#1). However, in a situation where the
first partition on the drive is already in use, I have found it is
possible to install Windows on a higher numbered partition and then
delete and recreate the parition table entries in the correct order.

For example, I did this on the hard drive on this box, it currently
has 3 bootable partitions: Windows 2000, MSDOS, and Fedora 9 shown
below.

The following parted output shows each partition in its physical
sequence  by ascending "Start" sector number. Note that the "Number"
column (= the order in which the partition table entries were created)
is not in the same order.
3=\boot
2=MSDOS
1=Windows 2000
4=extended partition containing logical partitions 5,6,7,8
5=FAT32
6=swap
7=\
8=\home

[root@kablamm david]# /sbin/parted
GNU Parted 1.8.8
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print free
Model: ATA ST320014A (scsi)
Disk /dev/sda: 20.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
 3      32.3kB  107MB   107MB   primary   ext2
 2      107MB   370MB   263MB   primary   fat16        hidden
 1      370MB   5618MB  5248MB  primary   fat32        boot, lba
 4      5618MB  20.0GB  14.4GB  extended               lba
 5      5618MB  10.9GB  5248MB  logical   fat32        lba
 6      10.9GB  11.9GB  1077MB  logical   linux-swap
 7      11.9GB  18.4GB  6498MB  logical   ext3
 8      18.4GB  20.0GB  1579MB  logical   ext3

(parted) unit s
(parted) print free
Model: ATA ST320014A (scsi)
Disk /dev/sda: 39102336s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start      End        Size       Type      File system  Flags
 3      63s        208844s    208782s    primary   ext2
 2      208845s    722924s    514080s    primary   fat16        hidden
 1      722925s    10972394s  10249470s  primary   fat32        boot, lba
 4      10972395s  39102209s  28129815s  extended               lba
 5      10972458s  21221864s  10249407s  logical   fat32        lba
 6      21221928s  23326379s  2104452s   logical   linux-swap
 7      23326443s  36017729s  12691287s  logical   ext3
 8      36017793s  39102209s  3084417s   logical   ext3

I achieved this by first installing Fedora 9 with blank spaces for the
fat partitions, and then by hiding each previously installed primary
partitions while installing the next OS. This achieved the physical
sequence on the drive as shown above, but with parition numbers in
ascending order. If I recall correctly, at this point Windows would
not boot. I then made a note of all the start and end sector data, and
then used parted commands "rm" and "mkpart" and "set" to delete and
recreate the partition table shown above.

Why bother? So I can start both Windows and MSDOS from /boot/grub
without using Windows ntldr.

I kept the \boot and MSDOS partitions small, so that the start of the
Windows partition was not too far from the start of the drive. I have
not tested a scenario where this is not the case, and would be very
interested to hear back from you to further my knowledge if grub is
able to directly boot Windows in your situation.

Its also necessary to hide the two Micro$oft operating sytems from
each other; I achieve this in /boot/grub/grub.conf as follows:
title Windows 2000
	hide (hd0,1)
	unhide (hd0,0)
	rootnoverify (hd0,0)
	makeactive
	chainloader +1

title MSDOS 6.20
	hide (hd0,0)
	unhide (hd0,1)
	rootnoverify (hd0,1)
	makeactive
	chainloader +1

If you have only one Micro$oft OS then this may not be necessary.

At some point you may encounter grub having trouble locating the
correct boot partition. So before you start ensure that you an
alternative method of booting into linux in case your hdd grub fails.
Then use that to boot and reinstall grub, see "info grub". Once I had
a paper record of the parition table, I didnt lose any data in this
situation.

Warning: fiddling with the partition table can result in data on the
drive becoming inaccessible. Do not attempt any of this this unless
you are confident and have backups. You will need or develop a strong
knowledge of parted and grub. But if you are that way inclined I knew
nothing when I started and was able to achieve what I desired.

Hope this helps, David

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux