Skip to content

Lab file reference ​

A lab file (lab.yaml by default) describes one lab: its nodes (VMs), the switches and cables between them, and the disks they use. It describes infrastructure only. Nothing inside the guests is configured, except an optional cloud-init seed you provide. This page lists every key, its type, its default and its rules.

For a compact table of every field per object (node, disk, interface, link, switch, storage...), see the schema reference. It is generated from the JSON Schema.

TIP

Start from a working file: vz init writes a one-node lab, and vz init --example <n> copies one of the example labs. Run vz validate after every change.

Contents ​

File basics ​

  • The file is YAML. Keys are case-sensitive.
  • Unknown keys are errors, at every level. A typo such as memroy: is reported with the list of allowed keys.
  • Optional keys that are left out take the defaults listed below.
  • vz validate checks the file. The rules it applies are listed in Validation rules.

Editor support ​

The lab file has a JSON Schema. Its $id is https://raw.githubusercontent.com/rayanparsa/vz/refs/heads/main/schema/27.json, and the starter file and examples begin with a modeline for editors that use the YAML language server:

yaml
# yaml-language-server: $schema=https://raw.githubusercontent.com/rayanparsa/vz/refs/heads/main/schema/27.json

A local copy always works, whatever the network says:

bash
vz schema > lab.schema.json
yaml
# yaml-language-server: $schema=./lab.schema.json

NOTE

The schema checks the shape of the file. vz validate checks more: references between sections, link ends, subnet overlap, DHCP reservations and so on. Use both, or just vz validate.

Paths ​

Every path in the lab file (state, disk and storage path, init, share path) is resolved the same way:

Written asMeans
/abs/pathThat absolute path.
~ or ~/pathYour home folder. ~user is not supported.
anything elseRelative to the folder that holds the lab file, not the current folder.

Top level ​

yaml
schemaVersion: 27
name: my-lab
state: ./.vz-state
storages: {}
nodes: []
links: {}
switches: {}
KeyTypeDefaultNotes
schemaVersionintegerrequiredMust be 27: the lab file format for macOS 27, matching schema/27.json.
namenamerequiredLab name. Used for stable MAC addresses, the cloud-init instance-id, the default state directory and vz ls. Keep it unique among labs you run at the same time.
statestring~/.vz/state/<name>State directory: overlays, UEFI variables, console logs, seeds, control socket. Relative to the lab file. Must not be empty. --state on the command line overrides it. Two labs must never share a state directory.
storagesmap of storage{}Named disks that nodes can share.
nodeslist of noderequiredThe VMs. An empty list is allowed but warned about.
linksmap of link{}Point-to-point cables.
switchesmap of switch{}Virtual switches.

The keys of storages, links and switches are their names and follow the name rules.

storages ​

A storage is a named disk file that several nodes can refer to with storage: <name> instead of path:.

yaml
storages:
  reference: { path: reference.asif, size: 1GiB }
KeyTypeDefaultNotes
pathstringrequiredDisk file. The format comes from the extension: .asif, .raw, .img, .iso or .ipsw.
sizesizenoneUsed to create the file when it is missing. Not allowed for .iso or .ipsw.

A writable storage (used without readOnly or overlay) must not be used by two running nodes at the same time. vz warns when more than one node writes to it.

nodes ​

Each item is one VM. The node describes hardware; platform picks the machine type. On the default generic platform a node boots with UEFI on Apple's generic Arm machine, from the files under disks, and has a serial console. On apple it is a macOS guest: Mac graphics, no serial console, and the first start installs macOS from the .ipsw listed under disks. These are always present and have no keys: an entropy device and a memory balloon.

yaml
nodes:
  - name: vm1
    cpus: 2
    memory: 2GiB
    disks:
      - { path: ~/.vz/images/debian-13-genericcloud-arm64.raw, overlay: true }
    init: ./init/vm1
    interfaces:
      - { name: eth0, attach: switch/lan }
