Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dlangille
Last active March 21, 2019 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlangille/3d58d31ac5a08c57dbd6cf64da42ec61 to your computer and use it in GitHub Desktop.
Save dlangille/3d58d31ac5a08c57dbd6cf64da42ec61 to your computer and use it in GitHub Desktop.
FreshPorts working directory ZFS tunables
The sync=disabled is more appropriate for the repo dataset mentioned below.
I usually have atime off on all ZFS datasets.
sudo zfs create -o sync=disabled -o atime=off -o recordsize=32K tank_fast/freshports
sudo zfs create tank_fast/freshports/dev
sudo zfs create tank_fast/freshports/test
sudo zfs create tank_fast/freshports/stage
What goes in there? The following outline what sits in /var/db/freshports of a given dev/test/stage environment.
The mail directories are:
var/db/freshports
var/db/freshports/message-queues
var/db/freshports/ports-jail/var/db/repos
When processing commits, the code does a 'chroot var/db/freshports/ports-jail' in order to isolate
itself from packages installed on the host.
All up, each environment about 20GB, with, let's say, 15G for growth.
Keep in mind that some datasets are nullfs mounted elsewhere for read-only access:
$ mount | grep nullfs | grep -v /usr/jails/basejail
/usr/jails/test-ingress01/var/db/freshports/cache/html on /usr/jails/test-nginx01/var/db/freshports/cache/html (nullfs, local, noexec, nosuid, read-only)
/usr/jails/stage-ingress01/var/db/freshports/cache/html on /usr/jails/stage-nginx01/var/db/freshports/cache/html (nullfs, local, noexec, nosuid, read-only)
/usr/jails/dev-ingress01/var/db/freshports/cache/html on /usr/jails/dev-nginx01/var/db/freshports/cache/html (nullfs, local, noexec, nosuid, read-only)
I once thought that var/db/freshports/cache/html must a separate dataset.
I don't think that any more.
--- /usr/jails/dev-ingress01/var/db/freshports
11.8 GiB [##########] /ports-jail
9.2 GiB [####### ] /message-queues
--- /usr/jails/dev-ingress01/var/db/freshports/message-queues
/..
9.2 GiB [##########] /archive
12.5 MiB [ ] /recent
7.4 MiB [ ] /retry
The above is used when processing incoming commits.
recent & retry are most active.
archive is written to once a day as files are moved from recent.
archive is ocassionally searched when looking for an old commit.
Files in archive vary from 192 bytes to 80K, sometimes 9M
--- /usr/jails/dev-ingress01/var/db/freshports/message-queues/archive
/..
1.4 GiB [##########] /2018_12
1.3 GiB [######### ] /2018_05
871.0 MiB [###### ] /2018_10
848.4 MiB [###### ] /2018_07
845.5 MiB [###### ] /2018_06
819.8 MiB [##### ] /2019_01
740.6 MiB [##### ] /2018_09
738.2 MiB [##### ] /2018_11
605.5 MiB [#### ] /2018_08
599.7 MiB [#### ] /2019_02
493.6 MiB [### ] /2019_03
90.2 MiB [ ] /2018_04
The below will most likely be a separate dataset with sync=disabled.
--- /usr/jails/dev-ingress01/var/db/freshports/ports-jail/var/db/repos
/..
2.6 GiB [##########] /PORTS-head
1.4 GiB [##### ] /PORTS-2018Q4
1.4 GiB [##### ] /PORTS-2018Q3
1.4 GiB [##### ] /PORTS-2019Q1.original
1.4 GiB [##### ] /PORTS-2019Q1
1.4 GiB [##### ] /PORTS-2018Q2
1.3 GiB [#### ] /PORTS-2018Q1
These are copies of the FreeBSD ports tree, created via: svn checkout https://svn.freebsd.org/ports/branches/${BRANCH}
Older branches are rarely needed after a new branch is created. I'm sure we only need the latest 3 quarterly branches.
An 'svn up -r ${REVISION}' is run for each commit.
ssudo zfs set sync=standard tank_fast/freshports
sudo zfs create -o mountpoint=/iocage/jails/test-ingress01/root/var/db/freshports/message-queues -o canmount=on tank_fast/freshports/test/message-queues
sudo zfs create -o mountpoint=/iocage/jails/test-ingress01/root/var/db/freshports/ports-jail -o canmount=off tank_fast/freshports/test/ports-jail
sudo zfs create -o mountpoint=/iocage/jails/test-ingress01/root/var/db/freshports/ports-jail/var -o canmount=off tank_fast/freshports/test/ports-jail/var
sudo zfs create -o mountpoint=/iocage/jails/test-ingress01/root/var/db/freshports/ports-jail/var/db -o canmount=off tank_fast/freshports/test/ports-jail/var/db
sudo zfs create -o sync=disabled tank_fast/freshports/test/ports-jail/var/db/repos
sudo zfs create -o mountpoint=/iocage/jails/test-ingress01/root/var/db/freshports/message-queues -o canmount=on tank_fast/freshports/test/message-queues
sudo zfs create -o mountpoint=/iocage/jails/test-ingress01/root/var/db/freshports/ports-jail -o canmount=off tank_fast/freshports/test/ports-jail
sudo zfs create -o mountpoint=/iocage/jails/test-ingress01/root/var/db/freshports/ports-jail/var -o canmount=off tank_fast/freshports/test/ports-jail/var
sudo zfs create -o mountpoint=/iocage/jails/test-ingress01/root/var/db/freshports/ports-jail/var/db -o canmount=off tank_fast/freshports/test/ports-jail/var/db
sudo zfs create -o canmount=on tank_fast/freshports/test/ports-jail/var/db/repos
#!/bin/sh
zfs create -o canmount=off -o atime=off -o recordsize=32K tank_fast/freshports
SITES="dev test stage"
for site in ${SITES}
do
zfs create -o mountpoint=/iocage/jails/${site}-ingress01/root/var/db/freshports -o canmount=off tank_fast/freshports/${site}
zfs create -o canmount=on tank_fast/freshports/${site}/message-queues
zfs create -o canmount=off tank_fast/freshports/${site}/ports-jail
zfs create -o canmount=off tank_fast/freshports/${site}/ports-jail/var
zfs create -o canmount=off tank_fast/freshports/${site}/ports-jail/var/db
zfs create -o sync=disabled tank_fast/freshports/${site}/ports-jail/var/db/repos
zfs create -o canmount=off tank_fast/freshports/${site}/cache
zfs create tank_fast/freshports/${site}/cache/html
zfs create tank_fast/freshports/${site}/cache/spooling
zfs create -o mountpoint=/iocage/jails/${site}-ingress01/root/var/db/ingress -o canmount=off tank_fast/freshports/${site}/ingress
zfs create tank_fast/freshports/${site}/ingress/message-queues
done
@dlangille
Copy link
Author

Things to watch out for:

  • IP addresses
  • mount points
  • other filesystems mounted within your jail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment