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