Cloning Virtual Domain Controllers
While cloning virtualized domain controllers is nothing new in Windows
Server, Server 2012 does deliver improvements that make cloning DCs
easier.
There are a number of benefits to DC cloning. First, it’s an ideal
way to scale up a growing Windows infrastructure, because you can
quickly deploy DCs without investing in additional hardware. It also
saves IT time, because there’s no need to reconfigure a DC. Also, the
ability to clone a DC is a good strategic part of a disaster recovery
plan.
There are some checks and preparations to make before you can
clone a virtual DC. For instance, you have to authorize a DC for
cloning. You do so by adding the DC to the Cloneable Domain Controllers
group in Active Directory. This is a group under the Users
container in AD.
System administrators also have to make sure that the DC serving
the FSMO (flexible single master operation) role as PDC (primary domain
controller) emulator is running Windows Server 2012. In addition, you
must check to make sure that any applications running on the DC can be
cloned.
Checking application “clone compatibility” is easy—simply run this
PowerShell command:
Get-ADDCloningExcludedApplicationList
This cmdlet runs on the DC to be cloned. The command checks
against a list of common apps that can be cloned in a virtual setting.
The output of the file displays apps that have not been verified as safe
to clone for either licensing or functionality reasons. If you run the
file and an app you have installed on a DC appears on the output list,
you can contact the app’s vendor and ask if it is safe to clone, or you
can remove the app from the DC and reinstall after cloning.
You then need to run another cmdlet. Run New-ADDCloneConfigFile
on the virtual DC to be cloned. This cmdlet creates a
configuration file for the clone process. The command has to be typed
with specific parameters, including the DC’s computer name, IP address,
DNS address, gateway, subnet mask, WINS Server IP address, and domain
name.
For example, the virtual domain controller we want to clone is
named VMDC1. The VM is configured with static IPv4 addressing, and the
domain name is Domain12.net. The syntax for the configuration file is
therefore:
New-ADDCloneConfigFile –Static –IPv4Address "192.168.1.12" IPv4DNSResolver
"192.168.1.10" -Ipv4SubnetMask "255.255.255.0" –CloneComputerName "VMDC1"
–IPv4DefaultGateway "192.168.1.1" –PreferredWINSServer "192.168.1.10"
–SiteName "DOMAIN12.NET"
The VM getting cloned is then shut down. Right-click the VM in
Hyper-V Manager and select Export and you’ll be prompted to save the
exported VM. Click Export, and Hyper-V Manager will display the status
of the export. A subfolder gets created in the directory to which the
exported VM is saved. The subfolder is created with the same name as the
exported VM. In the subfolder are three more folders: Snapshots, Virtual
Hard Disks, and Virtual
Machines. These are all the associated data elements that get
exported with the VM.
The final step is to import the virtual DC. From Hyper-V Manager’s Actions menu, click Import Virtual
Machine. Browse to the location where you have the exported VM file
saved. Select the VM to import. Click Next and then select the type of
import to perform. There are three options (see Figure 7):
- Register the virtual machine in-place
-
This is a new option in Hyper-V R3 for the import process. This
option uses the existing unique ID. If the VM you are importing
already has its associated data files where you want them and all
you want to do is fire up the VM in Hyper-V, then go with this
option.
- Restore the virtual machine
-
If the VM’s files are saved on a network folder or external disk,
Hyper-V will move the VM’s files to the appropriate location and
then register the VM.
- Copy the virtual machine
-
If you want to import the VM more than once, this is the option to
choose because the VM is given a unique ID.
Snapshots are data files used to restore a VM to a past state. These
files are mostly used in testing environments, but they come in handy if
you’ve made a change to a VM that caused a problem with it, such as
applying an update, and now you want to revert the VM to its state
before the update.
Snapshots, of course, are not a new feature in Server 2012. What
is new is that a snapshot can now be merged into a
VM without shutting down that VM. This is a major change in technology
from Hyper-V on Server 2008 R2, which required the VM be powered off to
merge snapshots.
To revert a running VM to a previous state, from the Actions menu
in the Hyper-V Manager, right-click the VM and select Revert. The Revert Virtual
Machine dialog box appears, confirming the revert selection. In Figure 8 you can see the reversion process
happening while the VM runs.