How to restore OMV 4.X from backup-plugin to system SSD

  • My hardware setup is


    - CPU x64
    - RAID6 with 7 disks (yes, I will change to snapraid)
    - SSD with operating system OMV4 connected to SATA port
    - backup flash USB option (if SSD does not work, I plug in usb and restart)
    - The BIOS boot order should be setup so that it boots firstly from the USB slot and secondly from the normal OMV disk. That way, if no USB is connected, the system will boot the normal operating system. But with USB connected it will boot the emergency option first. This comes in handy if booting from normal disk fails and you don't want to open the case or connect a headless server with a keyboard and monitor to choose boot options.


    My software setup is


    - OMV 4.1.17
    - OMV-Extras
    - I made a backup with the backup-plugin from the Web-GUi.
    - Backup setting: fsarchiver (no password)
    - Backup destination: The easiest way to do the backup was to my RAID-array.



    This might not be the best solution. Or, if you backup to the array, then you probably should copy it from there to some other destitination which you should be able to access even if your RAID array is not accessible. The same goes for Snapraid-array and other filesystems.


    Now, what to do to restore this backup:


    In my case my operating system was broken. So I could not boot from the installed SSD.


    Please be carefull with the commands here. I put YOUSHOULDKNOW everywhere you should recognise that if you don't know what to do or write here you probably should not do it anyway.


    1 - Plugin emergency OS (USB), reboot
    2 - Start OMV Web-GUI
    3 - I had to install SystemRescueCD to the OMV. Normally, this should already be part you your backup OMV. To install it go to OMV-Extras/Kernel.
    4 - Tell OMV on this page to boot from SystemRescueCD once.
    5 - Reboot.
    6 - Login via SSH (Putty) to the command line of SystemRescueCD. Username: root, Password: openmediavault.


    Now, you have to find the backup files. In my case they are on my RAID array and I have to mount it to access it. In your case you will have to adjust this but probably mounting a device will be necessary.


    7 - Check your RAID array: mdadm -D /dev/YOUSHOULDKNOW
    8 - My array was running fine.
    9 - Make a mountpoint in /mnt: mkdir /mnt/YOUSHOULDKNOW
    10 - Mount array to mountpoint: mount /dev/YOUSHOULDKNOW /mnt/YOUSHOULDKNOW
    11 - Move to backup directory on array
    12 - Check your backup: fsarchiver archinfo backup.fsa


    (Find out source partition, in my case the backup did not include the swap-partition, so I was pretty sure to backup just TO the first partition of my system disk)


    13 - Find out what device name the disk has you want to install the files from the backup on: blkid
    14 - This I did not do, but is recommended: If you are restoring to a new disk, write the backup of grub and the partition table (.grubparts file) to the disk before the fsarchiver restfs step with:


    dd if=/mnt/YOUSHOULDKNOW/backup.grubparts of=/dev/YOUSHOULDKNOW


    15 - Extract the backup to that drive (and correct partition): fsarchiver restfs backup.fsa id=0,dest=/dev/YOUSHOULDKNOW


    (id=0 means that just the first filesystem from the backup will be restored. I am assuming that you did just backup one filesystem with one backup.)


    16 - reboot with: reboot


    EDIT: I had a problem with "A start Job is running" on startup. I solved this by deleting an old filesystem via Web-GUI of a USB-harddisk that I disconnected, and by commenting a line in /etc/fstab that was referring to a wrong swap-partition. Boot time is now 11 seconds. :)


    Thanks a lot to ryecoaaron for writing this plugin.


    Further information regarding the files the plugin is saving:


    backup-omv-18-Jan-2019_14-12-01.blkid :: This is the output of blkid put in a file for informational purposes.
    backup-omv-18-Jan-2019_14-12-01.fdisk :: This is the output of fdisk -l put in a file for informational purposes.
    backup-omv-18-Jan-2019_14-12-01.fsa :: This is the fsarchiver file.
    backup-omv-18-Jan-2019_14-12-01.grub :: This is the first 446 bytes of the disk where grub is installed
    backup-omv-18-Jan-2019_14-12-01.grubparts :: This is the first 512 bytes of the disk where grub is installed and the partition table.
    backup-omv-18-Jan-2019_14-12-01.packages :: This is the output of dpkg -l | grep openmediavault put in a file for informational purposes.

    • Offizieller Beitrag

    Nice guide. I would only add that if you are restoring to a new disk, write the backup of grub and the partition table (.grubparts file) to the disk before the fsarchiver restfs step with:


    dd if=/mnt/YOUSHOULDKNOW/backup-omv-15-Jan-2019_14-12-01.grubparts of=/dev/YOUSHOULDKNOW

    omv 7.0.5-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.13 | compose 7.1.4 | k8s 7.1.0-3 | cputemp 7.0.1 | mergerfs 7.0.4


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Thanks a lot! This is actual the information I was hoping to gather. If you would like to elaborate more on the seperate files and their purpose I would be glad to also include it into the guide.

    • Offizieller Beitrag

    backup-omv-18-Jan-2019_14-12-01.blkid :: This is the output of blkid put in a file for informational purposes.
    backup-omv-18-Jan-2019_14-12-01.fdisk :: This is the output of fdisk -l put in a file for informational purposes.
    backup-omv-18-Jan-2019_14-12-01.fsa :: This is the fsarchiver file.
    backup-omv-18-Jan-2019_14-12-01.grub :: This is the first 446 bytes of the disk where grub is installed
    backup-omv-18-Jan-2019_14-12-01.grubparts :: This is the first 512 bytes of the disk where grub is installed and the partition table.
    backup-omv-18-Jan-2019_14-12-01.packages :: This is the output of dpkg -l | grep openmediavault put in a file for informational purposes.

    • Offizieller Beitrag

    If you would like to elaborate more on the seperate files and their purpose I would be glad to also include it into the guide.

    There is a guide for making guides.
    So it might become a guide in the guide section


    General Information, Templates & Guidelines for Guides

  • Hey, guys,
    The explanation is great.
    Unfortunately I did not understand a small thing.
    If my system disk or USB stick is broken.
    I take a new disk.
    Do I have to install the OMV before?
    Or is it enough to install dd if=/mnt/YOUSHOULDKNOW/backup.grubparts of=/dev/YOUSHOULDKNOW?
    and then fsarchiver restfs backup.fsa id=0,dest=/dev/YOUSHOULDKNOW.



    Thank you very much for the answer.
    Many greetings
    gelo

  • First, thanks for the guide.


    OMV will be my backup repository (among other things) so my ability to restore IT was critical to test early. Using this guide I was able to get to Step 15 before encountering a problem due to my root fs being btrfs. I was additionally required to use fdisk to delete the old partition, create a new partition (with the same parameters, I was asked to keep/remove the existing signature; select remove and the mkfs.btrfs will now succeed).
    So:
    ‣ fdisk /dev/sda
    ‣ delete partition 1 (my root)
    ‣ create new partition 1 with defaults (same as old partition)
    ‣ remove old signature
    ‣ fsarchiver restfs -v -o backup-omv-22-Jan-2019_22-31-09.fsa id=0,dest=/dev/sda1 NOW works


    [*] Note: I tried to manually "mkfs.btrfs -f /dev/sda1 -L 'khione-ssd-r' -U '7ea79897-dbb0-4698-b5ce-a17430edcd96' -s 4096" after the fdisk which worked, but fsarchiver then still failed. Deleting the partition again and running fsarchiver worked. The takeaway seems to be that mkfs.btrfs won't overwrite an existing partition and it is called by fsarchiver restfs.

  • Do I have to install the OMV before?
    Or is it enough to install dd if=/mnt/YOUSHOULDKNOW/backup.grubparts of=/dev/YOUSHOULDKNOW?
    and then fsarchiver restfs backup.fsa id=0,dest=/dev/YOUSHOULDKNOW.

    I did install the backup to a SSD which already had the OMV. But I am pretty sure it works with a blank disk, too. So, no, you don't have to install the OMV before.

  • Thanks for the great guide!


    How can I verify my fsarchiver backup ran successfully? When I run it manually it freezes at 41%. Although this could be due to my login timeout in the web panel.


    • The .fsa file is 34% of the used HDD space (.fsa is 6.5GB, used HDD is 19GB).
    • I set a 1 hour schedule and all 5 backups are the same size.
    • I do not get an email output.
    • All 6 files are created every time.
    • Offizieller Beitrag

    How can I verify my fsarchiver backup ran successfully?

    The cron job will fail and email you if you have notifications setup. You can also run an archinfo on it - http://www.fsarchiver.org/quickstart/


    When I run it manually it freezes at 41%. Although this could be due to my login timeout in the web panel.

    Not much I can do to fix that. Change your timeout or don't use the manual run.


    The .fsa file is 34% of the used HDD space (.fsa is 6.5GB, used HDD is 19GB).

    Makes sense. It doesn't backup free space and it uses compression - http://www.fsarchiver.org/compression/


    I set a 1 hour schedule and all 5 backups are the same size.

    Your OS drive shouldn't change that much. Add compression in and you end up with backups the same size.


    I do not get an email output.

    Did you setup notifications in the OMV web interface? The plugin just uses cron which is what has to email you. And cron requires notification setup.


    All 6 files are created every time.

    Yep. That is what it should do.

    omv 7.0.5-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.13 | compose 7.1.4 | k8s 7.1.0-3 | cputemp 7.0.1 | mergerfs 7.0.4


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • The cron job will fail and email you if you have notifications setup. You can also run an archinfo on it - http://www.fsarchiver.org/quickstart/


    Thanks for the reply. This is exactly what I needed to know.


    I have my head wrapped around this except for 1 thing which might be a stupid question. That is restoring to a new HDD. I need to run the command below to write the backup of grub and the partition table. So will running this command restore the extended & swap partitions like seen by the output of lsblk below.


    The more I read what I type the more clear the answer seems, but I want to make sure I don't royally screw up.


    dd if=/mnt/YOUSHOULDKNOW/backup-omv-15-Jan-2019_14-12-01.grubparts of=/dev/YOUSHOULDKNOW


    Here's the output of lsblk:

    Code
    YOUSHOULDKNOW      8:96  0   30G 0 disk          type

      ├─YOUSHOULDKNOW1 8:97  0 29.8G 0 part /        Linux

      ├─YOUSHOULDKNOW2 8:98  0    1K 0 part          Extended

      └─YOUSHOULDKNOW5 8:101 0 29.8G 0 part [SWAP]   Linux Swap / Solaris
    • Offizieller Beitrag

    So will running this command restore the extended & swap partitions like seen by the output of lsblk below.

    It restores the partition table. So, yes.


    The more I read what I type the more clear the answer seems, but I want to make sure I don't royally screw up.

    Test it on a different drive if you are worried.

    omv 7.0.5-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.13 | compose 7.1.4 | k8s 7.1.0-3 | cputemp 7.0.1 | mergerfs 7.0.4


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • When restoring to new (larger) drive, I've had some issues. I needed to do a clean install OMV, and after restore backup. I did try with and without step 14 "dd if=/mnt/YOUSHOULDKNOW/backup.grubparts of=/dev/YOUSHOULDKNOW". Also had CloneZilla image and got it fixed. (Also had mdadm errors, but don't even have RAID, also fixed).
    It was a challenge in my case anyway...


    For those who need to edit fstab (for whatever reason)... On OMV4: edit fstab and after saving file (don't reboot) run omv-mkconf fstab. On OMV5: edit fstab and (without reboot) run omv-salt deploy run fstab. Found this here, thanks!



    Now I'm looking for a solution for the following:
    I partitioned my OS SSD (using Parted Magic, not OMV on top of Debian way). Everything works fine (have had this on OMV4 and now on OMV5)...
    Currently running OMV5 in UEFI mode (extra partition). Partition layout: sda1=EFI partition (vfat), sda2=OS partition (ext4), sda3=swap partition and sda4="extra partition" (ext4). With sda3 / swap at the end of disk.
    Using fsarchiver doesn't include the "extra" partition, only the EFI/vfat and sda2(OS). Would like to backup the extra (data) partition as well (as scheduled job).
    Anyone, have any ideas? Thanks!


    *** The issues above had nothing to do with my partition layout. Tested multiple times with clean install (no changes in partitions) and restore to clean, same and bigger SSD.



    Edit: added screenshot of disk layout used on (other and OMV4) system to clarify.

    ODROID-HC2 running OMV4
    ASUS F2A85-M LE running OMV4

    2 Mal editiert, zuletzt von sm0ke ()

  • Hi bvrulez,


    I highlighted lines in question in your guide. I tried to use openmediavault-backup plugin but I don't see how I can point it to my system drive or choose a destination. I'am currently using SSD as a system drive. When I open the plugin options only let me choose shares. it looks like I'am missing something? Thank you.

    • Offizieller Beitrag

    When I open the plugin options only let me choose shares

    Correct. You have to create a share for the backups.


    Making backup of the OS on the OS does not make really sense when you want to recover from a failed drive.

  • Correct. You have to create a share for the backups.
    Making backup of the OS on the OS does not make really sense when you want to recover from a failed drive.

    Making a backup of the OS to the same location where OS is installed making no sense and I understand this. I guess my question was - how to use openmediavault-backup. Let me be more specific. I want to migrate from QNAP to OMV and for now(testing purpose, system learning, braking, restoring, experimenting, etc) I have built a small OMV system on a NUC with SSD sytem drive and two 2.5" drives for data. Of course one of the scenarios I want to implement here is - system drive loss/corruption and system restore after which I understand is achieved by copying/cloning the system drive partitions. Question: how can use openmediavault-backup to achieve my goal? Thank you.

  • Correct. You have to create a share for the backups.
    Making backup of the OS on the OS does not make really sense when you want to recover from a failed drive.

    Making a backup of the OS to the same location where OS is installed making no sense and I understand this. I guess my question was - how to use openmediavault-backup. Let me be more specific. I want to migrate from QNAP to OMV and for now(testing purpose, system learning, braking, restoring, experimenting, etc) I have built a small OMV system on a NUC with SSD sytem drive and two 2.5" drives for data. Of course one of the scenarios I want to implement here is - system drive loss/corruption and system restore after, which I understand is achieved by copying/cloning the system drive partitions. Question: how can use openmediavault-backup to achieve my goal? Thank you.

    • Offizieller Beitrag

    Just create a shared folder on one of the data drive and choose this shared folder in the GUI of the backup plugin as backup destination.


    Make sure you are able to restore from the backup.


    An alternative solution is to use Clonezilla to clone the complete system drive. This is done offline but easier to restore.

Jetzt mitmachen!

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