A backup of your FreeNAS jails is important given the time and effort spend on setting up, customizing and configuring these jails. We can use IOCAGE to complete a backup of your jails. This article will show you how to simplistically export and backup your jails and also how to create a script which would automatically perform all the necessary steps for exporting and backing up your jail. We will setup an automatic cron job in the FreeNAS WebUI which can run on predefined schedule and at a time which is acceptable for the jails to be stopped, allowing you to set and forget you jail backup implementation. This article will also quickly show you how to migrate your jail between different ZFS pools and show you how to rename your pools. An export and rename is really nice if you want to not remove your jails from the ‘Plug-ins’ tab in the FreeNAS WebUI and if you want to have them called something more descriptive than ‘Plex’. So, lets get started.
This article is part of my series of FreeNas setup, configuration and install articles.
An updated version of this article is posted on the NEW digiMoot website at:
FreeNAS: Backup Jails Automatically Using IOCAGE Import and Export
Great information, thanks.
LikeLike
Great information, appreciated and thanks
LikeLike
Thanks for you blog post. It gave me the inspiration to add to your script. Mine will automatically backup all the iocage jails and restore an individual jail. https://github.com/NasKar2/freenas-iocage-jail-backup.git
LikeLike
Great addition mate. Thanks!
LikeLike
This is great! Thank you.
Nonetheless, I have two questions.
1. I want to run this as a scheduled task, and it would make sense to not backup a jail that hasn’t changed since the last backup. So my script would have to test to see if a jail has changed since the last backup. Is there a way to do this?
2. In addition to this script, which makes a local backup, I use the Duplicati plugin to backup components of my system off-site. Duplicati resides in its own jail and has its own scheduler to control when it does backups. Since the script has to stop each jail, I need to know if Duplicati is in the middle of a backup job and delay stopping its jail until the job is finished. What’s the best way to test if a program within a jail is running? (a script with ps & grep? — where would this have to be to run properly?)
LikeLike