Skip to content.
Infrastructure > PC2WindowsSetup
JonathanPierce? - 10 Jul 2007

The following outlines the steps taken to install Windows XP post-Linux install on PC2. We recovered a LVM partition sized roughly 40GB for the Windows install. The issue in this setup is that A) Windows obviously can't install to the logical volume and B) Windows setup hangs indefinitely after "Setup is inspecting your hardware configuration..." because it doesn't recognize the LVM partition type.

For reference, this is the original output of fdisk -l: Device Boot Start End Blocks Id System /dev/hdc1 * 1 13 104391 83 Linux /dev/hdc2 14 24321 195254010 8e Linux LVM

  • Removed var from LVM:
    • [root@tono Desktop]# /usr/sbin/lvremove /dev/VolGroup00/LogVol_var
    • Do you really want to remove active logical volume "LogVol_var"? [y/n]: y
    • Logical volume "LogVol_var" successfully removed

  • Removed swap from LVM (only volume with higher PE range than var):
    • [root@tono Desktop]# /sbin/swapoff /dev/VolGroup00/LogVol_swap
    • [root@tono Desktop]# /usr/sbin/lvremove /dev/VolGroup00/LogVol_swap
    • Do you really want to remove active logical volume "LogVol_swap"? [y/n]: y
    • Logical volume "LogVol_swap" successfully removed

  • Recreated swap (with new lowest available PE number):
    • [root@tono Desktop]# /usr/sbin/lvcreate VolGroup00? -n LogVol?_swap -L 1.94G
    • Rounding up size to full physical extent 1.97 GB
    • Logical volume "LogVol_swap" created
    • [root@tono Desktop]# /sbin/mkswap /dev/VolGroup00/LogVol_swap
    • Setting up swapspace version 1, size = 2113925 kB
    • [root@tono Desktop]# /sbin/swapon -va
    • swapon on /dev/VolGroup00/LogVol_swap
    • [root@tono Desktop]# cat /proc/swaps
    • Filename Type Size Used Priority
    • /dev/mapper/VolGroup00-LogVol_swap partition 2064376 0 -2

  • Resized LVM less 40G:
    • [root@tono Desktop]# /usr/sbin/pvresize --setphysicalvolumesize 146.19G /dev/hdc2
    • Physical volume "/dev/hdc2" changed
    • 1 physical volume(s) resized / 0 physical volume(s) not resized

  • fdisk reports 8225280 bytes per cylinder > resized less roughly [(38*1024*1024*1024)/8225280] cylinders:
    • [root@tono Desktop]# /sbin/fdisk /dev/hda2
    • Command (m for help): d 2
    • Command (m for help): n
      • 'primary' > First cylinder: '14' > Last cylinder: '19348'

  • Added NTFS partition:
    • [root@tono Desktop]# /sbin/fdisk /dev/hda2
    • _New primary > Defaults are fine because it's the only remaining space on the disk > 't' to change type > '3' for new partition > '7' to change to NTFS

  • Rebooted to verify everything was fine, then (IMPORTANT) saved the output of 'fdisk -l'
    • Added NTFS partition using remaining space:
    • Device Boot Start End Blocks Id System
    • /dev/hdc1 * 1 13 104391 83 Linux
    • /dev/hdc2 14 19348 155308387+ 8e Linux LVM
    • /dev/hdc3 19349 24321 39945622+ 7 HPFS/NTFS

  • Using the same procedure to delete as above in the 'fdisk reports 8225280...' step (but without recreating this time!), deleted partitions 1 and 2. This hides the partitions from Windows.

  • Rebooted and installed Windows on the third partition. It's important at this stage that what is now reported as free space is NOT touched. Declaring the third partition type NTFS in Linux makes this simple to visually double check in the Windows installer.

  • After install is working, started from our Ubuntu Live CD, then restored the partitions in fdisk.
    • Command (m for help): n
    • primary > First cylinder: 14 > Last: 19348
    • Command (m for help): n
    • primary > First cylinder: 19349 > Lsat: 24321

  • The partition table is out of order at this point. This is unavoidable because Windows was installed on what it saw as the first partition:
    • [root@tono ~]: /sbin/fdisk -l
    • Device Boot Start End Blocks Id System
    • /dev/hdc1 19349 24321 39945622+ 7 HPFS/NTFS
    • /dev/hdc2 * 1 13 104391 83 Linux
    • /dev/hdc3 14 19348 155308387+ 8e Linux LVM

then restored GRUB after adding an entry for windows(overwritten by the Windows MBR):

    • Edited [mount for /dev/hdc2]/grub/menu.lst, updating all references to the new partition scheme and adding:
      • title Microsoft Windows XP
      • rootnoverify (hd0,0)
      • makeactive
      • chainloader +1
    • root@ubuntu $: grub
    • grub > root (hd0,1)
    • grub > setup (hd0)

After this procedure, I was able to reboot and select either Windows or Linux.