Migrating a jail
Thick iocage jails can be safely migrated between FreeBSD hosts using ZFS Send/Recv over SSH.
In the following example:
- src$ is the original host
- dst$ is the destination host
- ‘myapp’ is the name of my jail to migrate
- Everything is done with root privileges
Stopping processes
Stop the jail and any other ZFS replication processes.
src$ iocage stop myapp
src$ service zrepl stop
dst$ service zrepl stop
Create a snapshot
src$ zfs snapshot -r zroot/iocage/jails/myapp@migration
Send the snapshot
src$ zfs send -R zroot/iocage/jails/myapp@migration | ssh root@dst 'zfs recv -F -v zroot/iocage/jails/myapp'
Testing
Check that the jail exists and that it can be started.
dst$ iocage list
dst$ iocage start myapp