Migrate jails to a new hard drive?

Status
Not open for further replies.

dub_c

Cadet
Joined
Dec 7, 2017
Messages
9
I have recently identified problems with one of the hard drives on my FreeNAS system. I am planning to replace that hard drive soon. I have noticed that my jails are located on the hard drive that will be replaced. I have two different kinds of jails - one that I created with iocage and one that I created by installing a plugin through the FreeNAS GUI.

Is there a way that the jails can be easily migrated or moved to a new drive since this drive will need to be replaced?

Thanks!
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Well, the simplest thing to do would be to just replace the drive through the GUI. When you do that, all the data will be resilvered onto the new drive, and then the old one will be dropped from the pool.
 

Alecmascot

Guru
Joined
Mar 18, 2014
Messages
1,177
This was posted ages ago :
Code:
Steps:

	Turn off all plugins (Plugins->Installed)
	Stop all jails (Jails->View Jails)
	Run these commands via CLI:[PANEL]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 {};"[/PANEL]
	Change the Jail Root to /mnt/ssd_pool/jails (Jails->Configuration)
	Start jails/plugins
	Check that everything works and destroy the original jails dataset (main_pool/jails)


This moves the complete jail root between pools.
 
Last edited:

dureal99d

Contributor
Joined
Aug 3, 2017
Messages
156
This was posted ages ago :
Code:
Steps:

	Turn off all plugins (Plugins->Installed)
	Stop all jails (Jails->View Jails)
	Run these commands via CLI:[PANEL]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 {};"[/PANEL]
	Change the Jail Root to /mnt/ssd_pool/jails (Jails->Configuration)
	Start jails/plugins
	Check that everything works and destroy the original jails dataset (main_pool/jails)


This moves the complete jail root between pools.
I assume the "main_pool/jails" part is your drive specific information.

for example if i have share0 and wanted to move to share 2 a proper command would be
zfs send -R share0/jails@relocate | zfs receive -v share2/jails
 

Alecmascot

Guru
Joined
Mar 18, 2014
Messages
1,177
Yes, the original was written to migrate to ssd.
 

Alecmascot

Guru
Joined
Mar 18, 2014
Messages
1,177
[PANEL] is not part of the command.
 

dureal99d

Contributor
Joined
Aug 3, 2017
Messages
156
[PANEL] is not part of the command.
So in this command i should leave the [panel] part off
zfs get -rH -o name -s received mountpoint ssd_pool/jails | xargs -I {} sh -c "zfs set mountpoint=/{} {}; zfs mount {};" excluding>>>>>[/PANEL]
 

dureal99d

Contributor
Joined
Aug 3, 2017
Messages
156
Ok followed the steps to migrate went pretty good however, i now cant get the jail set to change the root
 
Joined
Nov 25, 2018
Messages
1
This worked for me! As a novice at this FreeNas I think that the wonderful people in this forum that are the guru's need to remember that we ask these questions with little knowledge and an appetite to learn. So please add in more real world examples and edit out parts of command line entries that don't get typed in because we don't know the difference. Also, lastly. In examples you post please explain what parts are structured format of the operating system and what is to be changed to match our systems. Thanks again. I spent many hours researching how to move a jail from one pool to another without losing it and this forum helped to complete my task.
 
Status
Not open for further replies.
Top