Hi Joe,
First ... I'd like to say kudos to Larry (Dazed) and all the great guys
that give their time so generously at the monthly Installfests, providing
such excellent help.
Last Saturday, while trying to shrink a 40-gig partition on my xp laptop
so I could add Linux, we ran into a stumbling block with Gparted not
working.
Since then, I've been searching for other options. Knoppix CD had one
called "QTParted" that seemed to work better than Gparted ... but it also
did not work.
Finally, I found a really slick, free download GUI partition editing
bootable CD here: www.PartitionWizard.com/download.html ... with an iso
named: pwhe7.iso
When loading, it showed the name "tinycore" as its Linux platform, and
when loaded it had the slickest (by far) graphical interface of any
partition editor I've seen ... and it worked great and fast. I used
'chkdsk' and 'defrag' on the 40-gig hard disk and that seemed to show that
only about 20% of the disk was used with no indicted disk usage beyond the
50% point on the disk. So, I decided to just shrink the xp partition to
22 gig which I though would avoid damaging any of the xp files on the
disk.
That left 16 gig free to install Linux, so I used 3.6 gig for "/" 3.9 gig
for swap and the remaining 10 gig for "/home"
Installation of Kubuntu 12.04 went flawlessly and it works fine ...
however ... the GNU GRUB version 1.99-21-ubuntu3 boot that Kubuntu
installed shows 5 entries of which only the first four work:
- Ubuntu, with Linux 3.2.0-23-generic-pae
- Ubuntu, with Linux 3.2.0-23-generic-pae (recovery mode)
- Memory test (memtest86+)
- Memory test (memtest86+, serial console 115200)
- Microsoft Windows XP Professional (on /dev/sda1)
But xp does not boot.
The Windows bootloader stores information about how big the partitions on the hard drive are. If you change a partition size, Windows checks the new partition size at the very next reboot (using either chkdsk in XP or a new utility in Vista/Windows 7). It then writes that info to its bootloader configuration file. If you start mucking around with other partitions before it has a chance to record the changes and reset itself accordingly, the Windows bootloader will not be able to read the partition table properly (and will then refuse to boot entirely).
Since Grub boots Windows merely by chainloading the Windows bootloader, if the Windows bootloader doesn't work (i.e. doesn't recognize its own changed partition), then you are sunk.
If you ignore these warnings, I almost guarantee you will fry your Windows partitioning scheme and be unable to boot up Windows.
Reference: http://ubuntuguide.org/wiki/Multiple_OS_Installation#Using_Grub_Legacy_for_the_boot_partitionGrub offers an option to edit each entry, and when I do that
to the M$ entry, this is what I see:
setparams 'Microsoft Windows XP Professional ()on /dev/sda1)"
insmod part-msdos
insmod ntfs
set root='(hd0,msdos1)"
search --no-floppy --fs-uuid --set=root 01CD5DCE2C361380
drivemap -s (hd0) ${root)
chainloader +1
It is easiest if your Windows partition is the first one installed. This is because the Windows bootloader looks for Windows in the first partition. Also, Windows installers are unpredictable and can overwrite anything that is already installed on the hard drive.
If you have a brand new computer with no OS pre-installed, partitioning and OS installation is much easier. Create all your partitions before installing Windows. Make the first partition NTFS (or the less secure FAT32, if you wish), intending it for the Windows installation. Then divide the remainder of the hard drive (using GParted) using the partitioning scheme outlined above.
Generally, a retail "boxed" version of Windows (instead of an OEM or "backup" copy) installs quite happily to the first pre-configured, pre-sized partition. Go ahead and install it there, then skip on ahead to installing the Linux OSs.
You can use GParted to resize a Windows XP partition directly (without needing re-installation), but it is still best to reboot Windows XP twice after resizing its partition (before taking any other steps with GParted). Review this tutorial's section "Making Shrink Volume Work." Although Windows XP does not have a shrink volume utility, to resize the partition using GParted, these steps must be taken anyway. Specifically:
then reboot once (which will erase the C:\pagefile.sys file). Defragment the hard drive. Then log off Windows and start GParted. Now you will be able to shrink the XP partition.
Windows installations, re-installations, and upgrades rewrite the Master Boot Record so that it points to the Windows bootloader only (instead of to the copy of Grub in the boot partition). The Master Boot Record must therefore be re-written so that it will again point to the copy of Grub stored in your boot partition.
For this example, assume the boot partition is the /dev/sda3 partition (which is known as (hd0,2) to Grub Legacy).
You must use a version of a LiveCD that has Grub Legacy, i.e. Kubuntu/Ubuntu 9.04 (Jaunty) or earlier. Start the LiveCD and start a command-line terminal (Terminal in Ubuntu or Konsole in Kubuntu). From the command-line terminal start grub:
sudo grub
Then enter the commands to restore the Master Boot Record to point to the boot partition at /dev/sda3:
> root (hd0,2) > setup (hd0) > quit
Then reboot. Your previously created Grub bootup-menu options should again appear.
In Grub Legacy it is possible to specify the root of the partition to be chainloaded using a UUID instead of the hd(0,x) notation. If you do not know the UUID for the partition to be chainloaded, it can be discovered using:
sudo blkid
Replace the
root (hd0,6)
entry in the /boot/grub/menu.lst file (of the primary /boot partition)
with
uuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
where xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx represents the actual UUID of the partition to be chainloaded.
root (hd0,9) chainloader +1
uuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx chainloader +1
This method works no matter which operating system is to be chainloaded. It will not work, however, for the operating system stored in (hd0,9) due to a quirk (see below).
Will it work for bootable devices (such as USB flashdrives) that have a UUID? I don't know -- I haven't tried it yet!
root (hd0,9) configfile /boot/grub/menu.lst
uuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx configfile /boot/grub/menu.lst
title Kubuntu Oneiric OS (chainloader) rootnoverify (hd0,6) kernel /vmlinuz root=/dev/sda7 ro initrd /initrd.img
title (K)Ubuntu Oneiric OS (chainloader) rootnoverify (hd0,6) kernel /boot/grub/core.img
Grub Legacy has a quirk -- it does not like to chainload (hd0,9) using the command chainloader +1. (Something about 9 + 1 = 10 requiring an extra digit, or something.)
Most people don't have more than 2 or 3 operating systems on their computer so it is usually not an issue. Here at Ubuntuguide, however, we chainload as many as 10 different OS on every machine (not including virtual machines).
If the operating system in a chainloaded partition happens to use Grub Legacy (and therefore uses /boot/grub/menu.lst locally), the alternative to
chainloader +1
is to use the command
configfile (hd0,9)/boot/grub/menu.lst
(This can be used for any partition in which the chainloaded operating system uses Grub Legacy, not just (hd0,9). It will not work, however, if the chainloaded operating system uses Grub2.)
This can alternatively be specified as
rootnoverify (hd0,9) /boot/grub/menu.lst
uuid xxxxx-xxxx-xxxx-xxxx-xxxxx /boot/grub/menu.lst
Of course, you must find out the UUID for (hd0,9) first:
sudo blkid
*** So *** what can I do to fix grub so it will boot xp?
Or have I completely destroyed it?
---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss