Windows XP/Vista/7 iSCSI Boot

Posted by: thogan 6 years, 5 months ago

This post details setting up Windows to boot from an iSCSI volume.

UPDATE: A lot of people are hitting this searching for Windows 7 iSCSI boot info. It's EASY! Jump to the bottom for some links that should get you going. The bulk of this article is about Windows XP iSCSI booting, which is also easy, but more involved than Windows 7.

It has been awhile now since I have lost my animosity toward people who destroy computers that I administer.  Mostly because I get paid money to spend half my time at work un-breaking and tidying *NIX servers.  It also means that I have a particular attraction to anything that helps me clean up the users' mess more quickly.

Enter: My home media PC.

This is a computer attached to the TV in my living room.  Everyone who uses it is 90% likely to be intoxicated and know nothing about computers.  When we get back from the bar or just party at home this thing ends up being used to troll YouTube and email until the wee hours of the morning.  It's 3:30am and your drunk friend checks his email and gets a link to download sweetvideo.exe.  "Sounds GREAT!"

First of all, Linux was not an option for this computer.  We do not have cable, so all the Silverlight, Window Media, Netflix, and other proprietary DRMed video players have to work.

The solution was Windows XP, booting from the network off of an iSCSI target, where the exposed LUN is an LVM snapshot of a fresh, virus-free, and fully patched installation.

Extra Storage

I have long been using LVM and a large disk array for general storage management.  My main storage server has two volume groups: rootvg - a pair of mirrored 750 GB drives for the OS, and datavg - a 4.2 TB storage volume.  The 750 GB drives are of that size because that is what I had on hand.  In goo admin style, I had used only what I needed of them in my system LVs.  I expected that maybe later I could use the rest of the space for something else.

So with 600 GB of free space on a mirrored volume group, I set out to find a way to install Windows on it, export the volume, and boot across the network on it.

gPXE and iSCSI

The key to everything I have running now is gPXE (http://etherboot.org/wiki/index.php).  This sweet PXE program has the key ability of attaching to an iSCSI device at boot time.  The HOW-TOs on the site are flawless.  Just make sure to pay attention to the special instruction for Windows XP (as opposed to 2003) that involves running a script to enable iSCSI booting.  (Relevant Page)

I followed the HOW-TO instructions and installed a Windows XP then converted it to iSCSI boot and transfered the disk image to a logical volume on my storage server's "rootvg".

IMPORTANT NOTE! In my first attempt I installed Windows XP and applied all available patches, SP3, and IE8.  Then installed AVG and several other goodies.  I NEVER GOT THIS TO iSCSI BOOT!  It only worked when I converted a fresh install to iSCSI boot then applied all patches and goodies.

iSCSI, LVM Snapshot, and DCHP Config

My storage server is running Ubuntu 9.04.  The relevant package for using it as an iSCSI target that I installed is "iscsitarget".

After installing Windows and patching it, plus installing relevant software, I made an LVM snapshot:

  --- Logical volume ---
  LV Name                /dev/rootvg/medialv
  VG Name                rootvg
  LV UUID                p2Kqzg-aSn4-31TD-2CsU-1jeX-ugQ5-E0ZfNU
  LV Write Access        read/write
  LV snapshot status     source of
                         /dev/rootvg/mediasnap [active]
  LV Status              available
  # open                 0
  LV Size                32.00 GB
  Current LE             8192
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:6

  --- Logical volume ---
  LV Name                /dev/rootvg/mediasnap
  VG Name                rootvg
  LV UUID                pB7ftO-9BAv-i6eA-N91E-PmYg-BIXN-0Bc30y
  LV Write Access        read/write
  LV snapshot status     active destination for /dev/rootvg/medialv
  LV Status              available
  # open                 1
  LV Size                32.00 GB
  Current LE             8192
  COW-table size         32.00 GB
  COW-table LE           8192
  Allocated to snapshot  2.64%
  Snapshot chunk size    4.00 KB
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:7

The snapshot is the same size as the original volume.  This allows unlimited modification to the snapshot volume.  You can probably get away with making the COW table 10% or so of the original volume size, but I had the space available.

I then exposed this volume via iSCSI.  Here is the relevant content in my ietd.conf file:

Target iqn.2009-01.lan.near:media.host0
        Lun 0 Path=/dev/rootvg/mediasnap,Type=blockio

I built the gPXE image for PXE chainloading per the site's instructions and then configured my DHCP server to shell out this image then instruct gPXE to iSCSI boot the Windows XP install.

Here is the relvent section of my dhcpd.conf file:

host media {
        hardware ethernet 00:19:21:a6:70:ef;
        fixed-address 192.168.5.202;
        option host-name "media";

        if exists user-class and option user-class = "gPXE" {
                filename "";
                option root-path "iscsi:192.168.5.3::::iqn.2009-01.lan.near:media.host0";
        } else {
                filename "undionly.kpxe";
        }
}

And Now, Simple Recovery

Now the media PC boots Windows XP off of an iSCSI target, which is a snapshot of a clean install.  I no longer need to take potentially restrictive measures to protect that PC (those that may limit functionality).  If I need to rebuild, I remove the "mediasnap" logical volume snapshot and recreate it.  Then reboot the media PC.  All done.  Five minutes later I have a clean media PC again!

Windows 7

I also have installed Windows 7 against an iSCSI target for use on my desktop for games.  Windows 7 is much easier to install on iSCSI, as it supports installation directly onto the target and requires no fiddling to get it to boot.  Just keep in mind that with gPXE you will need to add the "gpxe.keep-san" option to your DHCP config in order to install directly onto the iSCSI target.  This will involve adding configuration for the "gpxe" namespace to your DHCP configuration. (I will link to details in an edit soon).

EDIT: Here is the link. (http://www.etherboot.org/wiki/dhcpd) You will need to add the gpxe specific DHCP option definitions to your DHCP config to use those option names later in the config file.

Posted by: thogan