How to regenerate a complete OMV system.

  • chente:


    Thank you very much for the script and the advice! Its working very good. However I modified your script a litte bit. Rather than copying the files all in the same directory with every execution, I let the script create a folder with current date and saves the files all in this directory. This helps me a bit with the overview.

    I want to share the mod, maybe this is helps someone too.




    • Offizieller Beitrag

    I let the script create a folder with current date and saves the files all in this directory

    That can be useful if you want versions of the backups.

    To store the information necessary to regenerate the system does not make sense, you only need the last one. That's why I didn't do it that way, I wanted to keep it as simple as possible.

    To store the rest of the information it can be useful. And thinking about it, it makes sense to do it if the utility of the script is to store other types of information.

    Thanks for sharing!

    I would add a version limit to that so it's not infinite.

  • Hi, just for information, if i run this script and save the configuration of OMV.

    then i replace the system disk ( from 160 to 250 GB or viceversa )

    then i reinstall all the distro and restore the configuration


    works out of the box???

    • Offizieller Beitrag

    Hi, just for information, if i run this script and save the configuration of OMV.

    then i replace the system disk ( from 160 to 250 GB or viceversa )

    then i reinstall all the distro and restore the configuration


    works out of the box???

    If you follow the steps as I have done it should work.

    • Offizieller Beitrag

    Just make sure to update the system before extracting the database. The versions must match.

    If something goes wrong you always have the original disc, you don't lose anything.

    • Offizieller Beitrag

    A detail that I did not publish in the first post.


    When you create the users in the new system, do it in the same order as the respective UIDs. That is, first create the user with UID=1000, then the user with UID=1001, then the user with UID=1002 etc.


    In the users_list file you will have the list of users sorted, and next to each user is the user's UID. It's simple, you just have to follow the order.


    This way they will match the original system. If you have containers referenced to users, they will work correctly without doing anything else, for example.


    Edit: Added in the first post

  • we need a serious backup solution for OMV

    just if a disk fail... there are problems and boot is difficoult ( 1 of data disk ie snapraid etc etc)

    recreate the installation is the fastest solution imho (for simple configurations of course..)

    restoring a backup from the plugin was a pain (need a distro live, some hard coding DD etc etc)

    i'm just cloning the entire disk from a winpe and seems the best solution....

    for the average user the restore is impossible... i think!

    • Offizieller Beitrag

    we need a serious backup solution for OMV

    I don't know what you mean exactly, there are many serious backup solutions on OMV, from cloning USB devices to advanced options like openmediavault-backup has.


    I know that restores dd, fsarchiver, etc are not easy. It took me a while to learn how to do it safely. But, once the hurdle of restoration is overcome, those methods are safe and never fail. Each method has its advantages and disadvantages.


    What I have done in this thread can be used to restore in certain cases, but it stops being useful if you cannot update the original system. If you can update the system, this method can be applied in many situations, starting with what you need, just change the system disk, and the process is simple.


    A restore with dd or fsarchiver will not fix a broken system. Regenerating a system will repair a damaged system, as long as the database has not been damaged. They are different cases in which you can choose one method or another depending on what you need.


    It's just another option.

  • only for info, i have modded a bit your script


    #!/bin/bash


    # Sets the current date

    dt=$(date +%y%m%d)

    path=/home/bkp


    #creates folder with current date

    mkdir -p $path/regen_omv/$dt


    # Sets the path with current date to store the backup.

    bkp=$path/regen_omv/$dt

    • Offizieller Beitrag

    Edit: After these tests came others, and others. Finally I found some problems, so I developed omv-regen to solve it. See first post.


    ________________________________________________________________________________________________________________________________


    After a few more tests I can confirm that this works without any problem.

    I have cloned actual working real machines, including my own production server, with ZFS and proxmox kernel with a year old install. I have tried in virtual machines with all the combinations that I have come up with. Never any mistakes.


    Some more indications:

    - In order not to lose the connection when replacing the config.xml file, it is enough to establish beforehand the IP that was on the original server. If you don't remember it, nothing happens. Just wait a couple of minutes and reboot.

    - If you have a ZFS pool install proxmox before changing the config. Once you have made the configuration change on the server, restart and you only have to import the pool. Everything will work as before.


    When I have time I will post all of this in a guide in the guides section of the forum.

    • Offizieller Beitrag

    Thank you querys and lordk1 Following the suggestions indicated and other ideas of mine I have written a more elaborate and useful script. Now it works like this:

    • The backup storage path is passed to the script as a parameter. For example regen-omv.sh /data/backups
    • Backups are stored in subfolders labeled with date and time.
    • Backups older than 7 days are deleted.
    • If you want to keep any backup version change the subfolder prefix and it will not be deleted.
    • You can easily add and remove folders you want to back up.
    • A Readme document is generated with instructions for rebuilding and the lists of plugins and users.

    It is translated into English. I don't know if I'll do it again :)


    Note Use the top right button in the code box to copy the script.

    • Offizieller Beitrag

    Update.


    • If you copy the files /etc/passwd and /etc/shadow to their original location you will have all the original usernames and passwords. You will only need to include them in groups if you had them before.
    • If you had docker installed on another disk (not /var/lib/docker) installing openmediavault-compose will automatically install docker on /var/lib/docker. If you don't want to move it later you will have to mount a disk to install docker before installing openmediavault-compose.
    • If you had a proxmox kernel and zfs remember to install the proxmox kernel before openmediavault-zfs
  • The issue is that most people probably run the OMV Extras. so that will not backup everything either.

    then some run OMV on top of a Debian install therefore doing ZFS.

    Bonding of multiple NICS.

    What I did was just cloned 32Gb Flash Drive onto another USB Flash drive.

    I figure once every few weeks update it.. test it put it back in the drawer.

    What is missing is the ability to see what changes and or the ability to roll back a change that you may have misconfigured.

  • Thank you querys and lordk1 Following the suggestions indicated and other ideas of mine I have written a more elaborate and useful script. Now it works like this:

    • The backup storage path is passed to the script as a parameter. For example regen-omv.sh /data/backups
    • Backups are stored in subfolders labeled with date and time.
    • Backups older than 7 days are deleted.
    • If you want to keep any backup version change the subfolder prefix and it will not be deleted.
    • You can easily add and remove folders you want to back up.
    • A Readme document is generated with instructions for rebuilding and the lists of plugins and users.

    It is translated into English. I don't know if I'll do it again :)


    Note Use the top right button in the code box to copy the script.

    me da que no tengo bash, ¿Puede ser?:


    Code
    root@bnas:~# /root/omv.backup.sh /srv/dev-disk-by-uuid-6f38f974-7aec-452a-815d-9101878af2e1/Backup
    -bash: /root/omv.backup.sh: /bin/bash^M: intérprete erróneo: No existe el fichero o el directorio
    root@bnas:~#

    si añado bash delante me da otro error:


    • Offizieller Beitrag

    It all depends on what you want to use this for.

    The issue is that most people probably run the OMV Extras. so that will not backup everything either.

    then some run OMV on top of a Debian install therefore doing ZFS.

    It will not. It is explained in the first post. ZFS is not a problem, just import the file system. Everything appears as it was.

    Bonding of multiple NICS.

    This is not a problem. Everything that is configured on the interface is retrieved.

    What I did was just cloned 32Gb Flash Drive onto another USB Flash drive.

    I figure once every few weeks update it.. test it put it back in the drawer.

    It is not comparable. They are different uses. For example with this system you can not copy to a smaller disk.

    What is missing is the ability to see what changes and or the ability to roll back a change that you may have misconfigured.

    The interface configuration is what it was, there are no errors.

    • Offizieller Beitrag

    me da que no tengo bash, ¿Puede ser?:

    That's right, bash is somewhat restricted in OMV. That's why I copy the file to /home and run with the entire path, it's the simplest /home/regen-omv.sh

    I suppose that it will be possible to activate bash in some way but I have not looked at how to do it.


    (Me acabo de dar cuenta de que has publicado en español, te van a tirar delas orejas ^^ )

  • same error in home:


    more info


Jetzt mitmachen!

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