Migration from OMV5 -> OMV6 on PROXMOX

  • Hi all,


    due to the fact that until now there is no correct way of upgrade from OMV5 to OMV6, im would try to migrate from 5 to 6 using Proxmox.


    currently i have one VM OMV5 and created a 2nd VM OMV6.


    to my prod OMV5 I passtrough 4 disks in proxmox, now the question is, can i passtrough the 4 disks again to another VM on the same time? will i not damage the proxmox?

    i need it to properly migrate all the docker containers, meaning export current running containers using this container to get the compose yaml files and then run compose on OMV6, to get all the applications alive with mapped all the disks.

    i get the config files from omv5, turn it off. then turn on omv6 and it will use the mapped disks.


    or it is not possible to have passtrough the same disks for 2 VMs?


    thanks for any hints.

    omv 6.0 in proxmox 7.1-10 - AMD Ryzen 1700 - 48GB DDR4 :thumbup:

  • At least in VMware it is not possible to pass through disks to two VMs. The OS expects exclusive access to the disk, so this will break.
    Why don't you just export the stacks in OMV5 and copy the config.xml (and probably /etc/passwd /etc/group) before you do the switch?


    If you have an older version of OMV5 installed, which mounts disk by label, take care when installing OMV6 which mounts by-uuid, so pathes will be different for all your stacks, if you did not use symlinks.

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • i used create containers option, and not stacks in portainer, so i have to do it somehow in different way.


    and exactly, my OMV uses the mounts by label, so another part that i have to cover

    omv 6.0 in proxmox 7.1-10 - AMD Ryzen 1700 - 48GB DDR4 :thumbup:

  • Just change to stacks / docker-compose on OMV5 before you switch to OMV6. No need to mount a disk on two VMs.

    You should even try to do the by-uuid switch on OMV5 before migrating.

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • You were already on the right path: Use


    Code
    mkdir <container_name>
    cd <container_name>
    docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/red5d/docker-autocompose <contain_name> > docker-compose.yml
    docker stop <container_name>
    docker rm <container_name>
    docker-compose up -d
    cd ..


    To extract the docker-compose.yml from the existing container (may even be a stopped one). AStop and remove the caontainer and restart it using the docker-compose.yml.


    You can tweak the docker-compose.yml to your liking.

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • You can only manage stack in portainer which have been created in (this instance of) portainer.


    If you have been able to extract the docker-compose.yml file and want to use it inside portainer:

    • go to the directory you made for this docker-compse.yml file
    • docker-compose down # Stop the stack
    • cat docker-compoy.yml
    • copy-and-past this into a new stack in portainer

    From then on, you can manage the stack in portainer.

    If you have moved the docker root to a data drive (or installed portaienr the way km0201 reccomends ith bind mount to a directory), you can transfer this to a fresh install of OMV6.

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • already tried that, when i used this command:

    Code
    docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/red5d/docker-autocompose <container-name-or-id> <additional-names-or-ids>...

    i copied it from terminal to the portainer here:


    i ended up with stack created, but it is telling me the same that it cannot be managed by portainer....



    EDIT: aha, so if im copying it from docker on OMV5 to another portaner instance to OMV6, i will be not able to control the stack with the portainer on OMV6?


    EDIT2: so first do the stack in portainer on OMV5, export stack on omv5, copy it to omv6 server and import the stack there? that should be the process?

    omv 6.0 in proxmox 7.1-10 - AMD Ryzen 1700 - 48GB DDR4 :thumbup:

  • I assume, you want to use portainer on OMV6 to manage your containers, not docker-compose.yml files managed on the cli with docker-compose.


    The first step is to get the running containers inside portainer, so you can manage them. As you will probably need to adjust volume pathes, it is easier to do and get help with portaienr stacks. When everyting is inside portainer, the challenge is to get the portainer data to the other VM which we do in a later step. All the following is to be done in the omv5 VM.


    So for now everything in OMV5: portainer can only manage stacks which have been created inside portainer, so you need to shut down the stack outside portainer and create a new one with the same name from inside portainer. To do so, you have to extract the docker-compose.yml using the command line given above and paste its contents into the add stack menu). Before hitting "deploy stack" in portianer shut down and remove the running container, so portainer can create a new one instad of manage an existing one. (gives a downtime of a few seconds).


    To stop and remove the container, use docker stop containername docker rm containername or docker-compose down in the correct directory depending on how you ccreated the container.


    to get a list of all containers defined use docker ps -a



    Portainer can be set up in (at least) two distinct ways: Using the OMV button or a docker-compsoe file. When created with from the UI, portainer stores it's data inside a docker volume (check volumes in portainer). Before transfering the containers you have to find out how you dit it in omv5 and how you are going to do it in omv6. I will assist with the transfer once everything is in portainer on omv5

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • so i found out that you have to slightly change the yml output file from the docker-autocompose from this:


    to this, that it is accepted by portainer as its stack:


    so it will take a lot of manual work to rewrite all my 20 containers.


    i will let you know once i have them all as stacks.


    thanks for your help

    omv 6.0 in proxmox 7.1-10 - AMD Ryzen 1700 - 48GB DDR4 :thumbup:

  • These stacks should work out of the box, as this is what docker internally uses. Just strip the default entries, if you like.


    I would not even try to change networks to network_mode: host, as docker makes it the other way round internally.

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • File a bug at github. If the environment contains a ${...} variable docker tries to replace it. It should be $${...}


    You could try to double every $ in the file, which is an easy task using sed.

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • so, all docker applications i have now as stacks. Now i can backup them using Portainer backup.


    another part to migrate, the samba shares, users and groups, paths to disks (probably using simlinks). How can i export it correctly?

    omv 6.0 in proxmox 7.1-10 - AMD Ryzen 1700 - 48GB DDR4 :thumbup:

  • Create the symlinks to your drives


    ln -l /srv/dev/disk-by-... to /srv/new_name

    Convert all pathes inside the docker-compose to the symlinks


    Now we come to what officially is "not possible/ not recommended" and requires manual work (commands from memory, not testes!):

    • Extract groupadd command from /etc/group:
      while IFS=: read group g guid ; do echo groupadd -g $guid $group ;done < /etc/group
      Manually remove the groups created by the os install
    • Extrac useradd command from /etc/passwd:
      while IFS=: read user shadow uid guid geco home sh; do echo useradd -u $uid -g $guid -c "$geco" -d $home -s $sh $user ;done < /etc/passwd
      Manually remove the users added by the os install
    • get /etc/shadow for the passwords
    • get /etc/openmediavault/config.xml

    install all this onto your new OMV, install omv. This will report some missing disks (the by-label ones). Replace the by-labe diskt by -by-uuid disks roll out out the config according to the docs (omv-salt ...)


    Hope forthe best, as this is a unsupported procedure which may fail on multiple steps, but should give you a hint on how to get it transfered.

    If you prefer, just transfer groups / users / passwords and recreate the omv config.

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • so first create symlinks on omv5, then update the docker-compose files from portainer? ... also how can i export scheduled jobs? or crontab -e and i can copy it to txt document?


    EDIT: for the shared folders and samba shares should i use symlinks? or direct path? What is the best practice?


    for instance appdata folder is direct path and whoogle is symlink path...

    omv 6.0 in proxmox 7.1-10 - AMD Ryzen 1700 - 48GB DDR4 :thumbup:

    Edited 2 times, last by Mio ().

  • All config you do in the UI are saved in the omv "database" which ist /etc/openmediavault/config.xml. Once you get that to the new install and make it work everything is migrated consistently. To change from by-labe to by-uuid you have to manually edit the config.xml on the new VM.


    Only care for the dockers, as their configs are not recreated.

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • Zoki - migration to OMV6 looks successful. All docker applications running and working correctly. Samba shares are accessible. I manually recreated the Shared folders again, after i mounted all the disks and also the same i did with the samba shared folders. thank you for hints and helping me out.


    PS: i didnt touch the xml config file, i made the users from scratch and i had no groups on my old OMV5.

    omv 6.0 in proxmox 7.1-10 - AMD Ryzen 1700 - 48GB DDR4 :thumbup:

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!