My objective is to install PostgreSQL 17 inside FreeBSD 14.2 Jail, and that by separating and tweaking 3 datasets inside the jail.
My FreeBSD 14-2 Host-Managed zfs datasets are like below :
My PostgreSQL /etc/jail.conf.d/pgdb01.conf :
My problem is when I'm inside the jail, I cannot access the mount point /var/db/postgres/ as shown in the picture bellow :
My FreeBSD 14-2 Host-Managed zfs datasets are like below :
My PostgreSQL /etc/jail.conf.d/pgdb01.conf :
rai.mohammed@desktopfb:~ $ cat /etc/jail.conf.d/pgdb01.conf
pgdb01 {
# STARTUP/LOGGING
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.consolelog = "/var/log/jails/jail_console_${name}.log";
# PERMISSIONS
allow.raw_sockets;
exec.clean;
mount.devfs;
allow.mount;
allow.mount.devfs;
allow.mount.zfs;
enforce_statfs = 1;
# /etc/defaults/devfs.rules
devfs_ruleset = 5;
# To run PostgreSQL in a FreeBSD jail
sysvmsg=new ;
sysvsem=new ;
sysvshm=new ;
# HOSTNAME/PATH
$domain = "itlinker.lan";
host.hostname = "${name}.${domain}";
path = "/usr/local/jails/containers/${name}";
mount.fstab="/etc/fstab.$name";
# VNET/VIMAGE
vnet;
vnet.interface = "${epair}b";
# NETWORKS/INTERFACES
$id = "232";
$ip = "192.168.20.${id}/24";
$gateway = "192.168.20.1";
$bridge = "bridge0";
$epair = "epair${id}";
# ADD TO bridge INTERFACE
exec.prestart = "/sbin/ifconfig ${epair} create up";
exec.prestart += "/sbin/ifconfig ${epair}a up descr jail:${name}";
exec.prestart += "/sbin/ifconfig ${bridge} addm ${epair}a up";
exec.start += "/sbin/ifconfig ${epair}b ${ip} up";
exec.start += "/sbin/route add default ${gateway}";
exec.poststop = "/sbin/ifconfig ${bridge} deletem ${epair}a";
exec.poststop += "/sbin/ifconfig ${epair}a destroy";
# ADD TO show ZFS dataset in jail
exec.poststart += "/sbin/zfs jail pgdb01 zroot/jails/containers/pgdb01/data17";
# exec.poststart += "/sbin/zfs jail pgdb01 zroot/jails/containers/pgdb01/data17/base";
# exec.poststart += "/sbin/zfs jail pgdb01 zroot/jails/containers/pgdb01/data17/pg_wal";
exec.poststart += "/sbin/zfs mount zroot/jails/containers/pgdb01/data17";
# exec.poststart += "/sbin/zfs mount zroot/jails/containers/pgdb01/data17/base";
# exec.poststart += "/sbin/zfs mount zroot/jails/containers/pgdb01/data17/pg_wal";
# exec.poststop += "/sbin/zfs unmount zroot/jails/containers/pgdb01/data17/pg_wal";
# exec.poststop += "/sbin/zfs unmount zroot/jails/containers/pgdb01/data17/base";
exec.poststop += "/sbin/zfs unmount zroot/jails/containers/pgdb01/data17";
# exec.poststop += "/sbin/zfs unjail pgdb01 zroot/jails/containers/pgdb01/data17/pg_wal";
# exec.poststop += "/sbin/zfs unjail pgdb01 zroot/jails/containers/pgdb01/data17/base";
exec.poststop += "/sbin/zfs unjail pgdb01 zroot/jails/containers/pgdb01/data17";
}
My problem is when I'm inside the jail, I cannot access the mount point /var/db/postgres/ as shown in the picture bellow :
# uname -a
FreeBSD pgdb01.itlinker.lan 14.2-RELEASE FreeBSD 14.2-RELEASE releng/14.2-n269506-c8918d6c7412 GENERIC amd64
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
zroot 33.8G 412G 96K /zroot
zroot/jails 714M 412G 104K /usr/local/jails
zroot/jails/containers 517M 412G 517M /usr/local/jails/containers
zroot/jails/containers/pgdb01 192K 412G 96K /usr/local/jails/containers/pgdb01
zroot/jails/containers/pgdb01/data17 96K 412G 96K /var/db/postgres/data17
# ls -al /
total 135
drwxr-xr-x 18 root wheel 22 Dec 17 10:12 .
drwxr-xr-x 18 root wheel 22 Dec 17 10:12 ..
-rw-r--r-- 2 root wheel 1011 Nov 29 10:58 .cshrc
-rw-r--r-- 2 root wheel 495 Nov 29 10:58 .profile
drwxr-xr-x 2 root wheel 49 Nov 29 10:58 bin
drwxr-xr-x 14 root wheel 68 Nov 29 11:42 boot
-r--r--r-- 1 root wheel 6109 Nov 29 11:42 COPYRIGHT
dr-xr-xr-x 14 root wheel 512 Dec 17 13:50 dev
drwxr-xr-x 30 root wheel 107 Dec 17 10:57 etc
drwxr-xr-x 4 root wheel 78 Nov 29 11:20 lib
drwxr-xr-x 3 root wheel 5 Nov 29 10:57 libexec
drwxr-xr-x 2 root wheel 2 Nov 29 10:54 media
drwxr-xr-x 2 root wheel 2 Nov 29 10:54 mnt
drwxr-xr-x 2 root wheel 2 Nov 29 10:54 net
dr-xr-xr-x 2 root wheel 2 Nov 29 10:54 proc
drwxr-xr-x 2 root wheel 150 Nov 29 11:15 rescue
drwxr-x--- 2 root wheel 8 Dec 17 14:06 root
drwxr-xr-x 2 root wheel 150 Nov 29 11:23 sbin
lrwxr-xr-x 1 root wheel 11 Nov 29 10:54 sys -> usr/src/sys
drwxrwxrwt 6 root wheel 6 Dec 17 14:01 tmp
drwxr-xr-x 14 root wheel 14 Nov 29 10:54 usr
drwxr-xr-x 24 root wheel 24 Dec 17 13:50 var
# ls -al /var/db/postgres/
ls: /var/db/postgres/: No such file or directory