# Searching best practice: Webserver in jail with ZFS - separate data?



## pantos (Aug 26, 2018)

Reading a lot on different sites about webserver, jails and ZFS but after that I'm a little bit lost.

What's the best practice using jails with ZFS for a webserver? I understand that the jail should be in a separate dataset. Is it a good idea to put the website data in a separate dataset (e.g. for making snapshots)? Are there other details to consider?

I am very much looking forward to read your ideas!


----------



## SirDice (Aug 27, 2018)

pantos said:


> What's the best practice using jails with ZFS for a webserver?


Whatever works for you. Seriously, if you ask 10 maintainers you're probably going to get 10 different answers. The only thing I can suggest is try to create some sort of standard, so all your servers are identically configured, and document your decisions (why did you do it that way).


----------



## ShelLuser (Aug 27, 2018)

pantos said:


> What's the best practice using jails with ZFS for a webserver?


I'm in full agreement with SirDice here, with these things there really is no 'best'. Even so, I can understand how that doesn't really help you right now, so let's try to check some possible scenarios.



pantos said:


> I understand that the jail should be in a separate dataset.


Should it?  I mean; there are definitely advantages if you set it up this way, but when you're going to set up snapshots you'd be effectively making a snapshot of the entire OS. Is that really efficient if you consider that installing the OS itself basically only consists of extracting base.txz?

And even the use of the jail itself could be discussed. There are many advantages of using a jail, just like there can be quite a few disadvantages.

It's also possible to create a specific ZFS filesystem which contains all (or most) of your data which you then make available within your environment using nullfs mounts (loopback).

My suggestion would be to start experimenting with this stuff. There is plenty of software which can set all of this up for you out of the box but personally I'd suggest going over the chapter about Jails in the FreeBSD handbook and start setting something up manually. That way you'll get a good understanding of how this stuff works, which should also make it easier to determine what strategy would best suit your needs.

Another reason for doing it this way is that if you eventually do decide to use a pre-made solution and for some reason something doesn't work right with that program you probably wouldn't end up stuck with having it to do 'their' way, because you know how the whole thing works and can therefor also perform certain actions and tweaks manually.


----------



## abishai (Aug 27, 2018)

ShelLuser said:


> It's also possible to create a specific ZFS filesystem which contains all (or most) of your data which you then make available within your environment using nullfs mounts (loopback).


It's hard to maintain (update)


----------



## pantos (Sep 9, 2018)

Thanks for your advices. I see there are many ways and "best practice" depends on point of view.


ShelLuser said:


> My suggestion would be to start experimenting with this stuff.


That's my way to go now. Start building jails by hand and testing, what's the best practice for me!


----------

