Recovering from a Longhorn Backup without System Installed
This command gives users the ability to restore a backup to a raw image or a qcow2 image. If the backup is based on a backing file, users should provide the backing file as a qcow2 image with --backing file parameter.
examples/restore_to_file.yaml.template as a new file, for example, restore.yaml.<NODE_NAME>, for example, node1.hostpath of volume disk-directory. By default the directory is /tmp/restore/.<BACKUP_URL>, for example, s3://<your-bucket-name>@<your-aws-region>/backupstore?backup=<backup-name>&volume=<volume-name>.<backup-name> and <volume-name> can be retrieved from backup.cfg stored in the backup destination folder, for example, backup_backup-72bcbdad913546cf.cfg. The content will be like below:{"Name":"backup-72bcbdad913546cf","VolumeName":"volume_1","SnapshotName":"79758033-a670-4724-906f-41921f53c475"}
output-file by replacing <OUTPUT_FILE>, for example, volume.raw or volume.qcow2.output-format by replacing <OUTPUT_FORMAT>. The supported options are raw or qcow2.longhorn-version by replacing <LONGHORN_VERSION>, for example, v1.14.0<S3_SECRET_NAME>, for example, rustfs-secret.longhorn-system namespace.kubectl create -f restore.yaml
kubectl -n longhorn-system get pod restore-to-file -w
After the pod status changed to Completed, you should able to find <OUTPUT_FILE> at /tmp/restore on the <NODE_NAME>.
We also provide a script, restore-backup-to-file.sh, to restore a backup. The following parameters should be specified:
--backup-url: Specifies the backups S3/NFS URL. For example, s3://backupbucket@us-east-1/backupstore?backup=backup-bd326da2c4414b02&volume=volumeexamplename"--output-file: Set the output file name. For example, volume.raw--output-format: Set the output file format. For example, raw or qcow2--version: Specifies the version of Longhorn to use. For example, v1.14.0Optional parameters can be specified:
--aws-access-key: Specifies the AWS credentials access key if backup is s3.--aws-secret-access-key: Specifies the AWS credentials access secret key if backup is s3.--backing-file: Specifies the backing image. For example, /tmp/backingfile.qcow2The output image files can be found in the /tmp/restore folder after the script has finished running.
Copyright © 2019-2026 Longhorn a Series of LF Projects, LLC. Documentation Distributed under CC-BY-4.0.
The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.
For website terms of use, trademark policy and other project policies please see lfprojects.org/policies.