After deploying Virtual Machines from a template and adding disks the next Task was to create and format the partitions.

In a VMWare environment it is very important to assure that the partitions are aligned. VMWare has a nice document that explains the details called Performance Best Practices for VMware vSphere 4.0.

Basically the recommendation is to align partition on a 64 KB boundary, not only for VMWare itsself but also for the guests.

Of course we could do this manually but I wanted to run this task of from my Deployment Server to automate the following:

  • Create aligned partitions on all extra disks of the maximum size
  • Format, assign drive letter and assign a label
  • A safeguard to prevent overwriting existing Data

Well enough talk let’s go the scripts! They are written as bat files that can be executed directly in Altiris as an embedded script but of course you don’t need Altiris to use them.

And the second script: