Saturday, October 20, 2018

Series 7 - How to Clone Jupiter from Mars

No, That's not what you're thinking. No celestial bodies here.

It's my personal adoption of astronomical nomenclature when naming lab computers. When building clusters i hate to go through OS installation and update patches on each node. So making a vm template is very useful. In this post I'll elaborate on how to create a vm template called "Mars" and make clone vms out of it - Jupiter, Saturn, and so forth.

Step 1. Prepare Mars as a template

1. Prep source vm server:
On Windows 2016 server Mars, prepare all stuff that needs to be replicated on other clones -
(a) Activate Windows
(b) Install Windows updates to current
(c) Install cluster service
(d) Start Microsoft iSCSI Initiator Service
(e)  Ensure two NICs exist, one for public and one for private. If you use iSCSI for storage connection you'll need three NICs
(f) Configure IE
(g) Enable remote desktop access

2. Strip SID:
Because no two identical machines can coexist on the same network at the same time, cloned vm and its source template vm must be striped of computer name, domain membership, IP address, etc. There is a Windows built-in program called SysPrep.exe we can use to make sure the internal security identifier does not duplicate. Launch the utility from Mars' C:\Windows\System32\Sysprep. Choose shutdown option to make sure the machine is off when strip operation is completed.





3. In Hyper-V Manager right click Mars and choose "Export". The vm can be in off or running state.



4. Specify the location to store the template then hit Export button. We leave it on the Hyper-V host



5. Minutes later check the file system to verify the completed template.



Step 2. Cloning of Jupiter

1. In Hyper-V Manager click on Actions "Import Virtual Machine...":


2. Choose where Mars template is stored. Note: choose the virtual machine folder


3. Click Next to confirm the source file to import.


4. Next we will select new SID.


5. Next choose the clone destination for Jupiter. 


6. As well as for the vhd file location.


7. Review the summary  and click finish.



Step 3. Cleanup

1. Upon completion of cloning we end up with two identical vms. Which one is the source and which one is the clone? Let's check vm settings to distinguish them by comparing hard disk path.


2. Click on Browse button to go to Mars.vhdx under Jupiter folder and rename it to Jupiter. Click Apply then OK. While the cloned Mars is still in highlight in Hyper-V Manager, rename it to Jupiter.

3. Start Mars and Jupiter from Hyper-V Manager. Login in console as Administrator. Both vms will go through a brief startup processes. Click on Next and Accept license terms.


4. Upon login in to Windows, compare the following items:
- Windows will take a little while to get activated
- Computer names are no longer retained (descriptions are still "Mars")
- Domain name changed to Workgroup
- Both NICs are present but their names are changed: public -> Ethernet. Private -> Ethernet 2
- IPv4 address becomes DHCP enabled
- IPv6 protocol is checked again despite being unchecked before
- On cloned vm Jupiter, Windows updates are current.


5. If you want to make more clones from Mars, then no need to change anything on it. On Jupiter make the following changes to turn it into a functional vm node.
- IP address for public and private NICs
- Subnet mask or public and private NICs
- Default gateway for public NIC only
- DNS for public NIC only
- computer name
- Join domain

6. Repeat most of the above steps to clone more vms (Saturn, Neptune, Uranus, Nibiru, etc). Since Mars can be reused there's no need to prep for template again. You can start straight from Importing vm. Also newly cloned vm is in off state which makes it easier to distinguish from its source vm (running).

No comments:

Post a Comment