🐒
0

libvirtd

Linux Virtualization Management Daemon

LIBVIRTD(8)
System Manager's Manual
libvirtd(8)

EXAMPLES

Here are practical examples of using libvirtd in different scenarios:

Basic Daemon Operations

Start libvirtd as a daemon:

libvirtd -d

This is the most common way to start libvirtd in production environments.

Start with verbose output and custom config:

libvirtd -v -f /etc/libvirt/libvirtd.conf

Useful for debugging configuration issues or testing new settings.

Start with TCP listening enabled:

libvirtd -l -d

Enables remote management over the network while running as a daemon.

Run for testing with timeout:

libvirtd -t 300

Runs for 5 minutes then exits, perfect for testing configurations.

Virtual Machine Management

List All VMs

virsh list --all

Shows all virtual machines, both running and stopped.

Start a VM

virsh start my-vm

Starts a virtual machine named "my-vm".

Stop a VM

virsh shutdown my-vm

Gracefully shuts down a virtual machine.

Force Stop a VM

virsh destroy my-vm

Immediately stops a virtual machine (use with caution).

Network Management

List Networks

virsh net-list --all

Shows all virtual networks configured on the system.

Start a Network

virsh net-start default

Starts the default virtual network.

Create a New Network

virsh net-define network.xml

Creates a new network from an XML definition file.

Storage Management

List Storage Pools

virsh pool-list --all

Shows all storage pools available to libvirt.

List Volumes

virsh vol-list default

Lists all volumes in the default storage pool.

Create a Volume

virsh vol-create-as default my-volume 10G

Creates a 10GB volume in the default pool.

Advanced Examples

Remote Management

virsh -c qemu+ssh://user@remote-host/system list

Connect to a remote libvirtd instance via SSH.

Create VM from Template

virt-install --name my-vm --memory 2048 --vcpus 2 --disk size=20 --cdrom /path/to/iso

Creates a new VM with specified resources.

Clone a VM

virt-clone --original my-vm --name my-vm-clone --file /path/to/clone.qcow2

Creates a copy of an existing virtual machine.