I'm following the handbook instructions for nullfs thin jails here.
I'd like to mount additional directories in my jails like so:
But these mounts are particular to the jails, e.g. Jail2 doesn't want or need /host/B. So I don't want to define the mount points /a and /b in the base template. Esp as I will have many different types of jails, and they will each need different mount directories.
Is this possible? As I understand it, the mount points must exist inside the jail before the system will mount a directory to them. But it seems that 'mkdir -p /jails/nullfs/loadbalancer_lb_10_0_0_2/opt/config/caddy' (or 'mkdir -p /jails/containers/loadbalancer_lb_10_0_0_2/opt/config/caddy') is not sufficient or correct...
Here's an example jail conf that's failing:
/etc/jail.conf.d/loadbalancer_lb_10_0_0_2.jail
Errors
System
So the directories exist.
I've also tried the same thing but instead using the /jails/containers/loadbalancer_lb_10_0_0_2 directory instead of /jails/nullfs/loadbalancer_lb_10_0_0_2
I had everything working using fat jails, so I could always go back to that.
I'd like to mount additional directories in my jails like so:
Code:
Jail1 :
/host/A -> /a
Jail2 :
/host/A -> /a
/host/B -> /b
But these mounts are particular to the jails, e.g. Jail2 doesn't want or need /host/B. So I don't want to define the mount points /a and /b in the base template. Esp as I will have many different types of jails, and they will each need different mount directories.
Is this possible? As I understand it, the mount points must exist inside the jail before the system will mount a directory to them. But it seems that 'mkdir -p /jails/nullfs/loadbalancer_lb_10_0_0_2/opt/config/caddy' (or 'mkdir -p /jails/containers/loadbalancer_lb_10_0_0_2/opt/config/caddy') is not sufficient or correct...
Here's an example jail conf that's failing:
/etc/jail.conf.d/loadbalancer_lb_10_0_0_2.jail
Code:
loadbalancer_lb_10_0_0_2 {
# ----------------------------------------
# networking
# ----------------------------------------
$ipaddr = "10.0.0.2";
$gw = "10.0.0.1";
# ----------------------------------------
# thinjail mounts
# ----------------------------------------
mount += "/jails/templates/RELEASE-15.0-base /jails/nullfs/loadbalancer_lb_10_0_0_2 nullfs ro 0 0";
mount += "/jails/containers/loadbalancer_lb_10_0_0_2 /jails/nullfs/loadbalancer_lb_10_0_0_2/skeleton nullfs rw 0 0";
# ----------------------------------------
# jail specific mounts
# ----------------------------------------
# these are failing to mount. I've verified both source and target dirs exist. I have also tried creating these directories and
# mounting them from the /jails/containers directory. Those also failed to mount.
mount += "/opt/config/global/caddy /jails/nullfs/loadbalancer_lb_10_0_0_2/opt/config/caddy nullfs rw 0 0";
mount += "/opt/data/global/caddy/db /jails/nullfs/loadbalancer_lb_10_0_0_2/var/db/caddy nullfs rw 0 0";
mount += "/opt/config/global/caddy/www /jails/nullfs/loadbalancer_lb_10_0_0_2/var/www nullfs rw 0 0";
# ----------------------------------------
# jail dependencies
# ----------------------------------------
#depend="";
}
Errors
Code:
toddg@fbsdlocal ~/repos/biz/freebsd/cloud $ sudo service jail start
Starting jails:jail: loadbalancer_lb_10_0_0_2: mount: /jails/nullfs/loadbalancer_lb_10_0_0_2/opt: No such file or directory
System
Code:
toddg@fbsdlocal ~/repos/biz/freebsd/cloud $ tree /jails/nullfs/loadbalancer_lb_10_0_0_2/
/jails/nullfs/loadbalancer_lb_10_0_0_2/
├── opt
│ └── config
│ └── caddy
└── var
├── db
│ └── caddy
└── www
8 directories, 0 files
So the directories exist.
I've also tried the same thing but instead using the /jails/containers/loadbalancer_lb_10_0_0_2 directory instead of /jails/nullfs/loadbalancer_lb_10_0_0_2
I had everything working using fat jails, so I could always go back to that.