From be17c95d8607e458b7f32da857e578a4f40ac3c2 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Sun, 1 Sep 2024 16:11:20 +0200 Subject: [PATCH] Improve documentation of recovering Longhorn volumes --- docs/longhorn.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/longhorn.md b/docs/longhorn.md index 24e854c..532a188 100644 --- a/docs/longhorn.md +++ b/docs/longhorn.md @@ -62,3 +62,14 @@ To restore a backup, perform the following actions: 2. Enable the "backup-nfs" recurring job for the Longhorn volume. 3. Disable the "default" recurring job group for the Longhorn volume. 4. Create the PV, PVC and workload as usual. + +## Recovering Longhorn volumes without a Kubernetes cluster + +1. Navigate to the Longhorn backupstore location (`/mnt/longhorn/persistent/longhorn-backup/backupstore/volumes` for us). +2. Find the directory for the desired volume: `ls **/**`. +3. Determine the last backup for the volume: `cat volume.cfg | jq '.LastBackupName'`. +4. Find the blocks and the order that form the volume: `cat backups/.cfg | jq '.Blocks'`. +5. Extract each block using lz4: `lz4 -d blocks/XX/YY/XXYY.blk block`. +6. Append the blocks to form the file system: `cat block1 block2 block3 > volume.img` +7. Lastly we need to fix the size of the image. We can simply append zero's to the end until the file is long enough so `fsck.ext4` does not complain anymore. +8. Mount the image: `mount -o loop volume.img /mnt/volume`.