KeyTypeDefaultNotes
namenamerequiredUnique within the lab. Also the hostname vz gives cloud-init.
platformgeneric, applegenericThe machine type. See platforms.
cpusinteger1At least 1, at most what this Mac allows.
memorysize1GiBA non-zero multiple of 1MiB. vz node memory can lower it at runtime with the balloon.
nestedVirtualizationbooleanfalseLets the guest run its own VMs (/dev/kvm). Needs an M3 or newer Mac. Validation warns on older Macs; vz up fails there. generic only.
secureBootbooleanfalseUEFI Secure Boot with the default signatures enrolled. Only signed boot loaders and kernels boot. generic only.
rosettabooleanfalseShare Rosetta with the guest as a VirtioFS share with tag rosetta, to run x86_64 Linux binaries. Needs Rosetta on the Mac: softwareupdate --install-rosetta. generic only.
consoleLogbooleanfalseAlso write the serial console to <state>/<node>/console-<yyyyMMdd-HHmmss>.log. A new file starts each time vz up starts the node; a reboot inside the guest or vz node restart keeps writing to the same file. Read it with vz node logs.
diskslist of diskrequiredAt least one. Boot order: UEFI boots from the first bootable disk.
initstringnoneFirst-boot data: a user-data file, or a folder. The platform decides how it is applied. See below.
shareslist of share[]Mac folders in the guest (VirtioFS).
displayslist of displayone 1280x800 displayGraphics. [] turns graphics off.
clipboardbooleanfalseShared clipboard. Needs a display and a SPICE agent in the guest. generic only.
soundsoundnoneAudio output and input.
usblist of USB device[]Host USB devices passed through at boot.
interfaceslist of interface[]NICs.

platform ​

Virtualization offers two machine types, and platform picks one. Everything that differs between them lives in that platform's code; the other node keys describe hardware and mean the same on both.

platformMachineBootsConsoleinit
generic (default)Apple's generic Arm machine with UEFIwhatever the disks hold: a pulled Linux image, an installer ISO, your own diskvirtio serial (vz node console)a cloud-init NoCloud seed disk
appleApple's Mac machinemacOS, installed from the .ipsw under disks on the first startnone: use vz node display or SSHread by vz on the Mac: the account macOS creates

An apple node:

yaml
- name: mac1
  platform: apple
  cpus: 4
  memory: 8GiB
  init: ./init/mac1/user-data
  disks:
    - { path: ~/.vz/images/macos-arm64.ipsw }   # installer media: read, never attached
    - { path: macos.asif, size: 80GiB }             # macOS installs here

Rules for apple (checked by vz validate):

  • List one .ipsw restore image under disks. It is read by the installer and never attached to the VM; it keeps its index, so other disks keep theirs. Once macOS is installed, the node also starts without it.
  • macOS installs onto the first disk that is not a .ipsw. It must be writable and must not use overlay, for example { path: macos.asif, size: 80GiB }.
  • rosetta, nestedVirtualization, secureBoot and clipboard are errors. displays: [] is an error: the installer and the login window need a screen. consoleLog is a warning: macOS writes nothing there.
  • One Mac runs at most 2 apple nodes at a time.
  • It is experimental: every apple node gets a warning until a full install has been tested.

A .ipsw under disks on a generic node is an error.

init ​

init is first-boot data. Its path is relative to the lab file. The platform decides how it is used.

On generic, init points at a cloud-init seed. vz packs it into a read-only ISO labelled cidata (the NoCloud data source) and attaches it after all other disks, where cloud-init in the guest finds it. The seed is rebuilt each time vz up starts the node, so edits to the seed files are picked up then.

init isvz does
a fileUses it as user-data and writes meta-data with instance-id: <lab>-<node> and local-hostname: <node>.
a folderCopies user-data (required), meta-data, network-config and vendor-data if present. Other files are ignored. Without meta-data, it writes the one above.

See cloud-init for working seeds.

