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.
vince@src$
iocage stop myapp
service zrepl stop
vince@dst$
service zrepl stop
Create a snapshot
vince@src$
zfs snapshot -r zroot/iocage/jails/myapp@migration
Send the snapshot
vince@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.
vince@dst$
iocage list
iocage start myapp
service zrepl start