Migrate Jail from one ZFS volume to another

Status
Not open for further replies.

gzunk

Dabbler
Joined
Jun 23, 2013
Messages
17
Is there an easy way of migrating a jail from one ZFS volume to another? I have two volumes set up on my FreeNAS box and I want to recreate the one that the jails are hosted on, but I don't want to have to reinstall / reconfigure all the jails (I have 5 for various network services).

I was thinking about creating a ZFS snapshot of the jail, then restoring that snapshot on the second volume. Am I on the right track? Is there an easier way? Is it impossible? All advice accepted! thanks.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Not "easily".

If you do a zfs snapshot and replicate to the other pool and move the jail folder, then reboot, it supposedly works. I haven't tried to do this so it may or may not work.

There's a few other options like moving the jails and hacking the config file and stuff like that. But nothing particularly easy.
 

pschatz100

Guru
Joined
Mar 30, 2014
Messages
1,184
@cyberjock
I have the same question, and "Not easily" is not the answer I was hoping for!!

Originally, when I installed Freenas, I created the jail on an 8GB thumbdrive. At the time, I planned to sleep my drives when not in use so I put the jail on a separate device. Now, 1) I have changed my data strategy and no longer sleep my drives, and 2) the thumbdrive is running out of space.

I'd like to move the jail to an existing mirrored volume. As a worst case, I can recreate the jails - everything is backed up - but it would be a lot more convenient if there was a way to move them.

Thanks.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Yeah, there's been some tickets put in for "migrating" and/or "importing" but iX doesn't want to deal with that kind of thing. It's something that, for all intents and purposes, is something you do when you haven't really planned ahead. They're right, but that doesn't make the feature "less useful". On the flipside FreeNAS is open source and I'd bet if someone actually coded it up and did a pull request to the master branch on git it would probably be accepted with open arms.
 

pschatz100

Guru
Joined
Mar 30, 2014
Messages
1,184
I would say that using more plugins drove my need for jails with greater capacity. I'm not certain I could have planned any better when I first built my system - because what I do on the server has changed.

I spent some time studying up on replicating snapshots to new pools and hacking the config file. At the end of the day, I thought it might be an interesting exercise to make an attempt to do everything through the GUI.

After running a new backup (including the jails), I deleted the jails on the old thumb drive and recreated them on another volume. All of this was done from the GUI, and it all worked without a problem. Then, I copied data from my backups back into the new jails - this was done from the CLI as there is no utility in the GUI for selectively copying files.

The whole process took a little less than an hour and I'm happy with the result. I actually spent more time evaluating alternative approaches than what it took to do the job.
 
Last edited:

rumdr19

Dabbler
Joined
Jan 18, 2015
Messages
28
My situation is a bit different, I think. I need to copy just one folder with various sub-folders and files from one jail to another. In my case both jails are under the same pool. I would like the folder to keep its structure and permissions.

So for example:

copy
Code:
jail1# /usr/folder1


to
Code:
jail2# /usr/folder1


Any ideas?
 
Status
Not open for further replies.
Top