Migrate from QCOW2 to ZFS with snapshots

Discussion in 'Proxmox VE: Installation and configuration' started by Bruno Meneguello, May 18, 2019 at 03:04.

  1. Bruno Meneguello

    Bruno Meneguello New Member

    Joined:
    Apr 26, 2019
    Messages:
    3
    Likes Received:
    0
    I think it's not possible, but as last resort I need to ask: does anyone know if it's possible to migrate a QCOW2 volume to a ZFS volume while preserving snapshots? Even if this must be done outside PVE environment.
     
  2. LnxBil

    LnxBil Well-Known Member

    Joined:
    Feb 21, 2015
    Messages:
    3,632
    Likes Received:
    326
    Yes, I know. You may also like to know the answer, do you :p

    There is one catch: the history in the QCOW2 file must be linear, otherwise it does not work properly. You also have to keep in mind that you cannot switch between snapshots in ZFS as you can in QCOW2, therefore QCOW2's snapshots are more capable than then ZFS ones with respect to virtualisation.

    Idea is like this:
    - go to the oldest snapshot in your QCOW2, mount it via qemu-nbd
    - copy the block device to your ZFS zvol, dd is fine as a test (*)
    - snapshot your ZFS
    - unmount your QCOW2 and go to the next snapshot

    I hope that helps and gives you enough to create a working example.

    (*) You should write your own block-based copy program that omits already present blocks from overwriting, because this is a new write on ZFS and needs space. If you only copy blocks that are different, you can have a 'copy-on-write' kinda snapshot that really only holds changed data.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice