Support #508
Migrating FreeNAS Jails
Description
- Table of contents
- UFS to UFS Jail Migration
- UFS to ZFS Jail Migration
- ZFS to ZFS Jail Migration
- Resources
I have been using FreeNAS in my production environment for a few years and one of the many useful features are the Jails. Along the way I added more drives and in more advanced configurations, like RAID1 and RAIDZ1. Unfortunately there are no helper scripts to assist in migrating jails from one location to another; depending on whether UFS or ZFS is used and whether the destination is local or remote will determine the methods available for migration.
UFS to UFS Jail Migration¶
This migration method uses the tried-and-true rsync tool.
Local to local¶
In this example I will be migrating the jails from /mnt/default
to /mnt/jails
.
- Begin by logging into the FreeNAS web panel and going to the Jails sections and turning of all jails
- Next open a Shell in the FreeNAS web panel
- Migrate the files to the new location:
rsync -avh -n /mnt/default /mnt/jails
- NOTE: Remove the -n to remove the dry-run option
- Now go to the Jails section again, then the Configuration tab.
- Change the Jail root from
/mnt/default
to/mnt/jails
- Reboot the FreeNAS
Local to remote¶
In this example I will be migrating the jails from the local /mnt/default
location to the /mnt/jails
remote location. In order for this to work the local root user's public key must be copied over to the remote root users SSH Public key field, otherwise the transfer will likely fail.
- Begin by logging into the local FreeNAS web panel and going to the Jails sections and turning of all jails
- Next open a Shell in the FreeNAS web panel
- Migrate the files to the new location:
rsync -avh -n /mnt/default -e ssh 192.168.0.2:/mnt/jails
- NOTE: Remove the -n to remove the dry-run option
- Now go to the Jails section on the remote FreeNAS, then the Configuration tab.
- Change the Jail root to
/mnt/jails
- Reboot the FreeNAS
UFS to ZFS Jail Migration¶
This migration method uses the rsync tool as well; however this method require a little more finesse since the entire jails folder cannot be transfered at once, but rather each jail individually migrated.
Local to local¶
In this example I will be migrating a single jail, node3, from /mnt/master
to /mnt/jails
.
- Begin by logging into the FreeNAS web panel and going to the Jails sections and turning of all jails
- Then go to the Storage section, select the jails zvol and then Create ZFS Dataset named node3
- Next open a Shell in the FreeNAS web panel
- Migrate the files to the new location:
rsync -avh -n /mnt/master/node3/ /mnt/jails/node3/ rsync -avh -n /mnt/master/.node3.meta /mnt/jails/
- NOTE: Remove the -n to remove the dry-run option
- NOTE: Make sure to copy over the .node3.meta or else FreeNAS will not see the jails metadata
- Now go to the Jails section again, then the Configuration tab.
- Change the Jail root from
/mnt/master
to/mnt/jails
- Reboot the FreeNAS
NOTE: Repeat for each individual jail
Local to remote¶
In this example I will be migrating a single jail, node3, from /mnt/master
to /mnt/jails
. In order for this to work the local root user's public key must be copied over to the remote root users SSH Public key field, otherwise the transfer will likely fail.
- Begin by logging into the local FreeNAS web panel and going to the Jails sections and turning of all jails
- Then go to the Storage section on the remote FreeNAS, select the jails zvol and then Create ZFS Dataset named node3
- Next open a Shell in the FreeNAS web panel
- Migrate the files to the new location:
rsync -avh -n /mnt/master/node3/ -e ssh 192.168.0.2:/mnt/jails/node3/ rsync -avh -n /mnt/master/.node3.meta -e ssh 192.168.0.2:/mnt/jails/
- NOTE: Remove the -n to remove the dry-run option
- NOTE: Make sure to copy over the .node3.meta or else FreeNAS will not see the jails metadata
- Now go to the Jails section on the remote FreeNAS, then the Configuration tab.
- Change the Jail root to
/mnt/jails
- Reboot the FreeNAS
ZFS to ZFS Jail Migration¶
This method uses the built-in ZFS send/receive function.
Local to local¶
In this example I will be migrating jails from /mnt/shared
to /mnt/jails
.
- Begin by logging into the FreeNAS web panel and going to the Jails sections and turning of all jails
- Go to the Storage section and select the shared zvol, then Create Snapshot named migrate
- Next open a Shell in the FreeNAS web panel
- Migrate the files to the new location:
zfs send shared@migrate | zfs receive jails
- NOTE: Remove the -n to remove the dry-run option
- Now go to the Jails section again, then the Configuration tab.
- Change the Jail root from
/mnt/shared
to/mnt/jails
- Reboot the FreeNAS
Local to remote¶
In this example I will be migrating jails from /mnt/shared
to /mnt/jails
. In order for this to work the local root user's public key must be copied over to the remote root users SSH Public key field, otherwise the transfer will likely fail.
- Begin by logging into the local FreeNAS web panel and going to the Jails sections and turning of all jails
- Go to the Storage section and select the shared zvol, then Create Snapshot named migrate
- Next open a Shell in the FreeNAS web panel
- Migrate the files to the new location:
zfs send shared@migrate | ssh -i /data/ssh/replication 192.168.0.2 zfs receive jails
- NOTE: Remove the -n to remove the dry-run option
- Now go to the Jails section on the remote FreeNAS, then the Configuration tab.
- Change the Jail root to
/mnt/jails
- Reboot the FreeNAS
Resources¶
Updated by Daniel Curtis about 10 years ago
- Description updated (diff)
- Status changed from New to Resolved
- % Done changed from 0 to 100
Updated by Daniel Curtis almost 10 years ago
- Category set to Jails / Containers
- Target version changed from 5 to FreeNAS 9.x