On apple, init is the same kind of #cloud-config user-data file (or a folder holding user-data), but vz reads it on the Mac. macOS has no cloud-init; Apple's provisioning creates one account on the first boot after the install (macOS 27 guests):

yaml
#cloud-config
users:
  - { name: lab, gecos: Lab User, plain_text_passwd: lab }
ssh_pwauth: true
cloud-configmacOS
first entry of users: namethe account's user name
plain_text_passwd, or a type: text password for that name under chpasswd.usersits password (required)
gecosthe full name on the login window (default: the user name)
ssh_pwauthRemote Login (SSH): on unless it is false

Anything else (more users, packages, runcmd, other user keys) is ignored with a warning from vz validate. The file must start with #cloud-config. Without init, macOS runs Setup Assistant on the display. Changing init later needs vz node reset, since the account is only created on the first boot.

disks ​

yaml
disks:
  - { path: ~/.vz/images/debian-13-genericcloud-arm64.raw, overlay: true, size: 24GiB }
  - { storage: reference, readOnly: true }
  - { bus: nvme, path: scratch.asif, size: 2GiB }
  - { bus: usb, path: usb-stick.asif, size: 1GiB, connected: false }
KeyTypeDefaultNotes
busvirtio, nvme, usbvirtiovirtio: a virtio block device, /dev/vdX in Linux. nvme: an NVMe controller, /dev/nvmeXn1. usb: a USB mass storage device that can be ejected and inserted at runtime.
pathstringDisk file. Set exactly one of path and storage. Format from the extension: .asif, .raw, .img (raw), .iso, or .ipsw (a macOS restore image for platform: apple, read by the installer and never attached).
storagestringName of an entry in storages.
sizesize10GiB with overlay, none otherwiseSee disk sizes. Not allowed with storage (put it on the storage) or on an .iso or .ipsw.
readOnlybooleanfalseAttach read-only. ISO files are always read-only; add readOnly: true to say so.
overlaybooleanfalseCopy on write (not on a .ipsw): the file stays an untouched read-only base and the node's writes go to <state>/<node>/disk<N>.overlay.asif. This is how cloud images are used. vz node reset throws the overlay away.
cachebooleanfalseAdd a cache layer (disk<N>.cache.asif) between the base and the overlay, for bases on slow storage such as a NAS. Needs overlay: true.
cachingautomatic, cached, uncachedautomaticHost caching mode of the disk image.
syncfull, fsync, nonefullHow guest flushes reach the Mac's storage. none is fastest and can lose data if the Mac crashes.
connectedbooleantrueUSB disks only: inserted at boot. false starts the disk ejected; insert it with vz media insert <node>/<index>.

<N> and <index> are the disk's position in the list, starting at 0.

Disk sizes ​

Disksize means
path, no overlay, file missingCreate the file at this size: a sparse raw file for .raw/.img, an empty ASIF image for .asif. An existing file is used as it is.
path, no overlay, file missing, no sizeError at vz up: disk file not found.
overlay: trueThe size the guest sees. Default: 10GiB, or the base image size if that is larger, because a cloud image (3GiB for Debian) is full after the first package install. The extra space costs nothing on the Mac until the guest writes to it. An explicit size must be at least the base image size. Raise it later to grow the disk; it can never shrink (use vz node reset to start over). Without size, an overlay that is already larger keeps its size. The guest grows its partition itself, for example with cloud-init's growpart. The base file must exist.
readOnly: trueStill creates a missing file, but vz warns, since size only creates missing files or grows overlays.

WARNING

A writable disk without overlay changes the file itself. If two nodes write to the same file, or the same writable storage, do not run them at the same time. vz warns about this.

IMPORTANT

If you pull a base image again (vz image pull --force), overlays made from the old file no longer match it. Run vz node reset for the nodes that use it.

shares ​

VirtioFS shares: one Mac folder per item.

yaml
shares:
  - { tag: site, path: ./site, readOnly: true }
  - { tag: drop, path: ./drop }
