Saturday, January 4, 2014

Physical to Virtual migration of Domain Controller


The other day I got a chance to migrate the domain controller to our VMware ESX-based private cloud. Since this was the primary domain controller which was also running DNS, DHCP, Print Server as well as McAfee ePO server it was a critical component to the company. I did some research and followed guidelines found on internet. I followed the steps in the following order:
-          First defragment the hard drive of physical server, which will make the process faster.
-          In the meantime, collect the following data from the physical server which will prove very useful during/after migration.
o   Domain Admin credentials (Since it is domain controller, you cannot get local admin credentials like other servers)
o   A screenshot of Ipconfig /all
o   Current and proposed hardware configuration (vCPU, memory, HDD)
o   If you have vCenter running a cluster, then write down local credentials of one of the servers in the cluster.
-          After defragmentation is finished, open the vCenter Converter and follow these steps:
o   Choose convert machine, and put in the server name and credentials.
o   If you have vCenter running, then type in the vCenter server name and credentials and the select the usual stuff (which server you want to run on/which datastore etc).
o   DON’T CLICK FINISH YET!!! We still need to configure the hard drive. In the left column select the hard drive and give all the partitions its own virtual disk and uncheck any partition that shows up as ‘?’ which is possibly system partition (I’m not for sure). In my case the migration failed the first time at 11% because I had single virtual disk for both partitions and hadn’t unchecked the third partition. Also, in “advanced” make sure that turn on virtual machine when finished is not checked.
o   OPTIONAL: While I did not, you are supposed to turn off relevant services and turn them back on after migration to prevent any hiccups.
o   Now you can click next and finish. (And wait forever and ever for the converter to finish converting)
-          After the conversion has finished don’t turn off the physical machine just yet. First login to the vCenter server and verify that you can see the machine. Go to edit settings and get rid of serial ports or floppy drives (which I hope you aren’t using anyway). Now happily say your old machine good bye.

POST MIGRATION STEPS
-          Turn on the Virtual machine, and let it go through the first boot process. It will delete a bunch of stuff and reconfigure itself.
-          Login to the machine and install VMware tools (and restart).
-          Now from what I have read online, during the conversion process the NICs get deleted but not uninstalled. This means that you have to uninstall them manually before you can configure the new NICs. The instructions follow:
o   Open command prompt and type the following commands in order:
§  set devmgr_show_nonpresent_devices=1
§  start DEVMGMT.MSC 
o   Click ‘View’ and then click ‘Show Hidden Devices’.
o   Expand the Network Adapters tree and right click the dimmed network adapter and click ‘Uninstall’ (You may also see a hidden 'RAS async adapter' device under NICs. This cannot be uninstalled. However, it doesn't matter as it doesn't influence the NIC issue, so just leave it).
-          Using the screenshot you took earlier give your NIC a static IP/DNS server.
-          Verify that services.msc has all the services running.
-          I had a small checklist to make sure that all the crucial services were running after migration:
o   Domain: Can you login from other computer?
o   DHCP: Can you release/renew?
o   DNS: Can you flush DNS and then access websites?
o   McAfee ePO: Can you update policies?
o   Print Server: Can you add a printer to computers?

THE HICCUP
After migration all the other services were running just fine except McAfee ePO. When I tried to access the web console it showed a bunch of errors (at least 25 of them!!). At this point I assumed that the data was corrupt and that I will have to re-install ePO (and cursing to myself, why did I not turn off the McAfee service before migration). The next day before re-installing ePO I tried to restart McAfee services and guess what McAfee started working like it had never seen issues! Lesson learned: Always turn off relevant services before migration.
Hope it helps someone out there!