I just had to RMA two SSD's because they died after 10 months of Zoneminder video data processing taking place on them. This resulted in more than 400TiB of write activity. First thing that came to mind was to move the memory map file used for this to my HDD pool but to be honest, no storage media is made for 20MB/s continuous write 24x7. Digging some deeper I found that the best practice is to move the SWAP and MAP data to a ramdisk. There was no cut-and-paste solution anywhere so it took some digging and testing to get it working and thought it might be good to document this.
Step 1: FreeNAS jail host configuration
Make sure the following entries are added to the sysctl's section of your Jail. You can find this under 'Advanced Mode' when you open your jails settings in the GUI of FreeNAS. These settings will allow FreeNAS/FreeBSD to mount a tmpfs filesystem which is a dynamic ramdisk on FreeBSD.
Restart your jail to make these settings effective.
Step 2: FreeNAS jail configuration
Go into your jails command line and edit the file
Next step is to edit/create
This will automatically mount the tmpfs ramdisk we defined in fstab at each start of the jail. For some reason fstab entries are not automatically mounted inside a jail.
Restart your jail again to activate the tmpfs ramdisk. You can check if it is active and mounted with the command
Step 3: Configure your application
Last step is to make sure that your application uses
Restart your application to activate the changes.
Step 1: FreeNAS jail host configuration
Make sure the following entries are added to the sysctl's section of your Jail. You can find this under 'Advanced Mode' when you open your jails settings in the GUI of FreeNAS. These settings will allow FreeNAS/FreeBSD to mount a tmpfs filesystem which is a dynamic ramdisk on FreeBSD.
allow.raw_sockets=true,allow.mount.tmpfs,enforce_statfs=0,allow.mount
Restart your jail to make these settings effective.
Step 2: FreeNAS jail configuration
Go into your jails command line and edit the file
/etc/fstab
(which probably is empty) and add the following line: tmpfs /tmp tmpfs rw,mode=777 0 0
Next step is to edit/create
/etc/rc.local
and add the following line: mount /tmp
This will automatically mount the tmpfs ramdisk we defined in fstab at each start of the jail. For some reason fstab entries are not automatically mounted inside a jail.
Restart your jail again to activate the tmpfs ramdisk. You can check if it is active and mounted with the command
mount | grep tmpfs
. This should show an entry for the /tmp mount inside your jail. You can issue this command in or outside of the jail.Step 3: Configure your application
Last step is to make sure that your application uses
/tmp
for any transcoding or streaming data processing. For Zoneminder this means go into the web console and edit the values for PATH_SWAP and PATH_MAP on the Paths tab to /tmp
.Restart your application to activate the changes.