Dual-boot Linux and HPC Server 2008
In the past few weeks I had the pleasure of working with UGS, a division of Siemens that develops engineering product lifecycle management solutions. They were looking for a way to dual-boot an existing Linux cluster into Windows. The process we came up with is summarized here. It is work in progress, so if you find it useful and/or improvable, please let me know.
1. Verify the existing disk layout
Let us suppose that we have a Linux cluster, where all the compute nodes have a typical configuration on the boot disk, i.e. they have a root file system partition and a swap partition. We want to add a partition with server 2008 and boot into either o/s.
First, let’s verify the disk layout on Linux. Assuming that /dev/sda is the boot disk, from a “root” prompt, type:
The output lists the partitions on the disk, their starting and ending point, size and type, for instance
Device Boot Start End Blocks Id System /dev/sda1 * 1 5034 40435573+ 83 Linux /dev/sda2 5035 5221 1502046 82 Linux swap / Solaris
2. Modify the existing disk layout
At least 20 GB of free disk space are necessary to install Server 2008. If that is not available and the Linux file system has space to spare, the Linux utility parted can be used to resize the Linux partitions. Alas, to resize the boot partition you will need to boot off a “live” Linux cd. If that was necessary on several nodes, it might be quicker just to re-deploy Linux so that it does not take up all the space.
If using parted, proceed with caution and remember that the risk of data loss is high. The following example illustrates how to resize a boot partition starting at 32.3kB to 15 GB:
parted /dev/sda resize 1 32.3kB 15GB
The Linux boot loader, grub, must also be installed on the first sector of the /boot partition itself and not on the master boot record of the disk. The MBR will be overwritten during server 2008 installation. To achieve that, at the Linux root prompt type:
3. Install Windows
We assume that the default Windows HPC Server 2008 deployment techniques will be used from its administration console. For more information on those, please refer to the Windows HPC Server 2008 overview video on Technet Edge.
When preparing a deployment template with an o/s image in the HPC Server 2008 console, a number of tasks are added automatically. One of those tasks partitions the boot disk, destroying everything in the process. This is achieved by running diskpart /s diskpart.txt where the latter is a script that is copied to the installation environment. It is sufficient to remove the “clean” instruction from such script to avoid the destruction of the Linux partitions.
c:\program files\Microsoft Compute cluster Pack\Data\Installshare\config\diskpart.txt
select disk 0
-> clean <- REMOVE THIS LINE
create partition primary
format FS=NTFS label=”Node” QUICK OVERRIDE
Thus, when diskpart is run during the installation of the compute node, a new partition will be created, taking all the available space on the boot disk. The partition will be assigned the drive letter C, formatted and made active for booting.
Later during the installation process an unattended setup of server 2008 will be launched, guided by a file called unattend.xml. If the default paths were chosen during installation, this file will be in:
c:\program files\Microsoft Compute Cluster Pack\Data\Installshare\unattend.xml
Unattend.xml must be edited before starting the HPC Server deployment so that it points to the correct new Windows partition. For instance, if there are two existing Linux partitions, it must point to partition three, which will be created during installation. For that to happen, in the file find the entry:
and replace it with
The compute node deployment can then proceed normally and the machine will finally boot under Windows 2008.
4. Set the active boot partition
When switching back to Linux from Windows, use diskpart.exe and make the Linux boot partition active. Assuming that it is the first partition on the disk, enter the following commands:
Select disk 0
Select partition 1
These can be saved into a file and executed via diskpart /s <filename>
Linux will be loaded at the next reboot.
Similarly, when switching to Windows, make the Windows boot partition active. Assuming that it is n. 3, at the Linux root prompt type:
These answers can be stored in a file and passed to fdisk with fdisk /dev/sda < answerfile.
Windows will start at the next reboot
In order to execute these commands on a number of nodes remotely, on Windows cluster type:
Clusrun /nodes:<node1, node2, ...> <command line>
On Linux, a variety of tools are available, e.g. Webmin or simply rsh.