Move Jail directory?

Status
Not open for further replies.

Chris230291

Patron
Joined
Mar 21, 2012
Messages
300
Hello. At the moment I have my Jails in a dataset on my main Raid. If I wanted to move the entire Jail folder (with Jails inside it) to a separate non-Raid drive, would that be as simple as duplicating the contents to the new drive and updating the "Jail Root" path in Jails/configuration? Would this break anything?

Any input is appreciated,
Chris.
 

Yatti420

Wizard
Joined
Aug 12, 2012
Messages
1,437

Chris230291

Patron
Joined
Mar 21, 2012
Messages
300
No.. You must change the jail root and reinstall from scratch.. There is another more complicated method.. Please search forums :)

http://forums.freenas.org/index.php?threads/relocate-jails-to-ssd-helping-hdd-sleep.16955/


OK thanks Yatti420.

Is this the complicated method I can try...

Steps:
  1. Turn off all plugins (Plugins->Installed)
  2. Stop all jails (Jails->View Jails)
  3. Run these commands via CLI:
    zfs snapshot -r main_pool/jails@relocate
    zfs send -R main_pool/jails@relocate | zfs receive -v ssd_pool/jails
    zfs get -rH -o name -s received mountpoint ssd_pool/jails | xargs -I {} sh -c "zfs set mountpoint=/{} {}; zfs mount {};"
  4. Change the Jail Root to /mnt/ssd_pool/jails (Jails->Configuration)
  5. Start jails/plugins
  6. Check that everything works and destroy the original jails dataset (main_pool/jails)

Thanks,
Chris.
 

Yatti420

Wizard
Joined
Aug 12, 2012
Messages
1,437
Just for the record I didn't use that method.. I just changed my jail root and restarted from scratch.. I have 5-6 jails for various purposes at the moment.. Took about 30 minutes total including editing syslog settings for jails etc..
 

Chris230291

Patron
Joined
Mar 21, 2012
Messages
300
Ok thanks. I think I'll try the method I posted first, if that fails I will just have to start fresh.

Cheers,
Chris
 

kjp4756

Contributor
Joined
Feb 11, 2014
Messages
102
The method posted above works fine. I've done it several times in testing. Not a single issue.

In my scenario I was moving from a 2 drive mirror to a 4 drive raid-z2. I wanted to take 1 drive from the mirror and create an array with the 1 removed mirror drive and 2 new drives then add the other drive from the mirror after the data was moved. I used zfs snapshots to achieve this. The only thing I did differently to the method above was I didn't change the name of my pool. I removed the old one then re-imported the new pool with the same name as the old one. It all worked fine.
 
Status
Not open for further replies.
Top