Storage, Backup and Disaster Recovery
local graph
Chapter 7: Storage, Backup And Disaster Recovery
Section titled “Chapter 7: Storage, Backup And Disaster Recovery”If Harvester is the brain and KubeVirt is the muscles, Longhorn is the spine that keeps everything upright. Virtual machines, guest Kubernetes clusters, databases, and stateful applications all depend on reliable block storage. When storage fails, the impact is immediate and usually painful. When storage is designed and protected well, most other issues become manageable.
Harvester standardizes on Longhorn as its storage layer. Each VM disk is a Longhorn volume presented through a Kubernetes PersistentVolumeClaim. Snapshots and backups use Longhorn capabilities under the hood, and disaster recovery procedures are essentially carefully scripted ways to recreate volumes and VMs from that data. On top of that, tools like Velero can capture both Kubernetes state and Longhorn volume data through CSI snapshots and data movement, which gives you a unified way to protect not only Harvester itself but also guest clusters and applications running on those clusters.
This section focuses on practical architecture and operations. First, you will see how Longhorn works in Harvester, what replication really means, and how to design volumes that match availability and performance goals. Then you will look at snapshots, backup targets, and ways to restore VMs across clusters. After that, you will see how Velero and CSI work together with Longhorn to protect Kubernetes and VM aware workloads. Finally, you will pull the pieces together into disaster recovery runbooks and drills that you can actually execute when something serious happens.
7.1: Longhorn Architecture, Replication And Volume Design For Harvester
Section titled “7.1: Longhorn Architecture, Replication And Volume Design For Harvester”Longhorn is a distributed block storage system that runs entirely inside Kubernetes. Every volume you create is implemented as a small cluster of processes. There is a dedicated storage controller called the Longhorn engine for that volume, and there are multiple replicas, each storing a full copy of the volume data on a different node. Reads and writes go through the engine, which synchronously replicates the data to all replicas before acknowledging the write to the guest.
In Harvester, each VM disk is backed by a Longhorn volume. When you create a VM, the platform provisions a PersistentVolumeClaim using the Longhorn storage class and either clones from an existing VirtualMachineImage (for example a qcow2 template) or allocates an empty block device. Under the hood, Longhorn creates a volume object, a controller pod, and replica pods on multiple nodes. The controller pod is effectively the engine. It presents an iSCSI or ublk device to the node where the VM pod runs, then proxies I/O to replicas over TCP.
Because the storage controller is per volume, failure isolation is strong. If the engine pod for one volume has a problem, other volumes and their engines continue to operate. The Longhorn manager, which runs as a daemonset on all nodes, watches these objects and reconciles desired state with actual state. If a replica pod crashes or a node disappears, the manager marks that replica as failed and, if replica count allows, rebuilds a new replica on another node from the remaining healthy replicas.
Replica count is one of the primary design parameters you control. A replica count of 3 means every volume has three full copies stored on three nodes. A volume stays healthy as long as at least two replicas are available and the controller can reach them. A count of 2 reduces capacity overhead but gives less tolerance for concurrent failures. Longhorn documentation and field experience suggest that replica count 3 is a good baseline for critical workloads in clusters with enough nodes to spread replicas widely, while replica count 2 can be acceptable for less critical data or constrained environments.
Volume locality is another key aspect. Longhorn can favor scheduling replicas on nodes that also run the corresponding workload, which reduces latency and cross rack traffic. Harvester clusters often span a small number of racks in one data center, so latency is usually low enough that strict rack awareness is not essential, but you can still use node labels and disk tags if you want volumes for particular services to reside in specific zones or on specific disk types.
Disk layout interacts directly with Longhorn. Each node exposes one or more block devices to Longhorn as storage disks. Longhorn treats these as pools and places replicas across them according to scheduling rules. For Harvester, that typically means a fast system disk for SLE Micro and Harvester itself, plus one or more SSD or NVMe disks dedicated to Longhorn data. Longhorn guidance is clear that SSD or NVMe media are strongly preferred, and that spinning disks are not appropriate for most production use cases because their IOPS characteristics are too weak once replication and rebuild load are added.
From Kubernetes’ perspective, Longhorn presents volumes through storage classes. A default storage class called longhorn or longhorn-system is usually present, and Harvester uses it as the storage class for VM disks unless you specify a different one. You can define additional storage classes that set different replica counts, data locality policies, or other parameters, then choose those classes per VM or per workload.
Here is a simplified example of a Longhorn storage class that sets replica count and data locality explicitly.
apiVersion: storage.k8s.io/v1kind: StorageClassmetadata: name: longhorn-ha-3provisioner: driver.longhorn.ioparameters: numberOfReplicas: "3" staleReplicaTimeout: "30" dataLocality: "best-effort" fromBackup: ""reclaimPolicy: DeleteallowVolumeExpansion: truevolumeBindingMode: ImmediateIn a Harvester cluster, you typically do not create storage classes directly through YAML unless you are tuning advanced behavior, because the platform already supplies a default one. However, defining an extra storage class like longhorn-ha-3 can be useful when you want to guarantee that particular volumes always have three replicas even if the default is lower.
When you create a VM, the backing PVC may look like this.
apiVersion: v1kind: PersistentVolumeClaimmetadata: name: pvc-db-01 namespace: default labels: harvesterhci.io/managed: "true" app: primary-databasespec: accessModes: - ReadWriteOnce storageClassName: longhorn-ha-3 resources: requests: storage: 500GiThis PVC is created automatically by Harvester when you define the VM’s disks, but seeing the PVC clarifies that VM disks are just Kubernetes volumes from Longhorn’s point of view. If you later expand the disk in Harvester, the platform updates the PVC request size and Longhorn performs an online expansion of the volume.
When you design volumes, you must balance capacity, performance, and failure tolerance. Larger replica counts provide more resilience but consume more space and more rebuild bandwidth when nodes fail. Higher replica counts also amplify the effect of noisy disks, since every write must be acknowledged by more replicas. On the other hand, replica count 1 is generally unsuitable except for scratch data, because losing a single node can destroy the only copy of the volume.
You also need to think about backup and snapshot behavior as part of volume design. Longhorn snapshots are implemented inside each volume as chainable metadata pointing to data segments. Snapshots are cheap in terms of immediate capacity, but if you keep many long lived snapshots, Longhorn loses opportunities to reclaim space, and read paths can get more complex. Longhorn backups, in contrast, transfer snapshot data to an external NFS or S3 compatible target and are suited for protection against cluster loss or catastrophic data corruption.
The architecture gives you flexible tools but does not choose policies for you. A Harvester cluster hosting only test workloads might be fine with replica count 2 and aggressive expiration of old snapshots. A production cluster running line of business databases and guest Kubernetes clusters needs stricter defaults, perhaps replica count 3 for critical storage and a disciplined backup schedule to an external target. The important part is that you define these policies intentionally and apply them consistently rather than relying on defaults that happened to be present when you installed the cluster.
7.2: Snapshots, Backup Targets And Cross Cluster Restore For VMs
Section titled “7.2: Snapshots, Backup Targets And Cross Cluster Restore For VMs”Harvester exposes Longhorn’s snapshot and backup primitives through VM centric workflows. You take VM snapshots or backups from the Virtual Machines page, and Harvester translates those actions into Longhorn operations plus custom resources that track metadata. VM level snapshots and backups retain not just volume data but also key configuration metadata, which makes restoration significantly smoother than working directly with raw Longhorn volumes.
There are two main concepts here. VM snapshots are stored inside the Harvester cluster. They rely on Longhorn volume snapshots and can be used to roll back a VM or create a new VM from a point in time copy of its disks. They are quick to take and suitable for short term safety nets, for example before an OS upgrade. VM backups are external. They store volume data and metadata in a backup target, which can be NFS or S3 compatible storage. Backups are what you rely on for longer retention, off cluster protection, and cross cluster recovery.
Harvester manages VM backups through a VirtualMachineBackup custom resource, in addition to the Longhorn backup objects. Each VM backup essentially groups the set of Longhorn backups for all volumes attached to a VM and ties them to VM metadata such as CPU, memory, disks, and networks. A feature discussion in the Harvester project notes that VirtualMachineBackup is treated as a volume group for one to many VM volumes, which is exactly what you need if you want consistent multi disk restores.
Before you can create VM backups, you must configure a backup target. This is done through the backup-target setting in Harvester. You can set it to an NFS endpoint or an S3 compatible object store. Harvester then applies corresponding settings to Longhorn so that both share the same backup target.
On the Kubernetes side, the backup target appears as a Setting custom resource in the harvester-system namespace. You can view or edit it with kubectl if you need to automate configuration.
apiVersion: harvesterhci.io/v1beta1kind: Settingmetadata: name: backup-target namespace: harvester-systemvalue: | { "type": "nfs", "endpoint": "nfs.example.com:/exports/harvester-backups", "accessKeyId": "", "secretAccessKey": "", "bucketName": "", "bucketRegion": "", "cert": "", "virtualHostedStyle": false }For S3, the type changes to s3, and you fill in bucket and credentials fields. Longhorn supports NFS versions 4.0 to 4.2 for backup targets, so you must make sure your NFS server and exports use a supported version, otherwise backups may fail to mount.
When you create a VM backup from the Harvester UI, Harvester generates a VirtualMachineBackup object that looks conceptually like this, greatly simplified.
apiVersion: harvesterhci.io/v1beta1kind: VirtualMachineBackupmetadata: name: db-01-backup-2025-09-01 namespace: defaultspec: source: kind: VirtualMachine name: db-01 type: "backup"status: readyToUse: true creationTime: "2025-09-01T01:23:45Z" volumeBackups: - volumeName: pvc-db-01-root backupName: "backup-db-01-root-abc123" size: 500GiThe volumeBackups section ties this VM backup to one or more Longhorn volume backups, which live in the Longhorn system namespace and are stored in the external backup target. When you restore from this backup, Harvester uses that mapping to reconstruct PVCs and create a new VM or replace an existing one.
Cross cluster restore is where these abstractions show their value, but also where you need to be deliberate. A common scenario is a complete cluster loss or a DR test where you want to bring VMs up on another Harvester cluster using the same backup target. You point the new cluster at the existing NFS or S3 backup location, import backups, and restore VMs. In principle this is straightforward, but details matter.
One issue that has surfaced in user reports is that storage classes and Longhorn engine images may differ between clusters. If the new cluster does not have a storage class with the same name as the one referenced in the backup metadata, PVC provisioning can fail with errors like StorageClass.storage.k8s.io “longhorn-image-xxxxx” not found. To avoid this, align storage class names between source and target clusters or map them intentionally during recovery.
Another subtle point is version compatibility between Harvester and Longhorn. Newer Harvester versions may embed newer Longhorn versions with features or metadata fields that older clusters do not understand. In a DR design, you should treat Harvester and Longhorn as part of the same lifecycle and either keep clusters on compatible versions or plan upgrades alongside your DR practice. Longhorn and SUSE documentation both stress the importance of matching engine images and controller versions across nodes and clusters during operations such as live upgrade and rebuild.
Once backup targets and versions are aligned, cross cluster restore is conceptually simple. On the new cluster, you configure the same backup target, let Harvester discover existing VM backups, and then use the VM Backups page or API to restore them. You can restore a backup as a new VM with a new name or as a replacement for an existing VM. When restoring, Harvester provisions new Longhorn volumes from backups, recreates VM definitions with stored metadata, and powers on the new VMs once volumes are attached.
If you prefer to automate backup creation and retention, you can use Longhorn’s recurring job mechanism directly. From the Longhorn UI, you define recurring snapshots and backups for volumes, and you can tie those recurring jobs to Harvester managed volumes. This gives you volume level schedules that run independently of manual VM actions. A SUSE community post points out that Harvester VM backups are essentially Longhorn storage backups, and scheduling them from Longhorn is currently the way to get cron style backups without manual clicks.
The general pattern is to use snapshots for rapid, short term recovery inside the same cluster and backups for cluster level and longer term protection. For cross cluster disaster recovery, treat the backup target as a shared, replicated object store, align storage classes and Longhorn versions between clusters, and use Harvester’s VM backup metadata to reconstruct VMs cleanly instead of trying to attach raw Longhorn volumes by hand.
7.3: Using Velero And CSI For Kubernetes And VM Aware Backups
Section titled “7.3: Using Velero And CSI For Kubernetes And VM Aware Backups”Harvester protects VM disks through Longhorn snapshots and backups, but you often need to protect more than just disks. Guest Kubernetes clusters running on Harvester have their own namespaces, deployments, services, and CRDs. Applications typically combine persistent data and Kubernetes resources. If you only back up volumes, you have a partial story. Velero is a natural complement here. It backs up Kubernetes objects and, through CSI snapshot support and data movement, can also back up volume data in an integrated way.
Longhorn exposes a CSI driver and supports Kubernetes VolumeSnapshot APIs, which Velero can consume. By labeling the appropriate VolumeSnapshotClass and configuring Velero with the CSI plugin and a suitable data mover, you can have Velero trigger Longhorn snapshots, copy data to object storage, and keep metadata about which PVCs and pods are associated with which snapshots. SUSE and community documentation show this pattern in detail, including recent guidance on backing up Longhorn v2 volumes with Velero using the CSI Snapshot Data Movement feature.
The first building block is a VolumeSnapshotClass that references the Longhorn CSI driver. Most Longhorn installations already include a class named longhorn. To make Velero use it, you label that class appropriately.
# Label the Longhorn VolumeSnapshotClass so Velero can discover itkubectl label volumesnapshotclass longhorn velero.io/csi-volumesnapshot-class=trueThis label tells Velero that this snapshot class should be used when it needs to create snapshots for CSI backed PVCs.
To enable CSI snapshot and data movement support in Velero, you deploy Velero with the CSI feature flags and install the Velero CSI plugin. If you are using an object store such as S3 or an S3 compatible system as your backup location, the configuration looks like a standard Velero deployment with additional parameters.
apiVersion: velero.io/v1kind: BackupStorageLocationmetadata: name: longhorn-backups namespace: velerospec: provider: aws objectStorage: bucket: "cluster-backups" config: region: "us-east-1" s3Url: "https://s3.example.com" s3ForcePathStyle: "true"Here, provider is set to aws even for many S3 compatible systems because Velero reuses the AWS plugin for generic S3 endpoints. The s3Url and s3ForcePathStyle fields tailor it to your environment.
You also define a VolumeSnapshotLocation that points to your CSI driver.
apiVersion: velero.io/v1kind: VolumeSnapshotLocationmetadata: name: longhorn-csi namespace: velerospec: provider: csi config: snapshotClass: "longhorn"Once Velero is running with these locations configured, backups can use CSI snapshots for volumes. When you run a Velero backup with CSI enabled, the flow is roughly as follows. Velero identifies PVCs that belong to the resources being backed up. For each PVC, it asks the CSI driver to create a VolumeSnapshot in the class labeled for Velero. Longhorn interprets that snapshot request and creates a snapshot in the Longhorn volume, and, when data movement is configured, a backup to object storage. Velero records references to those snapshots and backups alongside the Kubernetes resources so that restores can recreate both PVCs and their data.
A typical backup command might look like this.
# Backup a guest Kubernetes namespace that uses Longhorn volumesvelero backup create guest-prod-backup-2025-09-01 \ --namespace guest-prod \ --snapshot-volumes \ --volume-snapshot-locations longhorn-csi \ --storage-location longhorn-backups \ --ttl 720hHere, —snapshot-volumes enables CSI snapshot usage, and —ttl sets the retention period. The guest-prod namespace could be part of a guest cluster running on Harvester or part of the Harvester cluster itself if you are backing up something like Rancher or supporting components.
VM aware backups via Velero are a bit more nuanced, because Harvester VMs are not just PVCs. They also involve VirtualMachine resources, VirtualMachineInstance resources, and potentially Harvester specific CRDs like VirtualMachineImage. For VM data, the Longhorn volumes backing VM disks can be captured through CSI snapshots in the same way as other PVCs. For VM configuration, you need to include the relevant namespaces and CRDs in Velero backups.
One approach is to treat Harvester VMs similarly to Kubernetes workloads. You identify the namespaces where VM resources live, often default and a few project specific namespaces, and configure Velero to include those namespaces and CRDs in backups. You can specify additional resources such as virtualmachines.kubevirt.io, virtualmachinebackups.harvesterhci.io, and virtualmachineimages.harvesterhci.io in Velero’s configuration so that they are included. During recovery, you restore these resources first, then ensure that PVCs backed by Longhorn are restored using the CSI snapshot and data movement pipelines.
Another pattern, especially for platform level DR, is to use Velero primarily for cluster level state such as Rancher, management applications, and guest cluster configuration, while continuing to use Harvester’s own VM backup mechanisms for individual VM recovery.
A recent SUSE article on using Velero with Longhorn v2 volumes shows that Velero’s CSI data movement is particularly effective for application stacks composed of Kubernetes resources plus Longhorn PVCs, while Harvester’s VM backup API is well suited to whole VM protection in Harvester specific workflows.
These strategies are not mutually exclusive. You can use Velero to protect guest clusters and platform controllers, and Harvester VM backups for bare VMs that host things outside Kubernetes. The important thing is to map applications to backup mechanisms explicitly. For each critical service, you should know whether its state is in Kubernetes resources and Longhorn volumes managed by Velero, in Harvester VMs backed by VM backups, or both.
When you combine Velero with Longhorn and Harvester, you gain a layered backup capability. At the lowest layer, Longhorn snapshots provide fast intra cluster rollback. Above that, Longhorn backups provide VM and volume level retention to external storage. On top, Velero captures Kubernetes resources and, through CSI, volume data to backup storage. Together, these tools cover most realistic failure and mistake scenarios, as long as you design backup policies and recovery procedures with your actual workloads in mind.
7.4: Disaster Recovery Runbooks And Restore Drills
Section titled “7.4: Disaster Recovery Runbooks And Restore Drills”Disaster recovery only works when it has been rehearsed enough that nobody has to improvise under pressure. Tools like Longhorn, Harvester VM backups, and Velero provide building blocks, but the actual recovery outcome depends on how clearly you define and practice runbooks. Those runbooks should focus on specific risk scenarios, concrete steps, and expected recovery times, not on vague intentions.
A sound starting point is to categorize scenarios that genuinely matter to your organization. Examples include loss of a single Harvester node, failure of a storage disk or Longhorn replica, corruption of a VM due to software fault or operator error, loss of an entire Harvester cluster because of hardware disaster or configuration error, and accidental deletion or severe misconfiguration of a guest Kubernetes namespace. For each of these, map out which technology you rely on. For node failures and replica issues, Longhorn replication and rebuild is the primary protection. For VM corruption, VM snapshots and backups are central. For full cluster loss, cross cluster restore from Longhorn and Harvester backup targets plus Velero are involved.
A good runbook starts with clear prerequisites. For instance, a cross cluster DR runbook should state which backup targets are in use, where they are hosted, what credentials are required, which Harvester version is running on the primary and secondary clusters, and where configuration files such as Harvester config.yaml and Velero BackupStorageLocation manifests are stored. Without this information, you risk having all the right backups but no way to reach them in an emergency.
The runbook then needs a precise sequence of actions, expressed in concrete terms. For example, in a cluster loss scenario, steps might include provisioning new bare metal hosts, installing Harvester on the new cluster using pre approved configuration files, configuring the same Longhorn backup target, waiting for VM backup metadata to appear, restoring a subset of critical VMs first, verifying network and application health, and only then proceeding to restore the remainder. The language should be crisp enough that someone other than the original author can follow it without interpretation.
It is crucial to tie DR procedures back to RPO and RTO expectations. If business stakeholders expect that key systems will lose at most 15 minutes of data and be back online in under an hour, your backup frequency, transport capacity to backup targets, and restore sequencing must reflect that. Longhorn snapshots and VM backups need to run at intervals that match RPO, and your network bandwidth and cluster capacity must support restores at speeds that match RTO. When Velero is involved, you should factor in how long it takes to restore namespaces, PVCs, and data from object storage for realistic dataset sizes.
Runbooks should also define decision points. For instance, if the primary cluster is down but might come back, who decides whether to initiate failover to a secondary site, and based on what criteria. If both primary and secondary clusters draw from the same backup target, how do you avoid concurrent restore or split brain scenarios. These are not technical questions only, but the technical steps must flow from agreed policies.
Restore drills are where you validate that your runbooks are real. A useful pattern is to schedule regular DR tests that exercise specific aspects of the plan without waiting for a real incident. For example, once per quarter you might take a Harvester VM backup of a tier two service, restore it to a test namespace or project in a secondary cluster, and verify that the restored VM boots and the application behaves correctly against a copy of data. Another test might involve Velero restore of a guest Kubernetes namespace into a blank cluster, verifying that pod counts match expectations and that applications become ready using the restored PVCs.
These drills will surface weak areas. You may discover that backup retention is too short, that S3 credentials are not stored safely but accessibly enough, that NFS backup targets depend on a single NAS that is itself unprotected, or that certain applications have undocumented external dependencies such as DNS entries or OAuth providers. Use these findings to refine both the technical architecture and the runbooks.
One common blind spot is the backup of the backup infrastructure itself. If your Longhorn backup target is a single NFS server, that server becomes a critical component. It needs its own backups and redundancy plan, or you should migrate to an object storage system that is resilient in its own right. The same applies to Velero’s backup storage location. Storing all cluster configuration and volume data in an S3 bucket that nobody knows how to recover or replicate does not improve your situation.
Disaster recovery planning should also cover partial failures that do not justify a full failover but still require careful handling. For example, if Longhorn reports that a volume has only one healthy replica due to consecutive node issues, your procedures should require immediate remediation before another failure happens. That might involve bringing a failed node back, adding a new node, or explicitly triggering replica rebuilds. Longhorn provides status fields and alerts that can be integrated into monitoring to make these conditions visible early.
The final ingredient is ownership. Runbooks, backups, snapshots, Velero configurations, and Harvester settings all need clear owners. Someone must be accountable for checking that backups complete successfully, that restore tests run on schedule, and that documentation reflects current versions and practices. Automation can verify technical aspects, but it does not replace clear responsibility and regular review.
Harvester, Longhorn, and Velero together provide a powerful foundation for storage, backup, and disaster recovery in a cloud native HCI platform. They are not turnkey safety nets by themselves. With thoughtful volume design, disciplined backup configuration, explicit DR runbooks, and regular drills, you can turn those building blocks into a storage and recovery posture that holds up in day to day operations and during serious incidents.