Resize partition solution -and- problem.

Lisa Kachold lisakachold at obnosis.com
Mon Jul 9 19:33:50 MST 2012


Hi Joe,

On Mon, Jul 9, 2012 at 3:47 PM, <joe at actionline.com> wrote:

> 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_partition


> Grub 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
>
>
>  Windows partitions

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<http://ubuntuguide.org/wiki/Ubuntu:All#GParted_Partition_Manager>)
using the partitioning scheme outlined
above<http://ubuntuguide.org/wiki/Multiple_OS_Installation#Partition_design>.


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<http://ubuntuguide.org/wiki/Multiple_OS_Installation#Install_your_first_Linux_OS>.

 Windows XP (or earlier)

You *can* use GParted<http://ubuntuguide.org/wiki/Ubuntu:All#GParted_Partition_Manager>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<http://www.howtogeek.com/howto/windows-vista/working-around-windows-vistas-shrink-volume-inadequacy-problems/>'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:

   - Use the Disk Cleanup Wizard to remove unnecessary files.
   - Uninstall "deadwood" programs and unneeded/unwanted Windows Components
   (using Control Panel -> Add/Remove programs).
   - Disable System Restore (Control Panel -> System -> System Restore ->
   Turn off System Restore on all drives)
   - Disable the page file (Control Panel -> System -> Advanced ->
   Performance:Settings -> Advanced -> Virtual memory:Change -> No paging file
   (*ticked*) -> Set)
   - Disable debugging (Control Panel -> System -> Advanced -> Startup and
   Recovery:Settings -> Write debugging information: *(none)* )
   - Disable Hibernation (Control panel -> Power Options -> Hibernate ->
   Enable hibernation (*unticked*) )

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.

   - After resizing the NTFS Windows partition, quit GParted and log into
   Windows again. Chkdsk will be run automatically and the computer will
   reboot. Login to a user account in Windows. It will prompt you to reinstall
   new hardware (the resized partition). Accept. Now turn back on the services
   turned off in the steps listed above, in reverse order. To be safe, log off
   Windows and log in one extra time. Now you are finished resizing the
   Windows XP partition and can proceed to other disk manipulations with
   GParted (or other activities such as installing (K)Ubuntu).


  Re-installing Grub Legacy after Windows upgrade or re-installation

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) <http://releases.ubuntu.com/9.04/> 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.
 Other chainloader options

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.

   - Example:

Replace the lines (in the /boot/grub/menu.lst file)

root (hd0,9)
chainloader +1

with the lines

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!

   - This next method will only work when the operating system in the
   chainloaded partition uses Grub Legacy (and has a local /boot/grub/menu.lst
   stored within the partition):

Replace the lines (in /boot/grub/menu.lst)

root (hd0,9)
configfile /boot/grub/menu.lst

with the lines

uuid *xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx*
configfile /boot/grub/menu.lst

 Chainloading Grub2 from Grub Legacy

   - Grub2 is erratic. I no longer chainload it. Instead, it is possible to
   bypass Grub2 entirely and load an OS directly using Grub Legacy (stored in
   a boot partition, for example) using an entry in menu.lst of the format:

title Kubuntu Oneiric OS (chainloader)
rootnoverify *(hd0,6)*
kernel /vmlinuz root=*/dev/sda7* ro
initrd /initrd.img


   - My old method for chainloading Grub2 (installed in this example in the
   */dev/sda7* partition) from Grub Legacy used an entry in the Grub Legacy
   configuration file (/boot/grub/menu.lst, stored in the standalone boot
   partition with the Grub Legacy files) with this format:

title (K)Ubuntu Oneiric OS (chainloader)
rootnoverify *(hd0,6)*
kernel /boot/grub/core.img

 The (hd0,9) problem

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


   - It is also possible to chainload by specifying the UUID for the
   chainloaded partition (hd0,9):

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?
>

 Probably not, follow the instructions on the link.



>
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>



-- 
(503) 754-4452 Android
(623) 239-3392 Skype
(623) 688-3392 Google Voice
**
<http://it-clowns.com>Safeway.com
Automation Engineer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20120709/a5236d2d/attachment.html>


More information about the PLUG-discuss mailing list