How to move iocage jails from one ZFS pool to another?

What is the process to move iocage and all its jails from one ZFS pool to another?

I've tried the process from this post: https://www.ixsystems.com/community/threads/how-to-move-jails-between-pools.72593/post-502840

i.e. iocage export each jail, activate the new pool, then iocage import. That isn't successful:

$ iocage start syncthing
No default gateway found for ipv6.
* Starting syncthing
  + Started OK
  + Using devfs_ruleset: 6
  + Configuring VNET FAILED
  jexec: execvp: ifconfig: No such file or directory
  jexec: execvp: ifconfig: No such file or directory

Stopped syncthing due to VNET failure

FreeNAS 11.3


Solution 1:

To move iocage from /mnt/OLD/iocage to /mnt/NEW/iocage:

Export jails

iocage stop JAILNAME
iocage export JAILNAME

This creates a dated .zip of the jail in /mnt/OLD/iocage/images.

Set up new pool

Use the FreeNAS jails GUI or iocage activate /mnt/NEW to activate iocage on the new pool. Ensure that the new activation has the iocage release(s) used by your jails. Use iocage fetch to install them. See each jail's fstab to see which release it expects.

Import jails

Copy the exported jail .zips to where iocage will look for them:

cp /mnt/OLD/iocage/images/* /mnt/NEW/iocage/images

Import:

iocage import JAILNAME

Note it's the jail name, not the filename of the zip.

Fix mountpoints and fstab

Any mount points in the jail, particularly the ones provided by iocage, will point at /mnt/OLD and cause the jail to not start with the VNET error in the question. These have to be manually fixed.

Edit /mnt/NEW/iocage/jails/JAILNAME/fstab and replace instances of /mnt/OLD with /mnt/NEW as appropriate. For simple jails :%s/OLD/NEW/g in vi will do the trick.

For example, the first three lines of the fstab created by the Syncthing plugin looks like this:

/mnt/OLD/iocage/releases/11.3-RELEASE/root/bin  /mnt/OLD/iocage/jails/syncthing/root/bin    nullfs  ro  0   0 # Added by iocage on 2020-04-17 00:16:34
/mnt/OLD/iocage/releases/11.3-RELEASE/root/boot /mnt/OLD/iocage/jails/syncthing/root/boot   nullfs  ro  0   0 # Added by iocage on 2020-04-17 00:16:35
/mnt/OLD/iocage/releases/11.3-RELEASE/root/lib  /mnt/OLD/iocage/jails/syncthing/root/lib    nullfs  ro  0   0 # Added by iocage on 2020-04-17 00:16:35

Each /mnt/OLD needs to be replaced with /mnt/NEW.

Done

iocage start JAILNAME