UTILITY TO MIGRATE OMV CONFIGURATION TO ANOTHER SYSTEM OR
DO A NEW OMV INSTALLATION AND KEEP THE SETTINGS
Si quieres leer todo esto en español puedes hacerlo en github
omv-regen
INSTALLATION:
Copy and paste the following line into a terminal and run it as root or with sudo.
sudo wget -O - https://raw.githubusercontent.com/xhente/omv-regen/master/omv-regen.sh | sudo bash
- STEP 1. Create a backup of the original system with omv-regen.
- STEP 2. Do a fresh installation of OMV on the disk you want and connect the original data drives.
- STEP 3. Use omv-regen to migrate the settings from the original system to the new system.
omv-regen_7_eng.jpg omv-regen_7_esp.jpg
WHAT IS OMV-REGEN
- omv-regen is a command line (CLI) utility that is used to migrate/regenerate the configurations made in the graphical user interface (GUI) of one openmediavault (OMV) system to another OMV system. It is a script made in bash.
- omv-regen is divided into two main functions, both integrated into a graphical user interface, omv regen backup and omv-regen regenera.
- omv-regen backup -> makes a backup of the configurations made in the GUI of the original OMV system. The files necessary to perform a system regeneration are packaged in a tar file, primarily the database and some other system files, as well as others generated by omv-regen that contain necessary system information.
- omv-regen regenera -> regenerates all the OMV GUI configurations of the original system on a new OMV system from the backup made with omv-regen backup. It requires previously performing a clean installation of OMV, preferably on a different disk or pendrive.
WHAT OMV-REGEN IS NOT
- omv-regen is not a utility for scheduled backup and restore of the operating system at any time. If you need an openmediavault backup that you can restore at any time, use the openmediavault-backup plugin. The reason for this is explained in detail in the "Limitations of omv-regen" section, but the summary is that you need an updated backup to be able to restore with omv-regen.
- Alternatively, you can regenerate the system on another drive, for example a pendrive, and continue using the original disk/pendrive, which would provide you with a usable backup at any time.
OMV-REGEN IS USEFUL FOR
- Reinstall openmediavault on a new disk or new hardware keeping the configurations.
- Migrate openmediavault between different architectures, for example from a Raspberry to an x86 system or vice versa, but be careful, not all plugins are compatible with all architectures.
- Get a clean installation of openmediavault after a change of openmediavault versions. If, for example, you update OMV5 to OMV6 and the update causes problems, omv-regen can move the configuration to a clean system.
- Reinstall the system if it has become unstable for any reason, as long as the database is healthy and the system can be updated to the latest available version.
- You can get a working system with your current configuration and still use the original system. Just regenerate your system on a pendrive for example. That will provide you with a real backup of your system.
LIMITATIONS OF OMV-REGEN
- Configurations made in CLI will not be carried over to the new system, they will be lost and you will have to make them again. omv-regen does the regeneration from the OMV database, and this database only stores the configurations that have been made in the GUI. An average user will configure everything using the OMV GUI but an advanced user doing custom configurations in the CLI should keep this in mind.
- The openmediavault and plug-in versions must match on the original system and the new system. To ensure this omv-regen will update the original system before doing the backup and will update the new system before regenerating. It may happen that between the backup and the regeneration, an update occurs in the OMV repositories. In this case, if the versions of openmediavault or one of the essential plugins (related to file systems) do not match, the regeneration will stop. In this case you must return to the original system and make a new backup. If that happens with any other non-essential plugin, the plugin will be installed but its configurations will not be applied, the regeneration will complete but leaving that plugin ready to be manually configured in the OMV GUI.
HOW TO USE OMV-REGEN
The basic procedure is summarized in three steps, create a backup, install OMV, regenerate the OMV configuration.
- STEP 1. Create a backup of the original system with omv-regen.
- Log in via ssh on the original system, for example with putty.
- Install omv-regen on the original system. Run ->
sudo wget -O - https://raw.githubusercontent.com/xhente/omv-regen/master/omv-regen.sh | sudo bash
- Run the
omv-regen
command and follow the GUI prompts to create a backup. Check the option to update the system before making the backup. omv-regen will create a tar archive containing the files needed to regenerate the system. If you have optionally chosen a folder, another compressed file will be created for each folder chosen. The files in each backup are labeled in name with date and time. - Copy the backup to your desktop, for example with WinSCP. The backup file is very small and moves instantly.
- STEP 2. Do a fresh installation of OMV on the desired disk and connect the original data drives.
- Install openmediavault on a disk or pendrive different from the original one. Keep the original disk, this way you can return to the original system at any time.
- Turn off the system. Connect the data disks. Start the system. Don't do anything else, don't configure anything.
- STEP 3. Use omv-regen to migrate the settings from the original system to the new system.
- Log in via ssh to the new system, for example with putty.
- Install omv-regen on the new system. Run ->
sudo wget -O - https://raw.githubusercontent.com/xhente/omv-regen/master/omv-regen.sh | sudo bash
- Create a folder on the new system and copy the backup to that folder, for example with WinSCP.
- Run the
omv-regen
command and follow the GUI prompts to do the regeneration. You can choose not to configure networking or not install the proxmox kernel if it was installed on the original system. A reboot may be required during the process, if so omv-regen will ask you to do so, after the reboot run omv-regen again, the process will continue automatically. - omv-regen will reboot the system when the regeneration is complete. Access the OMV GUI in a browser and check that everything is as you expected. If you cannot access press Ctrl+Shift+R to clear the browser cache, if necessary repeat it several times.
- The result of the regeneration will be the following:
- All configurations made in the OMV GUI on the original system will be replicated on the new system. This includes users and passwords, filesystems, docker and containers configured with the compose plugin, etc. Make sure that the persistent data in the containers resides on a separate disk, if it is on the operating system disk you must include that folder in the omv-regen backup if you do not want to lose it.
- It does NOT include any configuration done in CLI outside of the OMV GUI. Use other means to support that.
- Does NOT include containers configured in Portainer. You will have to recreate them yourself.
- Filebrowser and Photoprism plugins are podman containers. They will not be backed up, use other means.
OMV-REGEN FEATURES
1 - omv-regen
- Opens the graphical interface with the configuration and execution menus for any omv-regen function. The GUI will guide you to run a backup or regeneration.
2 - omv-regen backup
- Performs a very light backup of essential data to regenerate the configurations of an OMV system. You can include optional folders, even from your data disks, and define the destination. You must previously configure the backup parameters in the omv-regen GUI, once configured you can run omv-regen backup
in the CLI or schedule a task in the OMV GUI to automate backups.
3 - omv-regen regenera
- Regenerates a complete OMV system with its original configurations from a fresh OMV installation and the backup of the original system made with omv-regen backup. Run omv-regen on the command line and the interface will guide you to configure the parameters and run the regeneration. Then you can run it from the menu or from CLI with the command omv-regen regenera
4 - omv-regen help
- Access to dialogs with full omv-regen help.
SOME ADVICES
- OPTIONAL FOLDERS: If you choose optional folders make sure they are not system folders. Or, if they are, at least make sure they won't harm your system when copied to the OMV disk. It would be a shame to break the system for this once regenerated.
- FILEBROWSER AND PHOTOPRISM PLUGINS: If you use the Filebrowser or Photoprism plugins or any other based on podman you should find alternative means to back them up, omv-regen will not support them. omv-regen will install them and regenerate the OMV database configurations, this includes the OMV GUI configurations, shared folder, plugin access port, etc. But the internal configurations of the two containers will be lost. It may be enough to include the folder where the container database resides so that omv-regen will restore it as well. This does not guarantee anything, it is just an untested suggestion.
- OPENMEDIAVAULT-APTTOOL: If you have a package installed manually, for example lm-sensors, and you want it to also be installed at the same time you can use the apttool plugin. omv-regen will install packages that have been installed using this plugin.
- OPENMEDIAVAULT-SYMLINK: If you use symlinks on your system omv-regen will recreate them if they were generated with the plugin. If you did it manually in CLI you will have to do it again in the new system.
- DO THE REGENERATION IMMEDIATELY AFTER THE BACKUP: You must make the backup and immediately do the regeneration to avoid differences between package versions. See Limitations of omv-regen.
- DIFFERENT SYSTEM UNIT: It is highly recommended to use a different system drive than the original one to install OMV on the new system. It is very easy to use a pendrive to install openmediavault. If you are unlucky enough that an update to an essential package is released between the time of the backup and the time of the rebuild, you will not be able to finish the rebuild, and you will need the original system to make a new updated backup.
- DOCKER CONTAINERS: All the information on the original system disk will disappear. To keep your docker containers in the same state make sure you do a few things first. Change the default docker installation path from the /var/lib/docker folder to a folder on one of the data disks. Configure all container volumes off the system disk, on one of the data disks. These are general recommendations, but in this case even more so, if you don't do it you will lose that data. Alternatively you can add optional folders to the backup.
THREAD FOR QUESTIONS ABOUT OMV-REGEN
If you need to ask any questions about omv-regen you can do so in this thread: Questions about omv-regen
GITHUB
- Link to github: https://github.com/xhente/omv-regen/blob/master/README.md
- If you are interested in how the script works on github there is a schematic of how regeneration is applied. It is in Spanish but there is little text, it is easy to understand for someone who speaks English.
ACKNOWLEDGMENTS: Thanks to Aaron Murray (ryecoaaron) for his advice on developing omv-regen.