Pcornel
Browse topics
Options
Recent
Favorites
Virtualization · Technical reference

Golden Image

Direct answer

A golden image is the approved, patched and hardened master OS image that all VMs for a role are built from. Version it, rebuild it regularly, and avoid manual changes to deployed copies so they stay consistent.

When to use this

Use this when maintaining the approved master image for a role.

First 30 seconds

1. A golden image is the approved, hardened base OS image.

2. Build automatically (Packer).

3. Include patches, agents, hardening.

4. Version and checksum it.

5. Retire old versions.

Operational verification

build pipeline → golden image → templates → VMs

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
virtualization-image
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformvirtualization-image
Scope / prerequisiteUse this when maintaining the approved master image for a role.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Checks Verify boundary
  • Version recorded and built from code (Packer) where possible.
  • Patched and scanned before publishing.
  • Hardening baseline applied (CIS).
  • Old versions retired on a schedule.
Step 2 Common mistakes Narrow the fault
  • One golden image for every role, causing bloat.
  • Images patched by hand and not reproducible.
Evidence references

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.

observation · 1
Key points
  • Version every image build.
  • Test an image before publishing it.
Key checks
  • virt-sysprep -a image.qcow2 — clean image identifiers
  • sha256sum golden-<ver>.qcow2 — image checksum
  • Get-WindowsImage -ImagePath install.wim — Windows image info
ReferenceWhy it matters1 section · depth on demand

How it works

A golden image is the approved, hardened base image for an OS or role, rebuilt regularly (often with Packer) and published as templates or cloud images.

ReferenceImportant terms & boundaries2 sections · depth on demand

In depth

A repeatable golden-image pipeline

1. Build from vendor media or a cloud image with an automated installer (Packer, kickstart/preseed, autounattend.xml) — never by hand.

2. Patch to the current level and install the baseline: guest agent, monitoring/EDR agent, VirtIO drivers, security baseline.

3. Harden — disable unused services, set logging, apply CIS-style settings that suit all workloads.

4. Generalise — remove identity: virt-sysprep for Linux images (offline), sysprep /generalize /oobe /shutdown for Windows.

5. Compact — virt-sparsify --in-place image.qcow2 to drop freed blocks.

6. Test — boot a throwaway instance, run smoke tests (network, agent, time sync, package repositories).

7. Publish as a versioned template; record the build log and package list.

What virt-sysprep removes

The virt-sysprep manual lists operations that strip clone-unsafe state, for example:

OperationRemoves
machine-idLocal machine ID set at install
ssh-hostkeysSSH host keys (regenerated on next boot)
logfilesSystem and service logs
net-hwaddrHard-coded MAC addresses in network configuration
$ virt-sysprep -a golden-debian12.qcow2 --operations defaults,-ssh-userdir
$ virt-sysprep --list-operations | grep '\*'      # default operations

Run it only on a powered-off image; running it against a live guest corrupts the file system.

Golden image vs. configuration management

Keep the image small and generic; put workload-specific configuration in cloud-init, Ansible or similar. An image that contains application configuration needs a rebuild for every config change and drifts quickly.

Rebuild cadence

Monthly (after patch day) is a common rhythm; rebuild immediately for critical vulnerabilities in base packages. Old images should be retired, not patched in place — patching a template turns it back into a snowflake.

*The golden-image preparation commands above are illustrative examples, not captured from a lab or production host.*

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docvirtualization-image current

Authoritative/upstream documentation reviewed for bounded claims in VM Templates → Golden Image. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://libvirt.org/docs.html · confidence 94%
Confirmation

Confirm action

Continue?