1. Create a WRF Virtual Hard Drive (VHD)

To demonstrate some of the features of Windows Azure storage accounts, we will create a Virtual Hard Drive (VHD) file containing our newly compiled WRF files and the supporting data files. Windows Azure service instances (e.g. the nodes in our compute cluster service) can mount VHD files directly from a Windows Azure storage account. This is a great way to provide persistent storage for your projects and share large static files among compute nodes.

1.1. Prerequisites

Before you continue, make sure you have these software prerequisites:

  1. An installation of HPC Linux with PToolsWin.

  2. NetCDF for Windows.

  3. WRF compiled for Windows.

  4. WPS compiled for Windows.

1.2. Create a 20GB NTFS-formated VHD File

  1. Open a command line in your HPC Linux distro and load the PToolsWin module:
       1 module load ptoolswin
       2 module list
  2. Navigate to the directory you created for WRF:
       1 setenv WRFDIR ${HOME}/windows/WRF
       2 cd $WRFDIR
  3. Use the dd command to create a new fixed-size raw disk image file:

       1 dd if=/dev/zero of=image.raw bs=1G count=20

    You can set "bs" to be any block size you like in kilobytes (K), megabytes (M), gigabytes (B), or terabytes (T). "count" sets the image file size in blocks, so "bs=1G count=1" would create a file of one gigabyte, or "bs=10M count=10" would create a file of 100 megabytes. (!) VHD files may not be larger that two terabytes.

  4. Create a new NTFS filesystem on the raw disk image:
       1 /sbin/mkntfs -F -f image.raw
    The '-F' flag forces the filesystem creation, even though we're not creating on a regular disk. The '-f' flag causes mkntfs to do a fast format.
  5. Use VirtualBox to convert image.raw to a VHD file named wrf.vhd:

       1 VBoxManage convertfromraw image.raw wrf.vhd --format VHD --variant Fixed
    If you see this error message:
    VBoxManage: error: Cannot create the disk image "test.vhd": VERR_INVALID_PARAMETER
    then first try creating the file as a standard VHD file and then re-create it as a fixed file:
       1 VBoxManage convertfromraw image.raw wrf.vhd --format VHD
       2 rm image.vhd
       3 VBoxManage convertfromraw image.raw wrf.vhd --format VHD --variant Fixed

    (!) The VHD file must be in fixed format to be mountable from a Windows Azure storage account.

  6. We're done with the raw image file, so you can remote it to save space:
       1 rm image.raw

1.3. Mount and Populate the VHD File

  1. Create a mountpoint folder and use FUSE to mount the VHD file:

       1 cd $WRFDIR
       2 mkdir mnt
       3 ntfs-3g -o windows_names wrf.vhd mnt

    The -o windows_names flag prevents files, directories and extended attributes from being created with a name not allowed by Windows, either because it contains some illegal character (e.g. " * / : < > ? \ |) or because the last character is a space or a dot.

  2. Now any files you create in $WRFDIR/mnt will actually be created on the VHD file. Copy WRF and WPS to the VHD file:

       1 cp -R WPS WRFV3 mnt
  3. Unmount the VHD file:
       1 fusermount -u mnt
  4. Copy your VHD file to a Windows Azure storage account. If you want to copy the VHD file anywhere else, we recommend compressing it first since it is mostly zeros and will compress very well.

You are now ready to proceed to Step 5: Deploy a new Windows Azure compute cluster service. If you'd like to know more about working with VHD files in Linux and Windows Azure, see the VHD Files How-To.