KeyTypeDefaultNotes
tagstringrequiredThe name the guest mounts: mount -t virtiofs <tag> <dir>. 1 to 36 characters: letters, digits, ., _, -, starting with a letter or digit. Unique per node. rosetta is reserved.
pathstringrequiredThe folder on the Mac. It must exist when the node starts.
readOnlybooleanfalseThe guest cannot write.

displays, clipboard, sound ​

yaml
displays: [{ width: 1920, height: 1080 }]
clipboard: true
sound: { output: true, input: false }
KeyTypeDefaultNotes
displays[].widthintegerrequired320 to 8192 pixels.
displays[].heightintegerrequired200 to 8192 pixels.
clipboardbooleanfalseClipboard sharing through the SPICE agent port. Needs at least one display, and spice-vdagent in the guest.
sound.outputbooleanfalseGuest audio plays on the Mac's default output.
sound.inputbooleanfalseThe Mac's default input (microphone) is the guest's input.
  • Each display is one scanout of a virtio graphics device: 2D only, no GPU acceleration. A display also adds a USB keyboard and pointer. Open it with vz node display <node>. An apple node uses Mac graphics, a Mac keyboard and a trackpad instead, and opens the same way.
  • Without the displays key a node gets one 1280x800 display, so node display works without planning ahead. displays: [] turns graphics off.
  • Some images have no graphics driver. The debian-13 cloud kernel has none; use debian-13-generic for a desktop.
  • sound with both output and input false adds nothing, and vz warns.

usb ​

Host USB devices given to the node at boot.

yaml
usb:
  - { vendorId: 0x0403, productId: 0x6001 }
KeyTypeNotes
vendorIdUSB idRequired. A YAML integer (0x0403 or 1027) or a quoted hex string with exactly four digits ("0x0403").
productIdUSB idRequired. Same format.

The device must be plugged in when the node starts. A listed device also gives the node a USB controller, so vz usb attach works later. Listing the same device twice is warned about.

WARNING

USB passthrough uses Accessory Access on macOS 27 and needs a vz signed with a Developer ID and the com.apple.developer.accessory-access.usb entitlement. Ad-hoc signed builds (make build, the release tarball) cannot claim USB accessories. Isochronous devices such as webcams and USB audio are not expected to work.

interfaces ​

NICs, as virtio network devices. List order is PCI order in the guest.

yaml
interfaces:
  - { name: mgmt, attach: switch/mgmt, mac: "52:54:00:01:01:00" }
  - { name: p2p, attach: link/a-b }
  - { name: spare, attach: switch/mgmt, connected: false }
  - { name: unused }
KeyTypeDefaultNotes
namestringrequiredA label for vz (vz port up r1/eth1). It is not pushed into the guest; name the NIC in the guest with cloud-init's network-config (match by MAC). 1 to 15 characters: letters, digits, ., _, -, starting with a letter. Unique per node.
attachstringnoneWhat the NIC is plugged into: switch/<name> or link/<name>. Without it the NIC is free (present but not connected to anything).
macMACderivedSee MAC addresses. Quote it in YAML. Must be unicast and unique in the lab.
connectedbooleantrueWhether the cable is plugged in at boot. Toggle it at runtime with vz port up/down. Not allowed on a free NIC.

NOTE

vmnet documents a limit of 4 switch interfaces per VM and 32 in total. vz warns above those numbers but does not stop you. Links are not limited.

A link is a point-to-point cable between exactly two NICs on two different nodes. It is a Unix datagram socket pair inside the Mac's kernel: frames pass unchanged, no vz code is in the path and the Mac is not a member.

yaml
links:
  a-b: {}
  core: { mtu: 9000 }
KeyTypeDefaultNotes
mtuinteger15001280 to 65535. Applied to both ends. Set the same MTU inside the guests.
buffersize4MiBAdvanced: socket send buffer of each end; the receive buffer is twice this. vz warns outside 1MiB to 256MiB.

Two interfaces refer to a link with attach: link/<name>. Unplug both ends with vz link down <name>.

switches ​

