What is the best way to backup/restore an iocage jail?


#1

I just installed iocage via pkg install py36-iocage and made a test jail. I would like to backup that jail, and then restore it on a different computer. Is that possible?.. If it is, what would be the best way to go about doing that?


#2

iocage export UUID | NAME

Exports the specified jail. An archive file is created in
/iocage/images with an SHA256 checksum. The jail must be
stopped before exporting.

               Example:

                     # iocage export examplejail_2

iocage import UUID | NAME

Import a specific jail image. Short UUIDs can be used, but
do not specify the full filename, only the UUID.

EDIT: only the UUID <-- This is incorrect
You can specify iocage jail name to import

               Example:

                     # iocage import 064c247  <-- incorrect

               Example:

                     # iocage import myjail <-- this works fine

#3

I think that the man page for iocage doesn’t reflect changes in py36-iocage version.

Secondly, my experiments with exporting/importing jails with py36-iocage were done within existing iocage ZFS data set. I don’t know how the iocage import would behave if you transfer the exported iocage jail’s zip file to another system that also runs py36-iocage.


#4

Luckily it’s a test jail… After testing, I want to move that jail to a production server, and would also like to have a recovery plan, in case I need to move it to another server if/when this one fails.
Thank you for all the help and the tips to get me started in the right direction @ichibiri , I will start experimenting with this.


#5

I tried it yesterday, and it worked fine when transferred to another (TrueOS) system. It even makes the datasets for the jail, the only problem is that the datasets it makes are blank… I thought I could just import jail, and it would bring all the information with it apparently I was wrong. I had to import the jail, delete the empty dataset it made, and, then zfs receive to the host computer, then all my data was back in the jail.