The Microsoft HPC & Batch Team Blog

The blog for the Big Compute team in Microsoft Azure, working on HPC & Batch services and technologies

How to Capture a “Master” Compute Node Image Using Node Templates

How to Capture a “Master” Compute Node Image Using Node Templates

  • Comments 4
  • Likes

Whenever I discuss image management capabilities of the HPC Cluster Manager, one question which invariably arises is, “How do I capture an image of a compute node which has been customized so that I can use it as the ‘master’ for deploying to the rest of the nodes?” My response has been to send an email with a link to the Windows Automated Installation Kit (AIK), and the Microsoft Deployment Toolkit (MDT).   While these kits include the necessary tools and techniques, it is very much like looking for a needle in a haystack because of the volume of information which does not pertain to the HPC environment.  The HPC Cluster Manager already leverages most of the tools described in the links above when it is provisioning new nodes from bare metal.  Having sifted through all of the extraneous material, the intent of this post is to describe a simple process for creating a master image and then deploying it using customized Node Templates. 

Obtain a copy of imagex.exe

The one tool which is required for capturing an image that is not already included with the HPC Cluster Manager is called imagex, and even though it is a free download, it is not easy find.  It may be available elsewhere, but here is what I had to do:

1.       Download the AIK iso from the link above.

2.       Burn a DVD, then install the AIK (it doesn't matter what machine you install it on, you are only doing this to extract the imagex.exe file)

3.       Navigate to C:\Program Files\Windows AIK\Tools\amd64\

4.       Copy imagex.exe to the C:\Program Files\Microsoft HPC Pack\Data\InstallShare\ directory on the headnode.   

Customize the "master" compute node

After deploying at least one compute node with the Windows HPC Server 2008 image, install all of the applications, patches, drivers, etc. which are necessary for your environment onto one of the compute nodes. 

Note: Be sure that the node was installed from Volume License media and not from retail media.

Run sysprep on the "master" compute node

First run the re-arm command which will reset the grace period for activation for the node by opening a command prompt and typing:

c:\windows\system32\slmgr.vbs –rearm

Then navigate to the C:\Windows\system32\sysprep folder, then right click on sysprep and select “Run as Administrator”.  In the window that pops up, select Enter System Out-of-Box Experience (OOBE) for the System Cleanup Action field, and be sure to check the Generalize box.  (The first time I ran through this process, I did not have that box checked and the resulting image would not install properly).  Also, change the Shutdown Options to Shutdown rather than Reboot, because you don’t want it to boot again until after you’ve captured the image.

Note: This operation will leave the master compute node in a somewhat crippled state.  Before it can re-join the cluster, it must either be re-installed along with the rest of the compute nodes, or go through a manual process of adding back the information which was removed by the sysprep operation.

Create the Image Capture Node Template

Fortunately, booting to WinPE is built-in to the process when you install a compute node from bare metal.  So, the only thing that needs to be added is the imagex command to capture the sysprep’ed image. This is done by creating a new Node Template.  To create a Node Template, first select Configuration from the main sections on the left side of the HPC Cluster Manager.  Then Select Node Templates from the list above.

You can import this sample by copying the xml below to a file named ImageCapture.xml

<?xml version="1.0" encoding="utf-8"?>

<Template xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"

  Description="">

  <Item

    Name="UnicastCopy">

    <Parameter

      Name="Source"

      Value="imagex.exe" />

    <Parameter

      Name="Destination"

      Value="x:\imagex.exe" />

    <Parameter

      Name="Description"

      Value="Copies the imagex program to the temp drive on the compute node." />

  </Item>

  <Item

    Name="ExecuteCommand">

    <Parameter

      Name="Command"

      Value="x:\imagex.exe /capture c: z:\images\Goldenimage.WIM &quot;Golden Image&quot;" />

    <ParameterList

      Name="ErrorWhiteList" />

    <Parameter

      Name="Description"

      Value="Runs the capture function of Imagex." />

  </Item>

  </Template>

 

Then, select Import on the Node Template Actions menu, navigate to the file you just created, then select it.

Assign the Image Cature Node Template to the "master" compute node

 

Once the Image Capture Node Template has been created, the process of capturing the image consists of simply booting up the master compute node and assigning the new template to it.

First, make sure the node is set to PXE boot, and then boot it up.  Next, assign the image capture template to the node.  From the Node Management window, you can right click on the node, then select Assign Node Template …then choose the Image Capture template. You can monitor the process by selecting the node and clicking on the Provisioning Log tab.

 

When this process is completed, it will have created an image named Goldenimage.WIM and copied it to the C:\Program Files\Microsoft HPC Pack\Data\InstallShare\images\ directory on the headnode. 

 

As noted above, the master compute node will be left hanging and will need to be manually powered down and then either re-installed with the rest of the compute nodes or be manually reconfigured to restore the settings which were removed in the sysprep process.

 

Add the new image

This newly captured image will need to be added to the collection of images which are available for inclusion in the Node Templates.  To do this, first select Configuration from the main sections on the left side of the HPC Cluster Manager.

Then Select Images from the list above.

Then select Add Image from the Actions pane.

Select Load an existing Operating System Image then click on the Browse button and navigate to the C:\Program Files\Microsoft HPC Pack\Data\InstallShare\images\ directory, select Goldenimage.WIM, then click Open, then OK.

Create a new Node Template for deploying the master image

Many of the steps which are included in the Default Node Template such as installing the .NET Framework and the HPC Pack are not necessary for deploying the master image, so we must create a new Node Template.  Copy the xml below to a file called “Deploy Captured Image.xml” then follow the steps outlined above to import this xml file to a Node Template.

<?xml version="1.0" encoding="utf-8"?>

<Template xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"

  Description="">

  <Item

    Name="CreateADAccount">

    <Parameter

      Name="Description"

      Value="Creates a computer account in Active Directory for the compute node." />

  </Item>

  <Item

    Name="UnicastCopy">

    <Parameter

      Name="Source"

      Value="config\diskpart.txt" />

    <Parameter

      Name="Destination"

      Value="x:\diskpart.txt" />

    <Parameter

      Name="Description"

      Value="Copies a file or folder from the head node using SMB protocol." />

  </Item>

  <Item

    Name="PartitionDisk">

    <Parameter

      Name="DiskPartScript"

      Value="x:\diskpart.txt" />

    <Parameter

      Name="Description"

      Value="Partitions the disks on the compute node using a script for Diskpart." />

  </Item>

  <Item

    Name="UnicastCopy">

    <Parameter

      Name="Source"

      Value="Images\Goldenimage.WIM" />

    <Parameter

      Name="Destination"

      Value="%INSTALLDRIVE%\Goldenimage.WIM" />

    <Parameter

      Name="Description"

      Value="Copies a file or folder from the head node using SMB protocol." />

  </Item>

  <Item

    Name="ExtractWim">

    <Parameter

      Name="WimPath"

      Value="%INSTALLDRIVE%\Goldenimage.WIM" />

    <Parameter

      Name="DestinationPath"

      Value="%INSTALLDRIVE%" />

    <Parameter

      Name="Description"

      Value="Extracts the files in a WIM file to a local disk on the compute node." />

  </Item>

  <Item

    Name="ExecuteCommand">

    <Parameter

      Name="Command"

      Value="del /F %INSTALLDRIVE%\Goldenimage.WIM" />

    <ParameterList

      Name="ErrorWhiteList" />

    <Parameter

      Name="ContinueOnFailure"

      Value="True" />

    <Parameter

      Name="Description"

      Value="Cleaning up WIM file" />

  </Item>

  <Item

    Name="WindowsSetup">

    <Parameter

      Name="Image"

      Value="Goldenimage.WIM\Golden Image" />

    <Parameter

      Name="ProductKey"

      Value="YQGMW-MPWTJ-34KDK-48M3W-X4Q6V" />

    <Parameter

      Name="AutogeneratedPassword"

      Value="False" />

    <Parameter

      Name="InstallDrive"

      Value="C" />

    <Parameter

      Name="Description"

      Value="Installs the Windows Server operating system on the compute node." />

  </Item>

  <Item

    Name="JoinDomain">

    <Parameter

      Name="Description"

      Value="Joins the compute node to an Active Directory domain." />

  </Item>

  <Item

    Name="Reboot">

    <Parameter

      Name="Description"

      Value="Restarts the compute node." />

  </Item>

  <Item

    Name="ActivateOsItem">

    <Parameter

      Name="Description"

      Value="Activates the operating system on the compute node." />

  </Item>

</Template>

 

Deploy new nodes using the master image

These samples were generated using the Evaluation version of Windows HPC Server, so before you deploy your image, you will want to edit the template you just imported to change the Product Key and the Local Administrator password.

Go through the steps of the wizard to add new compute nodes from bare metal using the Deploy Captured Image Template you just created.  When finished, all of the new nodes should be configured with all of the customizations which were performed on the master compute node.

Comments
  • PingBack from http://insidehpc.com/2009/04/06/capturing-a-master-node-with-ms-hpc-cluster-manager/

  • What about HPC Pack? Should I capture image of master node with HPC Pack installed or without it?

  • Nikita, you can capture an image of an OS with hpc pack on it -- for compute nodes only though.

    Head nodes need SQL, and SQL does not support the sysprep method Steve has specified above, so you would not be able to sysprep a head node to create this image.

    HPC pack 2008, r2, has a built in capability that will capture a 'golden' image from deployed and customized compute node, make the process steve writes abotu a lot simpler.

  • @Parmita: The "built in capability" that you are refering to, is it the facility available from the cluster Manager UI that you are refering to? whats the equivalent powerShell command do the above task?

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment