Files and environment
This page lists every file and folder vz reads or writes, the environment variables it reads, and the host tools it runs. It helps when you want to free disk space, move vz's data, script around a lab, or understand what a lab leaves behind.
The vz home folder
Everything vz keeps for you lives under one folder, ~/.vz by default:
~/.vz/
├── state/<lab>/ default state directory of each lab
├── labs/ one record per lab, running or stopped (vz ls)
├── images/ base images from vz image pull
└── cache/ verified downloads, so a pull does not fetch twice| Folder | Written by | Safe to delete? |
|---|---|---|
state/<lab>/ | vz up and the lab process | Only when the lab is stopped. Use vz destroy instead, which also stops it. |
labs/ | the lab process | Yes, but vz ls then forgets labs whose state is outside ~/.vz/state. One small JSON file per lab, written at vz up and removed by vz destroy; vz ls drops records whose state directory is gone. |
images/ | vz image pull | Only images no lab uses. Overlays depend on their base image: deleting or replacing a base breaks the nodes built on it until you run vz node reset. |
cache/ | vz image pull | Yes, always. The next pull downloads again. |
vz clean shows how much space each folder takes, and deletes what you pick: --cache, --state (labs that are not running) or --images (only when no lab runs). It never touches a running lab. See vz clean. To stop every lab first, run vz shutdown.
VZ_HOME
Set VZ_HOME to move the whole folder, for example to an external disk:
export VZ_HOME=/Volumes/Lab/vzIMPORTANT
VZ_HOME must be an absolute path (a leading ~ is expanded). A relative value is ignored, because the lab process runs in the lab file's folder, where a relative path would point somewhere else.
Lab files usually point at images with ~/.vz/images/.... That path does not follow VZ_HOME. If you move the home folder, update the disk paths in your lab files too, or pull images to the old place with vz image pull -o ~/.vz/images ....
Images
vz image pull writes the unpacked image to ~/.vz/images/ (or the -o folder) under a fixed name that has no point release, so lab files keep working across releases:
| Image | File |
|---|---|
disk/debian-13 | debian-13-genericcloud-arm64.raw |
disk/debian-13-generic | debian-13-generic-arm64.raw |
disk/debian-12 | debian-12-genericcloud-arm64.raw |
disk/ubuntu-24.04 | ubuntu-24.04-server-cloudimg-arm64.raw |
disk/ubuntu-26.04 | ubuntu-26.04-server-cloudimg-arm64.raw |
disk/fedora-44 | fedora-44-cloud-arm64.raw |
disk/almalinux-10 | almalinux-10-cloud-arm64.raw |
disk/rocky-10 | rocky-10-cloud-arm64.raw |
iso/debian-13 | debian-13-netinst-arm64.iso |
ipsw/macos | macos-arm64.ipsw |
vz image ls shows the same list with aliases and whether each one is pulled.
While pulling, vz writes cache/<upstream file>.partial and images/.<file>.partial/ (for the macOS restore image: images/.partial-macos-arm64.ipsw). Both are removed or renamed when the pull ends, so an interrupted pull never leaves a half-written file under the final name. Raw disks are sparse: they take only the space their data needs on APFS.
The state directory
Each lab has one state directory. It is chosen in this order:
--state <path>on the command line (relative to the current folder)state:in the lab file (relative to the lab file)~/.vz/state/<lab name>(underVZ_HOME)
<state>/
├── control.sock control socket of the lab process (mode 0600)
├── lab.pid PID of the lab process
├── lab.log stdout and stderr of the lab process
└── <node>/
├── efi-vars.fd UEFI variable store (generic)
├── machine-id the VM's machine identifier (generic)
├── mac-hardware-model Mac hardware model, from the restore image (apple)
├── mac-machine-id the Mac's machine identifier (apple)
├── mac-aux-storage the Mac's NVRAM (apple)
├── macos-installed written when the macOS install has finished (apple)
├── disk<N>.overlay.asif private writes to disk N (overlay: true)
├── disk<N>.cache.asif cache layer of disk N (cache: true)
├── cidata.iso cloud-init seed built from init:
├── cidata/ staging folder for the seed
├── console-<yyyyMMdd-HHmmss>.log console log (consoleLog: true)
└── console.command script opened by vz node console| File | Notes |
|---|---|
control.sock | Created when the lab is ready, removed when it stops. Commands such as node ls and down connect here. See Control protocol. |
lab.pid | A lab counts as running only while this file names a live process. A recycled PID with no matching file is not mistaken for the lab. |
lab.log | Emptied at every vz up. Read it when up fails or a node misbehaves. |
disk<N>.* | N is the disk's position in the node's disks: list, starting at 0. Reordering disks changes which overlay belongs to which disk. |
cidata.iso | Rebuilt each time vz up starts the node. Only on generic: an apple node reads init on the Mac instead. |
mac-*, macos-installed | apple only. While macos-installed is missing, vz up installs macOS from the .ipsw under disks. |
console-*.log | A new file each time vz up starts the node. vz node logs --boot 0 is the newest. |
CAUTION
Two labs must never share a state directory. Keep the default, or give each lab its own state:.
What node reset and destroy delete
| Command | Deletes | Keeps |
|---|---|---|
vz node reset <nodes> | in each node folder: cidata.iso, every *.overlay.* and *.cache.* file, and the platform's files: efi-vars.fd on generic; mac-hardware-model, mac-machine-id, mac-aux-storage and macos-installed on apple | machine-id (generic), console logs, everything outside the node folder |
vz destroy | the whole state directory, and the lab's entry in ~/.vz/labs/ | base images, disks created next to the lab file, shared folders |
node reset refuses while the lab runs. destroy stops the lab first.
Socket path length
A Unix socket path on macOS must be shorter than 104 bytes. vz validate (and vz up, which validates first) reports a <state>/control.sock longer than 103 bytes: "the state directory path is too long for its control socket (N of 103 bytes): ... Use a shorter state: path or lab name". Use a shorter state:, a shorter --state, or a shorter VZ_HOME.
Keeping state in a project folder
A lab in a git repository can keep its state next to the lab file:
state: ./.vzAdd it to .gitignore. Overlays can grow to gigabytes.
The state directory must be a folder of its own. vz destroy deletes it, so vz validate refuses a state: (or --state) that is the lab file's own folder, a folder above it, your home folder, /, VZ_HOME or its labs/ folder.
Disks created next to the lab file
A disk with path: and size: that does not exist yet is created at vz up, relative to the lab file: a sparse raw file for .raw/.img, an empty ASIF image for .asif. These files are yours: node reset and destroy never delete them.
Bundled schema and examples
vz schema and vz init --example read files shipped with vz. They look in this order:
../share/vz/schema/27.jsonand../share/vz/examples/, relative to thevzbinary. This is the layout ofmake installand release archives (bin/vznext toshare/vz/).- The SwiftPM resource bundle
vz_CLI.bundlenext to the binary, for builds from source (make build).
If neither is found, the commands say the files are missing and suggest make build.
Environment variables
| Variable | Default | Meaning |
|---|---|---|
VZ_HOME | ~/.vz | The vz home folder. Absolute paths only. |
VZ_TERMINAL | Terminal | The app vz node console opens, for example iTerm. |
NO_COLOR | Any value turns colors off in human output. | |
FORCE_COLOR | Any value except 0 turns colors on, even when the output is not a terminal. | |
PATH | Searched for qemu-img. /opt/homebrew/bin and /usr/local/bin are searched too. |
What vz reads on the Mac
| Source | When | Why |
|---|---|---|
/var/db/dhcpd_leases | vz node ls | DHCP leases from the macOS DHCP server that vmnet uses, to show guest addresses. |
| Its own code signature | vz up | To check for the com.apple.security.virtualization entitlement before starting anything. |
Tools vz runs
| Tool | When | Why |
|---|---|---|
/usr/bin/hdiutil makehybrid | vz up, nodes with init: | Builds the cidata seed ISO. |
/usr/sbin/diskutil image create blank | vz up, a missing .asif disk with size: | Creates an empty ASIF disk image. |
qemu-img convert (optional) | vz image pull of a qcow2 image (Ubuntu, Fedora, AlmaLinux, Rocky) | Converts qcow2 to raw. Without qemu-img, vz uses its built-in converter: qcow2 versions 2 and 3 with zlib compression. It refuses backing files, encryption, external data files, extended L2 entries and zstd compression. |
/usr/bin/open -a <terminal> | vz node console | Opens the console window. Needs no Automation permission. |
Network access
Only vz image pull uses the internet. It downloads checksum lists and images from the distributions' own servers: cloud.debian.org, cdimage.debian.org, cloud-images.ubuntu.com, download.fedoraproject.org, repo.almalinux.org and download.rockylinux.org. Guests reach the internet through their switch's NAT, not through vz.
Processes
vz up starts one background process per lab (vz __run-lab). It runs in its own session, with the lab file's folder as its working directory and stdin from /dev/null, so closing the terminal does not stop the VMs. It owns the VMs, switches, links, port forwarders and display windows, and it exits when every VM has stopped. Stop it with vz down. SIGINT or SIGTERM to it shuts the lab down gracefully; a second signal powers the VMs off.