Storage Architecture & Pools
PiVirt provides a unified storage abstraction layer supporting multiple backends: local directory filesystems, LVM thin provisioning, network iSCSI block storage, NFS shares, and clustered OCFS2 volumes.
Storage Architecture
Section titled “Storage Architecture”flowchart TB
subgraph DiskLayer["VM Disk Layer"]
LCL["Local (qcow2/raw)"]
ISC["iSCSI (block)"]
NFS_D["NFS (file)"]
end
subgraph PoolMgr["Storage Pool Manager"]
LVM_P["LVM Pool"]
ISC_P["iSCSI Pool"]
NFS_P["NFS Pool"]
end
LCL --> LVM_P
ISC --> ISC_P
NFS_D --> NFS_P
Storage Pools
Section titled “Storage Pools”Local Directory Pool
Section titled “Local Directory Pool”storage: pools: - name: "default" type: "dir" path: "/var/lib/pivirtd/images"LVM Thin Pool
Section titled “LVM Thin Pool”storage: pools: - name: "lvm-pool" type: "lvm" volume_group: "pivirtd-vg" thin_pool: "pivirtd-thin"iSCSI Pool
Section titled “iSCSI Pool”storage: pools: - name: "iscsi-pool" type: "iscsi" target_iqn: "iqn.2024-01.hu.pilab:storage" portal: "10.0.1.10:3260"NFS Pool
Section titled “NFS Pool”storage: pools: - name: "nfs-pool" type: "nfs" server: "nas.pilab.hu" export: "/exports/pivirtd" version: "4.2"Volume Types
Section titled “Volume Types”Raw Volumes
Section titled “Raw Volumes”- Direct block device access
- Best performance
- No snapshots (unless backend supports)
QCOW2 Volumes
Section titled “QCOW2 Volumes”- Copy-on-write
- Snapshots and cloning
- Compression and encryption
Thin Provisioning
Section titled “Thin Provisioning”- Allocate on demand
- Over-provisioning support
- Space reclamation with discard
Volume Operations
Section titled “Volume Operations”Create Volume
Section titled “Create Volume”pvcli storage volume create \ --pool default \ --name data-01 \ --size 100Gi \ --format qcow2Clone Volume
Section titled “Clone Volume”pvcli storage volume clone \ --source data-01 \ --name data-01-cloneSnapshot
Section titled “Snapshot”pvcli storage snapshot create \ --volume data-01 \ --name backup-01Resize
Section titled “Resize”pvcli storage volume resize \ --name data-01 \ --size 200GiCluster Storage (OCFS2)
Section titled “Cluster Storage (OCFS2)”For multi-node clusters, PiVirt uses OCFS2 for shared block storage:
cluster: name: "pivirt-cluster" o2cb: stack: "o2cb" nodes: - name: "node-01" ip: "10.0.1.10" - name: "node-02" ip: "10.0.1.11" fencing: enabled: true agent: "ipmi"