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.2. Create a 20GB NTFS-formated VHD File
- Open a command line in your HPC Linux distro and load the PToolsWin module:
module load ptoolswin module list
- Navigate to the directory you created for WRF:
setenv WRFDIR ${HOME}/windows/WRF cd $WRFDIR
-
Use the dd command to create a new fixed-size raw disk image file:
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.
- Create a new NTFS filesystem on the raw disk image:
/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.
-
Use VirtualBox to convert image.raw to a VHD file named wrf.vhd:
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:
VBoxManage convertfromraw image.raw wrf.vhd --format VHD rm image.vhd 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.
- We’re done with the raw image file, so you can remote it to save space:
rm image.raw
1.3. Mount and Populate the VHD File
-
Create a mountpoint folder and use FUSE to mount the VHD file:
cd $WRFDIR mkdir mnt 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.
-
Now any files you create in $WRFDIR/mnt will actually be created on the VHD file. Copy WRF and WPS to the VHD file:
cp -R WPS WRFV3 mnt
- Unmount the VHD file:
fusermount -u mnt
- 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.