Solved [Solved] ZFS filesystem and jail

Hello all,

I have 3 jails and I wonder what is the correct way to create separated filesystem.

I want to put the MySQL databases (stored in DBjail/var/db/mysql/) and the webfiles (stored in webjail/usr/local/www) on their own filesystem to make it easier to move/copy/snapshot etc. independently of the operating system.

The jail dataset was created doing zfs create -o mountpoint=/local/jails zroot/jails; then each jail are created on their own ZFS dataset as per the /usr/local/etc/ezjail.conf file
Code:
ezjail_jaildir=/local/jails
ezjail_sourcetree=/usr/src
ezjail_use_zfs="YES"
ezjail_use_zfs_for_jails="YES"
ezjail_jailzfs="zroot/jails"
ezjail_zfs_properties="-o compression=lz4 -o atime=off"
ezjail_zfs_jail_properties="-o dedup=on"
This is my current zfs list
Code:
root@FreeBSD:~ # zfs list
NAME                                     USED  AVAIL  REFER  MOUNTPOINT
zroot                                   16.9G   251G  6.43G  /zroot
zroot@clean                             2.44G      -  4.47G  -
zroot@laggPatchApplied                   484M      -  6.32G  -
zroot@b4jailinstall.sh                  25.4M      -  6.36G  -
zroot/jails                             5.39G   251G   624K  /local/jails
zroot/jails/basejail                    4.04G   251G  4.04G  /local/jails/basejail
zroot/jails/basejail@20140731_13:54:29   156K      -   216K  -
zroot/jails/mailjail                     631M   251G   631M  /local/jails/mailjail
zroot/jails/webjail                      259M   251G   259M  /local/jails/webjail
zroot/jails/newjail                     6.42M   251G  6.42M  /local/jails/newjail
zroot/jails/DBjail                      477M   251G    477M  /local/jails/DBjail
zroot/swap                              1.03G  253G    108K  -
zroot/swap@clean                            0      -   108K  -
zroot/swap@laggPatchApplied                 0      -   108K  -
zroot/swap@b4jailinstall.sh                 0      -   108K  -
I know I need to create 2 mount points
zfs create -o mountpoint=/local/jails/DBJail/var/db/mysql zroot/jails/???
and
zfs create -o mountpoint=/local/jails/webjail/usr/local/www zroot/jails/???

Could you please help me in filling the ??? above.

Thank you in advance

Fred
 
Re: ZFS filesystem and jail

How about something like zroot/DATA/mysql and zroot/DATA/www?
 
Re: ZFS filesystem and jail

SirDice said:
How about something like zroot/DATA/mysql and zroot/DATA/www?

That sound fairly logical :)

Thank you @SirDice! I didn't realised that I can litterally give it any name is wanted.
 
Last edited by a moderator:
For my own servers I usually create a zroot/DATA to store any "dynamic" data like databases and websites. This also keeps them separate from the jails themselves, making them easier to move or copy to a different server. It's always a good idea to separate data from functionality.
 
Hi, I get the following error:
Code:
root@FreeBSD:~ # zfs create -o mountpoint=/local/jails/dbjail/var/db/mysql zroot/DATA/mysql
cannot create 'zroot/DATA/mysql': parent does not exist
Do I need to run
zfs create zroot/DATA
or
zfs create zroot/DATA/mysql
 
fred974 said:
Hi, I get the following error:
Code:
root@FreeBSD:~ # zfs create -o mountpoint=/local/jails/dbjail/var/db/mysql zroot/DATA/mysql
cannot create 'zroot/DATA/mysql': parent does not exist
Do I need to run
zfs create zroot/DATA
or
zfs create zroot/DATA/mysql

Just create an empty, not mounted, filesystem on zroot/DATA.
 
Back
Top