2020-10 upd: we reached the first fundraising goal and rented a server in Hetzner for development! Thank you for donating !
Attention! Current pages describe CBSD version 13.0.x. If you are using an older version, please update first.
Please note: these commands support the mask (wildcard) as a jname, for example: jname='*', jname='ja*l*'
Attention! I apologize for the automatic translation of this text. You can improve it by sending me a more correct version of the text or fix html pages via GITHUB repository.
Jail export
jexport command
% cbsd jexport
Description:
Attention: command execution allows on jail in status On. However it is necessary to remember (especially for jail with databases) when you import such jails, with a high probability it is possible to got problems with inconsistency filesystem in jails, old .pid files that can break work of the imported jails
Export jail into file (*.img). In jname arguments you can set jail for export. img-file stored in $workdir/export directory. Original jail after exports is not modified
You can control compress level via compress arguments
CBSD use xz(1), tools for compress images and you can learn in man page about compress diffrence between compress level.
By default CBSD use compress=6. You can disable compression with compress=0
Example (export mysqljail jail to $workdir/export/mysqljail.img):
% cbsd jexport jname=mysqljail
Exceptions for jexport
There are situations where you do not want to include one or another information from the container in the exported image. For example, if you are exporting a working container having a mounted port of ports in /usr/ports.
In this case, you can help the jexport_exclude parameter, which can be specified globally in the jexport.conf configuration file (just copy default jexport.conf from /usr/local/cbsd/etc/defaults/ to ~cbsd/etc/ and adjust the value for jexport_exclude
If you want to specify alternative exclude for a specific Jail, copy this file to the ~cbsd/jails-system/$jname/etc / directory. In this case, when you make an jexport call, these exceptions will be applied for $jname container only.
Finally, you can do exclude without a configuration file at all, just listing all exceptions (space separated) as the jexport_exclude= parameter when calling the jexport script, for example:
cbsd jexport jname=jail1 jexport_exclude="/var/run/* /usr/ports"
In this example, ports tree directory will not copy to image: since this data can always be mounted from the host. And also, eliminates the presence of dead .pid files that can affect the correctness of the launch of the container's services after importing.
Exceptions are indicated relative to the root directory of the container. So, if you want to migrate to another host jail1 container configuration using jexport/jimport and do not want to copy any of its data, simply specify / as an exception:
cbsd jexport jname=jail1 jexport_exclude="/"