Skip to content

VirtualDisk Resource Kind

Kind: VirtualDiskapiVersion: pivirt.hu/v1Aliases: disk, disks

The VirtualDisk resource defines an independent block storage volume or an attachment to a virtual machine. It allows operators to manage disk lifecycles independently of virtual machines, supporting standalone volume creation, persistent data disks, and hot-attaching.


In pivirtctl commands, any of the following aliases are recognized: VirtualDisk, virtualdisk, virtualdisks, virtual-disk, virtual-disks, disk, disks.


apiVersion: pivirt.hu/v1
kind: VirtualDisk
metadata:
name: postgres-data
labels:
environment: production
tier: database
spec:
vmName: db-01 # Attaches directly to VM 'db-01'
sizeGb: 100
format: qcow2
bus: virtio
readonly: false

Field Type Required Default Description
vmName string No VM name to attach this disk to upon application
id string No metadata.name Unique disk device ID exposed to the guest
path string No Auto-generated Local filesystem path to the underlying image file
sizeGb float64 Yes Disk capacity in Gigabytes
format string No qcow2 Image format: qcow2 or raw
bus string No virtio Storage controller bus: virtio, scsi, sata, ide
readonly bool No false Mount disk as read-only

Terminal window
# Apply a new virtual disk (creates image or attaches to VM)
pivirtctl apply -f disk-data.yaml
# List all virtual disks
pivirtctl get disks
# Filter disks by label
pivirtctl get disks -l "tier=database"
# Inspect disk properties
pivirtctl describe disk postgres-data
# Delete disk (cascades teardown from VM if attached)
pivirtctl delete disk postgres-data