Use this when building standard VMs from a master image, or when clones have duplicate identities or stale patches.
VM Templates
VM templates are prepared, generalized master images that new VMs are cloned from, so every deployment starts from the same patched OS, agents and settings and is customized at first boot with Sysprep or cloud-init.
1. Templates are read-only base VMs for fast, consistent deployment.
2. Keep them patched.
3. Generalise before templating.
4. Use cloud-init or sysprep for customisation.
5. Version templates.
base VM → generalise → template → clone → customise
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
Exercise one safe negative or boundary case implied by unquiesced application, orphaned delta, long snapshot chain, consolidation failure, stale template, incompatible hardware profile or failed restore/clone.
Step 2 Known-good and broken paths Narrow the fault
Field map: Correlate VM UUID/name, guest device, virtual controller/vNIC/vDisk, hypervisor object/state, host resource/path/uplink/datastore identifier, queue/latency/contention counters and guest-visible result.
Step 3 Where it fails Narrow the fault
Walk guest/app quiescence → hypervisor snapshot/template task → metadata/backing chain → storage durability → restore/clone read-back and stop where observed state diverges.
Common failure classes are unquiesced application, orphaned delta, long snapshot chain, consolidation failure, stale template, incompatible hardware profile or failed restore/clone.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Subtopics
Go one level deeper into this subject.
A VM template is a read-only master VM used only for cloning.
Subtopic Golden ImageA golden image is the approved, patched and hardened master OS image that all VMs for a role are built from.
Subtopic CloneA clone is a copy of an existing VM or template. Generalize it or customize identity (hostname, SID, MAC, IP) on first boot so the copy does not conflict with the original on the network or in the domain.
Subtopic Full CloneA full clone is an independent copy of all the source VM's disks.
Subtopic Linked CloneA linked clone shares the parent's base disk and writes only its changes to a delta disk.
Subtopic Cloud ImageA cloud image is a small, prebuilt OS disk (qcow2, VMDK or VHD) published by distributions for virtualization and cloud use.
Subtopic Cloud-initCloud-init in templates customizes each new clone from the same image: pass user-data with hostname, users, SSH keys, network and packages through a NoCloud drive or the hypervisor's cloud-init settings.
Subtopic SysprepSysprep generalizes a Windows installation (sysprep /generalize /oobe /shutdown) so a template can be cloned with new SIDs and computer names.
Subtopic GeneralizationGeneralization removes machine-specific identity from a template — hostname, SIDs, machine-id, SSH host keys, logs and network config — so every clone gets new, unique identity on first boot.
Subtopic Template LifecycleTemplate lifecycle covers building, patching, testing, publishing, versioning and retiring templates.
- A template must be generalized before cloning.
- Template age = patch debt of every new VM.
- Linked clones depend on their parent.
qm list | awk '$3=="template"'— templates (Proxmox)virsh list --all— libvirt templates by namingGet-VM | ? Name -like 'tpl-*'— Hyper-V template VMs
ReferenceWhy it matters1 section · depth on demand
In depth
A VM template is a pre-configured, generalised VM image used to deploy new VMs quickly and consistently. It includes the OS, updates, agents and baseline settings, while machine-specific identity is removed so each clone becomes unique.
| Step | Purpose |
|---|---|
| Build and patch base VM | Consistent starting point |
| Install guest tools and agents | Drivers, monitoring, backup |
Generalise (sysprep, cloud-init clean, remove machine-id/SSH host keys) | Unique identity per clone |
| Convert to template | Prevents accidental boot |
| Customise at deploy | Hostname, IP, domain join via customisation specs or cloud-init |
# Linux generalisation before templating
cloud-init clean --logs
truncate -s 0 /etc/machine-id
rm -f /etc/ssh/ssh_host_*
qm template 9000 # Proxmox
Update templates regularly (monthly) so new VMs do not start months behind on patches, and version them so changes can be traced.
ReferenceHow it works1 section · depth on demand
How it works
How it works: Virtualization inserts management and device-emulation/synthetic layers between a guest and physical CPU, memory, network and storage.
ReferenceImportant terms & boundaries1 section · depth on demand
Mechanics
The responsible chain spans VM state, snapshot/template metadata, backing chain and guest/application consistency.
The bounded target is expected reversible state or reusable image without hidden chain debt.
Follow the path in order: guest/app quiescence → hypervisor snapshot/template task → metadata/backing chain → storage durability → restore/clone read-back.
The operating invariants are: snapshot/template metadata matches backing objects; chain is readable; consistency mode is explicit; restore/clone verifies independently.
Important negative cases include unquiesced application, orphaned delta, long snapshot chain, consolidation failure, stale template, incompatible hardware profile or failed restore/clone.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in VM Templates. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://libvirt.org/docs.html · confidence 94%