Create a Backup
Incremental Backup
Backups in Longhorn are objects in an off-cluster backupstore. A backup of a snapshot is copied to the backupstore, and the endpoint to access the backupstore is the backup target. For more information, see this section.
Prerequisite: A backup target must be set up. For more information, see Set the BackupTarget. If the BackupTarget has not been set, you’ll be presented with an error.
Create an Incremental Backup Using UI
To create a backup,
-
Navigate to the Volume menu.
-
Select the volume you wish to back up.
-
Click Create Backup.
-
Add any appropriate labels and click OK.
Result: The backup is created. To see it, click Backup in the top navigation bar.
For information about restoring a volume from a snapshot, see Restore from a Backup.
Create an Incremental Using YAML Code
-
Obtain the name of the snapshot that you want to back up (from either the Longhorn UI or the CR).
-
Apply the YAML.
Example:
apiVersion: longhorn.io/v1beta2
kind: Backup
metadata:
name: backup-example
namespace: longhorn-system
spec:
backupMode: incremental
snapshotName: snapshot-name-example
labels:
app: test
Full Backup
By default, Longhorn backs up only data that was changed since the last backup. This approach, known as delta backup, enhances time efficiency and conserves network throughput. However, when a data block in the backupstore becomes corrupted, Longhorn does not replace that data block with a healthy one during subsequent backup operations.
Starting with v1.7.0, Longhorn can perform full backups that upload all data blocks in the volume and overwrite existing data blocks in the backupstore.
Create a Full Backup Using the Longhorn UI
-
Go to the Volume screen.
-
Select the volume that you want to back up.
-
Click Create Backup.
-
Add appropriate labels.
-
Select Full Backup.
-
Click OK.
Create a Full Backup Using YAML Code
-
Obtain the name of the snapshot that you want to back up (from either the Longhorn UI or the CR).
-
Apply the YAML.
Example:
apiVersion: longhorn.io/v1beta2
kind: Backup
metadata:
name: backup-example
namespace: longhorn-system
spec:
backupMode: full
snapshotName: snapshot-name-example
labels:
app: test
Uploaded Data Size
To facilitate collection of data transfer information for each backup, Longhorn records the information using two metrics in the CR status.