Skip to navigationSkip to content
libvirtd docs
Commands

Manual nav

Search `/` or jump with `g` / `G`.

Portal

  • Home manual
  • Command explorer
Foundations6 sections
  • Overview1
  • Installation2
  • Platform1
  • Concepts5
  • Domains2
  • Domain XML2
Subsystems9 sections
  • Identity1
  • Automation2
  • Daemons3
  • virsh3
  • Networking5
  • Storage4
  • Security3
  • Observability2
  • Remote Access1
Operations6 sections
  • Migration2
  • Backup2
  • Performance3
  • Recovery1
  • Troubleshooting2
  • References2

/ search · g top · G quickstart

manxmlReviewed July 15, 2026

Safe domain XML editing

Domain XML is the authoritative persistent guest definition. Capture it, validate the proposed file, define it, and confirm that libvirt normalized what you intended. Change procedure virsh edit guest01 is appropriate fo

xmleditdefinevalidate

Domain XML is the authoritative persistent guest definition. Capture it, validate the proposed file, define it, and confirm that libvirt normalized what you intended.

Change procedure

BASH
virsh dumpxml guest01 > /root/guest01.$(date +%F-%H%M).xml
cp -a /root/guest01.xml /root/guest01.xml.bak
vi /root/guest01.xml
virt-xml-validate /root/guest01.xml domain
virsh define /root/guest01.xml
virsh dumpxml guest01

virsh edit guest01 is appropriate for small controlled changes. A file-based flow is easier to review, diff, validate, and roll back.

Live versus persistent configuration

The active XML and inactive XML can differ.

BASH
virsh dumpxml guest01 > /root/guest01.live.xml
virsh dumpxml guest01 --inactive > /root/guest01.config.xml
diff -u /root/guest01.config.xml /root/guest01.live.xml

Rollback

BASH
virsh define /root/guest01.previous.xml

Defining XML restores persistent configuration. It does not automatically reverse a live-only device operation or repair storage data.

Related

  • Domain lifecycle and state transitions
  • CPU, memory, and device model
  • Daily domain operations with virsh

On this page

  • Change procedure
  • Live versus persistent configuration
  • Rollback