Storage Architecture & Pools Guide
PiVirt provides a unified, pluggable storage subsystem supporting high-performance local image directories, thin-provisioned LVM volumes, remote iSCSI SANs, and shared OCFS2 cluster filesystems.
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"Volume Management
Section titled “Volume Management”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-cloneResize Volume
Section titled “Resize Volume”pvcli storage volume resize \ --name data-01 \ --size 200GiDelete Volume
Section titled “Delete Volume”pvcli storage volume delete data-01Snapshots
Section titled “Snapshots”Create Snapshot
Section titled “Create Snapshot”pvcli storage snapshot create \ --volume data-01 \ --name backup-01Restore Snapshot
Section titled “Restore Snapshot”pvcli storage snapshot restore \ --volume data-01 \ --name backup-01iSCSI Configuration
Section titled “iSCSI Configuration”Target Setup
Section titled “Target Setup”# Create targetpvcli storage target create \ --iqn iqn.2024-01.hu.pilab:vm-storage \ --alias "VM Storage Pool"
# Add LUNpvcli storage target lun add \ --target iqn.2024-01.hu.pilab:vm-storage \ --lun 1 \ --device /dev/pivirtd-vg/vm-01-diskInitiator Setup
Section titled “Initiator Setup”# Discover targetspvcli storage initiator discover --portal 10.0.1.10:3260
# Loginpvcli storage initiator login \ --target iqn.2024-01.hu.pilab:vm-storage \ --portal 10.0.1.10:3260OCFS2 Cluster Filesystem
Section titled “OCFS2 Cluster Filesystem”Create OCFS2 Volume
Section titled “Create OCFS2 Volume”pvcli storage ocfs2 create \ --name vm-shared \ --device /dev/disk/by-id/scsi-360050764008181c60000000000000001 \ --cluster pivirt-clusterMount OCFS2
Section titled “Mount OCFS2”pvcli storage ocfs2 mount \ --name vm-shared \ --mount-point /var/lib/pivirtd/sharedBest Practices
Section titled “Best Practices”1. Choose Right Storage Backend
Section titled “1. Choose Right Storage Backend”| Backend | Use Case | Performance |
|---|---|---|
| Local dir | Development | ★★☆☆☆ |
| LVM | Production | ★★★★☆ |
| iSCSI | Clustered | ★★★★★ |
| NFS | Shared | ★★★☆☆ |
2. Use Thin Provisioning
Section titled “2. Use Thin Provisioning”storage: pools: - name: "lvm-pool" type: "lvm" volume_group: "pivirtd-vg" thin_pool: "pivirtd-thin" thin_provisioning: true3. Enable Discard/TRIM
Section titled “3. Enable Discard/TRIM”spec: disks: - name: root discard: true # Enable TRIM4. Monitor Storage Usage
Section titled “4. Monitor Storage Usage”# Check pool usagepvcli storage pool list
# Check volume usagepvcli storage volume listTroubleshooting
Section titled “Troubleshooting”Pool Not Accessible
Section titled “Pool Not Accessible”# Check pool statuspvcli storage pool get default -o yaml
# Check underlying storagedf -h /var/lib/pivirtdiSCSI Connection Issues
Section titled “iSCSI Connection Issues”# Check iscsidsystemctl status open-iscsi
# Check sessionsiscsiadm -m session -P3OCFS2 Mount Failures
Section titled “OCFS2 Mount Failures”# Check cluster statuso2cb cluster-status
# Check DLMdlm_tool ls