A switch is a vmnet network. The Mac is always a member and gets the first address of the subnet. With nat4 or nat6 the switch is in shared mode (NAT to the internet); with neither it is in host mode (VMs and the Mac only).

yaml
switches:
  mgmt:
    nat4: true
    ipv4Subnet: 10.101.0.0/24
    dhcpReservations:
      - { mac: "52:54:00:01:01:00", ipv4: 10.101.0.11 }
    portForwarding:
      - { protocol: tcp, hostPort: 2222, address: 10.101.0.11, guestPort: 22 }
  lab:
    ipv4Subnet: 10.101.1.0/24
KeyTypeDefaultNotes
nat4booleanfalseIPv4 NAT to the internet.
nat6booleanfalseIPv6 NAT to the internet.
ipv4SubnetIPv4 CIDRchosen by vmnetFor example 10.30.0.0/24. /30 or larger. The Mac gets the first host address (.1 in a /24). Must not overlap another switch of this lab. Host bits are cleared, with a warning.
ipv6PrefixIPv6 prefixchosen by vmnetFor example fd00:10:1::/64.
mtuinteger15001280 to 65535.
dhcpbooleantrueThe built-in DHCP server (IPv4).
dhcpReservationslist[]Optional fixed IPv4 addresses by MAC. Without them, guests get addresses from the DHCP pool. Needs dhcp: true.
dnsProxybooleantrueThe built-in DNS proxy.
routerAdvertisementbooleantrueIPv6 router advertisements (SLAAC).
portForwardinglist[]Mac ports forwarded to guests. Needs nat4 or nat6.

TIP

Without ipv4Subnet, vmnet picks a subnet, so addresses can change between runs and two labs can collide. Set a subnet and DHCP reservations when you want stable addresses.

dhcpReservations ​

Optional. A NIC without a reservation still gets an address from the switch's DHCP pool; reserve one when commands or other nodes need to know the address in advance.

KeyTypeNotes
macMACRequired. Must be the mac of an interface attached to this switch, so set the same mac on the interface. Each MAC once per switch.
ipv4IPv4 addressRequired. Inside ipv4Subnet; not the network, broadcast or Mac (first host) address. Each address once per switch.

The guest gets the reserved address only if its DHCP client identifies itself by MAC. Some guests send a DUID instead (Debian, for example); in cloud-init network-config, set dhcp-identifier: mac. vz node ls warns when a guest ignores its reservation.

portForwarding ​

KeyTypeDefaultNotes
protocoltcp, udprequired
familyipv4, ipv6from addressAn address with : is IPv6. IPv4 rules need nat4: true, IPv6 rules need nat6: true.
hostPortintegerrequired1 to 65535. Each protocol, family and port only once across the lab.
addressIP addressrequiredThe guest's address on this switch. Inside ipv4Subnet when set. Give it a DHCP reservation, or vz warns that no node is guaranteed to have it.
guestPortintegerrequired1 to 65535.

vmnet's own forwarding is not reachable on the Mac's loopback interface, so for TCP rules vz also listens on 127.0.0.1 and ::1 and relays to the guest. That is why ssh -p 2222 lab@localhost works. If the localhost port is already taken, vz logs it and leaves that address to vmnet. UDP rules are handled by vmnet only.

Value formats ​

Names ​

WhatPatternExample
Lab, node, storage, link, switchlowercase letter, then lowercase letters, digits, -; up to 63 charactersleaf1, site-a
Interfaceletter, then letters, digits, ., _, -; up to 15 characterseth0, mgmt, bond0.10
Share tagletter or digit, then letters, digits, ., _, -; up to 36 characterssite
Imageoptional disk/ or iso/, then lowercase letters, digits, -, . starting with a letter or digitdebian-13, iso/debian-13, ubuntu-26.04

Sizes ​

A whole number followed by a binary unit: B, KiB, MiB, GiB or TiB. For example 512MiB, 2GiB, 4096B. No spaces, no decimals, and no decimal units such as MB or GB.

