Learn about virtual machines disks, including the types and pitfalls, virtual machine migration and applying a desired state configuration to a virtual machine.
- [Instructor] In the last lesson, we talked about creating your virtual machines. Now let's go ahead and talk about the disks that are attached to those virtual machines, the basics of migrating, from on-premise to Azure, and we're going to touch on Desired State Configuration, or DSC. Let's go ahead and start off with our virtual machine disk. When you create a virtual machine, you will have two disks assigned to that virtual machine. The first one will be an OS image or your OS disk. This is a read-only disk and it will be registered as a SATA drive.
The host caching on this disk is on by default and typically, you'll leave that setting as is. In a Windows virtual machine, this drive will be presented as our C Drive. And in Linux, it'll be mounted as a dev/sda. And the maximum size for these disks are 1,023 gigabytes. Next we have our writable disk. And these will be our temp disks. These are writable as I've just said. Caching is off by default and again, you will typically leave this as is unless your application requires caching to be enabled.
In the Windows virtual machines, you'll see these displayed as your D Drive. And in Linux, the drive will be mounted as a dev sdb. Please note these disks are not persistent. Think of these as scratch disks. When your machine reboots, you will have a new temporary disk. Therefor, anything that you save to that disk will be gone. I repeat, do not save anything to those disks. What you will always want to do is attach data disk.
Microsoft recommends that your applications in data be installed to these disks that you attach. We talked about creating virtual machines in the last lesson but what if you like to migrate your current virtual machines? There are couple things you need to know if you're going to do this. First, you'll use good old Sysprep on those virtual machines. Within the Sysprep tool, you will choose the Out-of-Box Experience, you'll make sure that you click the Generalize button, and finally under Shutdown options, you will select Shutdown.
You will need to select this is the Sysprep tool and not at the virtual machine level. Keep that in mind. If you've taken my previous Azure courses, you know that only VHD is supported in Azure. I know, when Server 2012 was released, Microsoft recommended that you convert your VHDs to VHDX. And now you have to convert them back again. And you can do this using PowerShell with the commandlet Convert-VHD, followed by Add-AzureRmVhd.
On a side note, you could use Azure Site Recovery or ASR to migrate your virtual machines as ASR converts and uploads all in one step. Now that we have our virtual machines up and running, we need to ensure that the machine always has the desired state. Using desired state configuration ensures that our server roles and features are always installed. We have the correct registry settings, the correct files and directories are installed on the virtual machine as well as packages.
And the environment variables are configured correctly. Let's go ahead and quickly review a desired state configuration script. First, we have the name which is configuration IISInstall. We'll specify the host that the script is to be run on. In our example here, our node is our localhost. The feature we like to check for in this case, WindowsFeature IIS. We'd like to ensure that it's Present, and the name of the server is Web-Server. To wrap up this lesson, remember Azure only supports VHD, not VHDX.
You must use Sysprep to prepare your VHD images for Azure. Use desired state configuration to manage your images and always, and I mean always, attach data disks to your VMs.
- Designing virtual machines
- Selecting appropriate VM SKUs
- Designing template deployment
- Deploying ARM templates via PowerShell and CLI
- Designing for availability
- Designing Azure Virtual Networks
- Azure VPN and ExpressRoute architecture and design