iocage jail and storage

Status
Not open for further replies.
D

dlavigne

Guest
I don't think the new UI is there yet, but it is supposed to be for 11.2 (due out late February).
 
Joined
Jul 10, 2016
Messages
521
Even though the UI functionality isn't ready yet, you can add storage using the command line.

Code:
[root@freenas ~]# iocage fstab --help																							  
Usage: iocage fstab [OPTIONS] JAIL [FSTAB_STRING]...																				
																																  
  Manipulate the specified jails fstab.																							
																																  
Options:																															
  -a, --add		   Adds an entry to the jails fstab and mounts it.															  
  -r, --remove		Removes an entry from the jails fstab and unmounts it.														
  -e, --edit		  Opens up the fstab file in your environments EDITOR.														
  -R, --replace TEXT  Replace an entry by index number																			
  -l, --list		  Lists the jails fstab.																						
  -h, -H, --header	For scripting, use tabs for separators.																	  
  --help			  Show this message and exit.


Example: iocage fstab -a myjail "/mnt/tank/source/folder /destination/folder/in/jail nullfs rw 0 0"
 

Ismael Duarte

Contributor
Joined
Jun 13, 2011
Messages
154
Even though the UI functionality isn't ready yet, you can add storage using the command line.

Code:
[root@freenas ~]# iocage fstab --help																							 
Usage: iocage fstab [OPTIONS] JAIL [FSTAB_STRING]...																				
																																 
  Manipulate the specified jails fstab.																							
																																 
Options:																															
  -a, --add		   Adds an entry to the jails fstab and mounts it.															 
  -r, --remove		Removes an entry from the jails fstab and unmounts it.														
  -e, --edit		  Opens up the fstab file in your environments EDITOR.														
  -R, --replace TEXT  Replace an entry by index number																			
  -l, --list		  Lists the jails fstab.																						
  -h, -H, --header	For scripting, use tabs for separators.																	 
  --help			  Show this message and exit.


Example: iocage fstab -a myjail "/mnt/tank/source/folder /destination/folder/in/jail nullfs rw 0 0"


it works!!!
Tank you
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
It should also be a safe solution, since the GUI is just interacting with iocage.
 

Ismael Duarte

Contributor
Joined
Jun 13, 2011
Messages
154
One more question, please.
I've two tanks. iocage is mounted in the wrong tank, for me.
Is there any way to move it? Even if I must loose everything on it.
Thank you
 
Joined
Jul 10, 2016
Messages
521
You can run iocage fstab -l myjail from the command line.
That should give you a list of all the "storage" you've mapped to your jail before, preceded by a column "index" number.
Use that index number to remove the incorrect entry, like this: iocage fstab -r myjail index

Then just add the correct storage/folder as you did before: iocage fstab -a myjail "/mnt/tank/corrected/folder /destination/folder/in/jail nullfs rw 0 0"
 

Ismael Duarte

Contributor
Joined
Jun 13, 2011
Messages
154
I think I wasn't clear.
I've two tanks
/mnt/DISCO and /mnt/PLUGIN
iocage
folder is inside /mnt/DISCO and I want it in /mnt/PLUGIN
How can I do that? I didn't choose to be in /mnt/DISCO, just appeared there.

Thank you
 

scrappy

Patron
Joined
Mar 16, 2017
Messages
347
I've two tanks
I believe what you mean is that you have two zpools. Tank is just a generic name for a zpool. Your zpools are named PLUGIN and DISCO.

How can I do that? I didn't choose to be in /mnt/DISCO, just appeared there.
I assume what you are referring to is activating iocage on a particular zpool. In your case, that can be accomplished by issuing # iocage activate PLUGIN (PLUGIN being the zpool you wish for iocage jails to reside on.) I don't personally have the experience of migrating iocage to a different zpool, I would imagine you could do so with the ZFS send/recv function. Hopefully somebody else here can chime in on migrating iocage to a different zpool without destroying anything. Otherwise you can just nuke everything on iocage with # iocage clean -a then reactivate iocage on the zpool of your choice.
 
Joined
Jul 10, 2016
Messages
521
Normally, the first step you do when you plan on creating iocage jails, is the run the activate command. This lets you indicate what pool you want to use to store/mount all iocage-related datasets. You can switch to another pool, in your case running iocage activate PLUGIN
Note that this will not move the datasets, fetched release, jails, etc... you already created in your DISCO pool, but anything you do from this point on, will go in the PLUGIN pool.

You either need to recreate the jails, or as scrappy indicated ZFS send/receive might work.
 
Status
Not open for further replies.
Top