Addresses ​

TypeFormatExample
MACsix pairs of hex digits with : (case does not matter). Quote it."52:54:00:0a:00:01"
IPv4 addressdotted quad10.30.0.11
IPv4 CIDRaddress / 0 to 3210.30.0.0/24
IPv6 prefixIPv6 address / 0 to 128fd00:10:1::/64

MAC addresses ​

A NIC without mac gets a stable, locally administered unicast address: 02: followed by five bytes of a 64-bit FNV-1a hash of <lab>/<node>/<interface>. The same names give the same MAC on every Mac and every run. Renaming the lab, the node or the interface changes the MAC. vz topology shows the MAC of every port.

Set mac yourself when something else must know it in advance, such as a DHCP reservation or a network-config match.

Full example ​

An annotated lab that uses most keys
yaml
# yaml-language-server: $schema=https://raw.githubusercontent.com/rayanparsa/vz/refs/heads/main/schema/27.json
schemaVersion: 27               # the macOS release the format is for
name: demo                      # lowercase, digits, '-'
# state: ./.state               # default: ~/.vz/state/demo

storages:
  reference: { path: reference.asif, size: 1GiB }   # created on first use

nodes:
  - name: r1
    cpus: 1
    memory: 1GiB
    consoleLog: true            # vz node logs r1
    displays: []                # cloud kernel: no graphics driver anyway
    disks:
      # Pulled with: vz image pull disk debian-13
      # Base file stays untouched; writes go to the overlay in the state directory.
      - { path: ~/.vz/images/debian-13-genericcloud-arm64.raw, overlay: true, size: 32GiB }   # default 10GiB
      - { storage: reference, readOnly: true }        # shared, read-only
    init: ./init/r1             # user-data, network-config, ...
    interfaces:
      - { name: mgmt, attach: switch/mgmt, mac: "52:54:00:99:01:00" }
      - { name: p2p, attach: link/r1-r2 }             # MAC derived from demo/r1/p2p

  - name: r2
    disks:
      - { path: ~/.vz/images/debian-13-genericcloud-arm64.raw, overlay: true }
      - { bus: usb, path: stick.asif, size: 1GiB, connected: false }   # vz media insert r2/1
    init: ./init/r2
    interfaces:
      - { name: mgmt, attach: switch/mgmt, mac: "52:54:00:99:02:00" }
      - { name: p2p, attach: link/r1-r2 }
      - { name: lab, attach: switch/lab, connected: false }            # vz port up r2/lab

  - name: desk
    cpus: 2
    memory: 2GiB
    displays: [{ width: 1920, height: 1080 }]         # vz node display desk
    clipboard: true             # needs spice-vdagent in the guest
    sound: { output: true }
    shares:
      - { tag: work, path: ./work }                   # mount -t virtiofs work /mnt
    disks:
      - { path: ~/.vz/images/debian-13-generic-arm64.raw, overlay: true, size: 24GiB }  # full kernel: displays work
    init: ./init/desk
    interfaces:
      - { name: mgmt, attach: switch/mgmt, mac: "52:54:00:99:03:00" }

links:
  r1-r2: { mtu: 9000 }          # exactly two ends, on two different nodes

switches:
  mgmt:
    nat4: true                  # shared mode: NAT to the internet
    ipv4Subnet: 10.199.0.0/24   # the Mac is 10.199.0.1
    dhcpReservations:
      - { mac: "52:54:00:99:01:00", ipv4: 10.199.0.11 }
      - { mac: "52:54:00:99:02:00", ipv4: 10.199.0.12 }
      - { mac: "52:54:00:99:03:00", ipv4: 10.199.0.13 }
    portForwarding:
      - { protocol: tcp, hostPort: 2222, address: 10.199.0.11, guestPort: 22 }
  lab:                          # no NAT: host mode, VMs and the Mac only
    ipv4Subnet: 10.199.1.0/24
    dhcp: false                 # addresses come from cloud-init

See also ​