Boot OMV4 on a physical disk in a kvm guest

  • Hi,


    was away for a long time and didn’t have the time for omv. I am still using omv4.


    I am in a stuck situation because of my home automation software (FHEM). I installed a lot of custom FHEM modules via apt/curl/npm/git.


    Now I want to get out of this situation and am thinking about how to proceed.


    OMV now has a KVM module. Great! With this I can go the route without Proxmox now.


    I will not be able to do the migration in one step, so I have the following idea:

    1. Install omv6 to a new SSD
    2. Install omv-extras and openmediavault-kvm
    3. Passthrough the old SSD with my omv4 installation to a newly generated kvm guest on omv6 and boot it
    4. Migrate service after service from my old omv4 installation to a new docker container or an own kvm guest

    What do you think about it? Is this a possible and working way? Any idea, what I have to do to get step 3. working?


    Thanks Hoppel

    ----------------------------------------------------------------------------------
    openmediavault 6 | proxmox kernel | zfs | docker | kvm
    supermicro x11ssh-ctf | xeon E3-1240L-v5 | 64gb ecc | 8x10tb wd red | digital devices max s8
    ---------------------------------------------------------------------------------------------------------------------------------------

  • I have never tried this, but qemu, which installed as part of KVM, is supposed to be able to virtualize a physical disk. Might save you some hassle.


    The command is like this replacing the disk names and path as required.:

    qemu-img convert -o qcow2 /dev/<sda> /path/to/vm/location/<disk_name>.qcow2

  • Thanks for this hint.


    I googled your command and found the following thread:


    [solved] Migrating physical drive to QEMU image / partition of another drive
    I have been using an old, beat up HDD for my virtualized machine, which I pass to QEMU with the option -drive file=/dev/sda,format=raw. I just got a new HDD…
    forum.level1techs.com


    The first answer acknowledges what you wrote. Seemingly it’s that easy to convert a physical disk to a qcow2 file.


    But the opening post of that thread describes what I planned to do and see the following:

    Code
    -drive file=/dev/sda,format=raw

    Is this configurable in the openmediavault-kvm gui? What do you think about it?


    I don’t have openmediavault6 installed at the moment. I will do that the next days.


    Thanks again

    ----------------------------------------------------------------------------------
    openmediavault 6 | proxmox kernel | zfs | docker | kvm
    supermicro x11ssh-ctf | xeon E3-1240L-v5 | 64gb ecc | 8x10tb wd red | digital devices max s8
    ---------------------------------------------------------------------------------------------------------------------------------------

    Einmal editiert, zuletzt von hoppel118 ()

    • Offizieller Beitrag

    But the opening post of that thread describes what I planned to do and see the following:
    Code -drive file=/dev/sda,format=raw

    This is passing through the disk. While possible, I would image the disk. You can use qemu-img or dd (same as raw) to image the drive.

    Is this configurable in the openmediavault-kvm gui?

    No. Does you OMV4 system only have one drive? I think doing a p2v move is going to be messy if you have lots of drives.

    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!

  • Hi BernH


    so I installed openmediavault6 on a new disk, updated the system to the latest and greatest, installed omv-extras and executed the command you named. There was one little issue with the argument -o. It needs to be -O.


    Code
    @omv6:/data# qemu-img convert -o qcow2 /dev/sda /data/vms/omv4.qcow2
    qemu-img: Invalid parameter 'qcow2'
    
    @omv6:/data# qemu-img convert -O qcow2 /dev/sda /data/vms/omv4.qcow2


    Now I have the following file:


    Code
    @omv6:~# du -h /data/vms/omv4.qcow2
    124G    /data/vms/omv4.qcow2


    Any idea about the ideal vm configuration?


    Thank you so much!


    Hoppel

    ----------------------------------------------------------------------------------
    openmediavault 6 | proxmox kernel | zfs | docker | kvm
    supermicro x11ssh-ctf | xeon E3-1240L-v5 | 64gb ecc | 8x10tb wd red | digital devices max s8
    ---------------------------------------------------------------------------------------------------------------------------------------

    • Offizieller Beitrag

    Any idea about the ideal vm configuration?

    OMV is Linux and it can handle any kvm config. So, the default will work. You should read the kvm guide.

  • No. Does you OMV4 system only have one drive? I think doing a p2v move is going to be messy if you have lots of drives.

    I am short before going to bed… ;)


    No, it has a bunch of drives (8x WD Red 10TB Raid-Z2). But I don’t want to passthrough the disks at the moment.


    I am going to do it the following way on the new omv6 machine:

    1. install the proxmox kernel
    2. install openmediavault-zfs
    3. import the zfs pool / filesystems
    4. configure the nfs and smb shares
    5. configure the users and groups
    6. install and configure portainer (Do we have a better tool nowadays?)
    7. configure my docker containers (maybe via backups or completely new)
    8. create a omv4 vm, where only FHEM and it’s different modules and Homebridge services run (have to deactivate smb/nfs/docker/zfs to not confuse the system)
    9. when I find the time, migrate FHEM to a new structure

    What do you think about it?


    Thanks Hoppel

    ----------------------------------------------------------------------------------
    openmediavault 6 | proxmox kernel | zfs | docker | kvm
    supermicro x11ssh-ctf | xeon E3-1240L-v5 | 64gb ecc | 8x10tb wd red | digital devices max s8
    ---------------------------------------------------------------------------------------------------------------------------------------

  • OMV is Linux and it can handle any kvm config. So, the default will work. You should read the kvm guide.

    I am not completely new to kvm/lxc, but I never migrated p2v. That’s the reason why I asked for ideal vm settings.


    Played a bit with proxmox in the past. But my main usecase is not the virtualization, it’s a network attached storage.


    With your omv-kvm we have kvm and lxc now. No need for proxmox anymore (at least it seems so)… 😃


    Thank you so much. I keep you updated.


    Hoppel

    ----------------------------------------------------------------------------------
    openmediavault 6 | proxmox kernel | zfs | docker | kvm
    supermicro x11ssh-ctf | xeon E3-1240L-v5 | 64gb ecc | 8x10tb wd red | digital devices max s8
    ---------------------------------------------------------------------------------------------------------------------------------------

    • Offizieller Beitrag

    install and configure portainer (Do we have a better tool nowadays?)

    portainer is a great tool but has more options than most need. I wrote the compose plugin if you just use docker-compose files. It also allows you to create docker images from dockerfiles.

    That’s the reason why I asked for ideal vm settings.

    When you create a VM, it defaults to the ideal settings. This may or may not work with a p2v image. Linux stands a much better chance than Windows.


    With your omv-kvm we have kvm and lxc now. No need for proxmox anymore (at least it seems so)

    That is the idea and the reason I wrote it. I switched away from proxmox because of the plugin.

  • OK, I got it. It works.


    My procedure was as follows:

    1. installed omv6 to new ssd
    2. installed the proxmox kernel
    3. installed openmediavault-zfs
    4. imported my zfs pool / filesystems
    5. configured the users and groups with the same ids as before
    6. configured the nfs and smb shares
    7. configured portainer
    8. migrated my docker containers (via backups)
    9. installed openmediavault-kvm
    10. configured the pools for vms and isos
    11. created a new omv4 vm (downloadeded an old omv4.iso image and configured it completely) -> name and format: omv4.qcow2
    12. converted my physical omv4 to virtual via qemu-img convert -O qcow2 /dev/sda /data/vms/omv4.qcow2 -> same name and format: omv4.qcow2
    13. exchanged the omv4.qcow2 files
    14. deactivate smb/nfs/docker/zfs in the vm
    15. configured the new network interface via noVNC
    16. passed through a homematic usb stick to the vm
    17. Thats it! :D

    Sounds easy, but took me round about 12 hours.


    ryecoaaron Thanks for the following things:

    • the integration of portainer. This was a really smooth migration of my docker containers, even though i just liked the good old omv-docker plugin. ;)
    • the development of the kvm plugin. Now I really don't need the oversized Proxmox anymore. Even LXC is possible. WOW!!!
    • thanks for the development of omv-zfs and providing the proxmox kernel in an easy way. This is the base of all for me.

    votdev and ryecoaaron Thanks for the hard work you investigated over the years. Everything looks and feels really good now. I wish you a Merry Christmas and a happy new year.

    ----------------------------------------------------------------------------------
    openmediavault 6 | proxmox kernel | zfs | docker | kvm
    supermicro x11ssh-ctf | xeon E3-1240L-v5 | 64gb ecc | 8x10tb wd red | digital devices max s8
    ---------------------------------------------------------------------------------------------------------------------------------------

    • Offizieller Beitrag

    exchanged the omv4.qcow2 files

    You can select an existing disk mage when creating a new VM.

    the integration of portainer. This was a really smooth migration of my docker containers, even though i just liked the good old omv-docker plugin.

    I wrote the compose plugin to replace portainer for a lot of people with a native omv interface. The old docker plugin was not useful when you needed multiple containers to work together (very common nowadays). docker-compose does so much and a lot of people are just using portainer for stacks anyway.

    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!

  • hoppel118

    Hat das Label gelöst hinzugefügt.
  • hoppel118

    Hat das Label OMV 6.x hinzugefügt.

Jetzt mitmachen!

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