qwertymodo
Contributor
- Joined
- Apr 7, 2014
- Messages
- 144
Really, the only reason I can think of for renaming a jail is because the plugin system tends to give its jails really stupid names like customplugin_1, which makes it hard to remember which jail corresponds to which plugin. If you're creating your own jails, you can name them whatever you like, so this shouldn't be necessary.
To be clear, I have done this multiple times, and it has worked every time, but that is no guarantee it will work for you, so back up your data, and proceed at your own peril.
To quote cyberjock:
There, you've been warned.
Also, I've never attempted this on a jail with snapshots, always on a brand-new jail for a freshly installed plugin. If somebody wants to try finding the snapshots and figuring out how to rename them, please let me know and I'll add it here.
Ok, now on to business. First of all, stop the plugin from the WebGUI by selecting Plugins>Installed and clicking the switch from On to Off.
Next, stop the jail from the WebGUI by selecting Jails, clicking on the jail, and then clicking the stop button below the jails list.
Now, in the shell, you can rename the jail using zfs rename:
Note: the poolname does not include /mnt/ e.g. my jail was located at /mnt/vdev0/jails/customplugin_1 so I used
This assumes you're using the default jails location. If not, you'll have to adjust the path.
Next, rename the jail metadata folder, which is located in the jails root folder.
Note the '.' at the beginning of the folder name
Now, change the hostname in following locations
<jailroot>/.<newjailname>.meta/host
<jailroot>/<newjailname>/etc/rc.conf
<jailroot>/<newjailname>/etc/hosts (change both places in this file)
Finally, update the FreeNAS database:
Note: don't forget the semicolons.
Now you can go back and start the jail and the plugin, in that order, and it should all be working.
If you have configured any mount points in your jail via the Jails>Add Storage, you'll need to re-add them.
To be clear, I have done this multiple times, and it has worked every time, but that is no guarantee it will work for you, so back up your data, and proceed at your own peril.
To quote cyberjock:
Not supported dingbat!
There, you've been warned.
Also, I've never attempted this on a jail with snapshots, always on a brand-new jail for a freshly installed plugin. If somebody wants to try finding the snapshots and figuring out how to rename them, please let me know and I'll add it here.
Ok, now on to business. First of all, stop the plugin from the WebGUI by selecting Plugins>Installed and clicking the switch from On to Off.
Next, stop the jail from the WebGUI by selecting Jails, clicking on the jail, and then clicking the stop button below the jails list.
Now, in the shell, you can rename the jail using zfs rename:
Code:
zfs rename <poolname>/jails/<oldjailname> <poolname>/jails/<newjailname>
Note: the poolname does not include /mnt/ e.g. my jail was located at /mnt/vdev0/jails/customplugin_1 so I used
Code:
zfs rename vdev0/jails/customplugin_1 vdev0/jails/newjailname
This assumes you're using the default jails location. If not, you'll have to adjust the path.
Next, rename the jail metadata folder, which is located in the jails root folder.
Code:
mv /mnt/<poolname>/jails/.<oldjailname>.meta /mnt/<poolname>/jails/.<newjailname>.meta
Note the '.' at the beginning of the folder name
Now, change the hostname in following locations
<jailroot>/.<newjailname>.meta/host
<jailroot>/<newjailname>/etc/rc.conf
<jailroot>/<newjailname>/etc/hosts (change both places in this file)
Finally, update the FreeNAS database:
Code:
sqlite3 /data/freenas-v1.db sqlite>update plugins_plugins set plugin_jail='newjailname' where plugin_jail='oldjailname'; sqlite>.q;
Note: don't forget the semicolons.
Now you can go back and start the jail and the plugin, in that order, and it should all be working.
If you have configured any mount points in your jail via the Jails>Add Storage, you'll need to re-add them.