Creating jails and simply copying them

Hello,

I have just performed a:-

Code:
# cd /usr/src
# make buildworld
# make installworld DESTDIR=/usr/jails/john
# make distribution DESTDIR=/usr/jails/john

Is it possible to simply copy /usr/jails/john to /usr/jails/sally or do I need to use the make installworld and make distribution to do it?

Can I simply tar.gz up the /usr/jails/john directory or does it contain hardcoded links?

The issue is that I need to create some jails on many machines and would like to avoid the compilation on each of the machines.

Best Regards,
 
Get sysutils/cpdup and then:
[CMD=]cpdup /usr/jails/john to /usr/jails/sally[/CMD]

I recommend creating a template though in /usr/jails and [CMD=]cpdup /usr/jails/template /usr/jails/newjail[/CMD] instead of copying from an existing jail.
 
Ah brilliant,

I was worried I was going to need to copy a prebuilt /usr/src directory around just to execute make install on each client.

Thanks!
 
kpedersen said:
I was worried I was going to need to copy a prebuilt /usr/src directory around just to execute make install on each client.
You don't need to copy anything at all. Make use of nullfs(4).

When you are running ZFS creating jails is even easier. Just install in a clean directory, make a snapshot and clone the snapshot as many times as you need :e
 
I use ZFS snapshots and nullfs mounts. There's an article in the handbook (http://www.freebsd.org/doc/handbook/jails-application.html) mentioning using nullfs to have a shared root, with only a few directories not being shared (/etc, /root, /usr/local, /var, /tmp, and /home.)

Using nullfs means you don't waste the space of having the same shareable portion of the system occupying 20 different directories, and means that you don't have to run installworld on each of your jails when upgrading the system. Using snapshots for the unshared portion makes those more space efficient as well by using the shareable portions while not being so rigid that you cannot change them. That's not as big a gain though unless you plan to have several jails with all the same software running in them and already installed.
 
It should also be possible to use mount_unionfs(8). With that you can make a read-only copy of a basic system and overlay it with a writeable filesystem. The writeble filesystem will store the changes you make.

I've never tried it though.
 
Back
Top