[How-To] Restore OMV system backup made with openmediavault-backup plugin

  • INTRODUCTION


    If you use the Backup plugin (openmediavault-backup) you might have asked: if something goes wrong, how should I restore it?

    After all, backup is useless if you don’t know what to do with it, so let’s sort it out!


    The Backup plugin offers many backup options, but in this guide, I will be considering fsarchiver, because it’s the one I use and the most convenient: does not waste space and it’s faster than dd (just my 2 cents here, dd team don’t yell at me!). Well, actually the best option would be borgbackup, but it’s very complex and my previous attempts have failed.

    PRE-REQUISITES

    Please note this guide only applies to x86/64 systems and not to ARM, like RPi.


    You should:

    • Configure the Backup plugin using the fsarchiver option
    • Run at least one backup
    • Recommendation: do not store your backup on a RAID array. It’s harder to mount during an emergency. If you have an SSD for apps, downloads or cache, store it there.
    • Recommendation: also copy your backups to another server o a cloud service. Use rclone to automate this activity.
    • Check if you’re running a UEFI installation. Run this command in the terminal ls /sys/firmware/efi
      If the folder exists, you’re running a UEFI Installation, which means you’ll have to restore an additional partition, which is backed up by the plugin.
    • Have a spare USB drive to boot SystemRescue live image. It’s a great live image to restore our system.
    • Have a spare bootable media in case yours has gone rotten, may happen with USB drives.


    WHAT BACKUP FILES MEAN

    backup-omv-xxx.blkid - This is the output of blkidput in a file for informational purposes.

    backup-omv-xxx.espdd.gz - This is the UEFI (also called ESP) partition, in a compressed archive.

    backup-omv-xxx.fdisk - This is the output of fdisk -l put in a file for informational purposes.

    backup-omv-xxx.fsa - This is the fsarchiver file containing the OMV system backup.

    backup-omv-xxx.grub - This is the first 446 bytes of the disk where grub is installed

    backup-omv-xxx.grubparts - This is the first 512 bytes of the disk where grub is installed and the partition table.

    backup-omv-xxx.packages - This is the output ofdpkg -l | grep openmediavault put in a file for informational purposes.


    RESTORE

    Your system doesn’t boot to OMV anymore. Does not matter if GRUB, the OS or the drive are broken, we can handle this.


    If you have done your homework, don’t panic!


    Plug a keyboard, mouse, monitor and the SystemRescue boot media to your server.

    NOTE: If you don't want or you can't do this, you can still perform the restore procedure on a computer or VM, booting SystemRescue. You will need access to your backups, that's why uploading them to another server/cloud is a good idea.

    Set your preferred keyboard layout by typing setkmap, then start the graphical environment by typing startx. Whilst you could do everything in SSH/shell, I think it’s better to have a GUI, especially for this kind of task.


    Open Gparted and find the OMV boot drive. Format it to ensure nothing dirty is left behind. Select the system drive, then navigate to Device > Create Partition Table.

    • If you’re using UEFI, select GPT
    • If you’re not using UEFI (legacy boot), select ms-dos

    If the drive refuses to be formatted, the drive is broken and you’ll have to plug in a new one.


    Open a terminal and type lsblk. Write down the name of the new system drive and the partition where the backup is located. If your backup is on an external drive, connect the drive and type the command again.


    Create a new folder where to mount the backups. Run mkdir /mnt/backup, or wathever you like under /mnt.

    Mount the partition that contains the backup in the folder you just created. It should be something like /sdXN, where X is a letter (related to the drive) and N is a number (related to the partition).


    Bash: Example (partition is omitted to avoid blind execution)
     mount /dev/sdN1 /mnt/backup


    Ensure the mount is successful. Run ls /mnt/backup, you should see familiar names. If not, run umount /mnt/backup and repeat the process with another disk.


    Locate the backup folder. Example: /mnt/backup/omvbackup/

    RESTORE THE PARTITION TABLE

    Let's kick off by restoring the grubparts file. This is the first 512 bytes of the disk where grub is installed and the partition table.


    Note that:

    - sdX is the new system drive - don't add the partition number. In my case is sda

    - In this example backups are located in /mnt/backup/omvbackup/ - use the tab to autocomplete in the backup folder. xxx is the timestamp of the backup. Select the grubparts file


    Bash: Example (partition is omitted to avoid blind execution)
    dd if=/mnt/backup/omvbackup/backup-xxx.grubparts of=/dev/sdN bs=512


    If restore was successful, refresh Gparted and will show your partitions. Ignore the "Used" column, it doesn't reflect the current state (they're all empty).

    Identify the boot and system partitions, you'll need these for the next steps. Write down their full name.


    RESTORE UEFI PARTITION

    If your system does not have UEFI, skip this section.


    Decompress the UEFI partition, which is contained in the espdd file. The file extension varies between OMV6 and OMV7:

    Bash: OMV7
    zstd -d /mnt/backup/omvbackup/backup-xxx.espdd.zst
    Bash: OMV6
     gzip -d /mnt/backup/omvbackup/backup-xxx.espdd.gz


    The partition will be extracted to a file ending with .espdd, which should be around 512 MB.

    Check with GParted which is the boot partition, usually the first (number 1). Has a boot flag.


    Note that:

    - sdN1 is usually your boot partition – when running the command, enter the partition number after the letter.

    - Select the .espdd file in the backup folder


    Bash: Example (partition is omitted to avoid blind execution)
    dd if=/mnt/backup/omvbackup/backup-xxx.espdd of=/dev/sdN1 bs=512

    RESTORE SYSTEM PARTITION

    Check with GParted which is the system partition, usually the largest.


    - sdX2 is usually your system partition - when running the command, enter the partition number after the letter.

    - If you're using OMV7, you need to uncompress first the .zst archive to get the .fsa file. If you're using OMV6 simply skip this since you will already have the .fsa file.

    Bash: OMV7
    zstd -d /mnt/backup/omvbackup/backup-xxx.dd.zst


    - Then select the .fsa file in the backup folder to be used for the restore.

    Bash: Example (partition is omitted to avoid blind execution)
     fsarchiver restfs /mnt/path/to/backup.fsa id=0,dest=/dev/sdX2 -v 


    NOTE: This step can take up to 30 minutes when restoring to a USB thumb drive, but the command will show the completion percentage.


    When completed, type reboot and the system will reboot. Remove the SystemRescue media.



    If you’re done these steps correctly, you have restored your OMV system which will boot just as before.


    SWAP

    If you use a swap partition and have changed the drive, OMV/Debian might take a long time to boot and eventually complain about that SWAP partition cannot be found, because it is referenced via the UUID.


    To fix this, you need to find the new UUID.

    Execute ls -l /dev/disk/by-uuid/, find the swap partition and copy the UUID.

    You can also execute lsblk  to doublecheck you picked the right partition by checking the size of the swap partition.


    Then update the UUID.

    - Execute sudo nano /etc/fstab

    - Update the swap UUID with the new value, save and exit nano

    - Execute sudo update-grub to update grub with the new info from fstab

    - Execute sudo swapon -s to finally enable the swap partition again


    STILL NO BOOT?

    If you still cannot boot, it is likely that Grub was not restored successfully. It can happen on some systems with specific or weird configurations, or simply because you're out of luck.

    To resolve this problem, reboot to SystemRescue media, and reinstall grub using the utility grub-install. There are many tutorials describing the process, here's one directly from Ubuntu help pages.



    CREDITS

    Thanks to ryecoaaron for maintaining this plugin.


    Thanks to bvrulez for the original guide which was a great resource to start with.

    OMV BUILD - MY NAS KILLER - OMV 6.x + omvextrasorg (updated automatically every week)

    NAS Specs: Core i3-8300 - ASRock H370M-ITX/ac - 16GB RAM - Sandisk Ultra Flair 32GB (OMV), 256GB NVME SSD (Docker Apps), 2x16TB HDDs w/ SnapRAID - Fractal Design Node 304 - Be quiet! Pure Power 11 350W


    My all-in-one SnapRAID script!

    7 Mal editiert, zuletzt von auanasgheps () aus folgendem Grund: Added OMV7 changes

  • macom

    Hat das Thema freigeschaltet.
  • auanasgheps

    Hat den Titel des Themas von „[How-To] Restore OMV system with openmediavault-backup plugin“ zu „[How-To] Restore OMV system backup made with openmediavault-backup plugin“ geändert.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!