RAM Disk Management
RAM Disk Management
1) Treat the RAM disk more like a permanent storage device with content managed/restored by the system and made available at boot up, before needed by any services.
a) Handle saving and restoring RAM disk content at reboot/shutdown/boot centrally in more of a system managed fashion.
b) If it's in the RAM disk store it gets restored early, right after mounted and before pfSense startup so it's available for whatever needs to use it.
c) Services utilizing RAM disk don't need to be aware that their content is on a RAM disk, and handling content restore individually.
2) Has the benefit of eliminating some issues with the previous code as well. Such as...
a) Restoring RRD multiple times during boot, potentially at least 3 times, by rc.newwanip, rc.newwanipv6, and rc.boot. Some may even be overlapping.
b) Not removing the backups if/when not being utilized. Such as on a full install with the RAM disk option not enabled.
c) Eliminate some duplicate code.
3) Eliminate rrd dump/restore to/from xlm file.
a) Eliminate the rrd dump/restore to/from xlm file. Backup and restore the entire /var/db/rrd/ to/from the RAM Disk Store directly. Much smaller backup *.tgz than xlm dump, making it more write cycle sensitive media friendly.
4) Restore RAM Disk soon as it is created/mounted.
a) Restoring the RAM disk as soon as it is available will make it easier to include additional content that needs to persist across reboots. Such as some packages for instance.
5) Include the logs in the RAM disk store so they will persist across reboots.
6) Add logic to backup alias tables if the backup is older than the table.
7) Looking forward.
a) The more centrally system managed approach and restoring the RAM disk content as early as possible will make it easier to include other content that may be useful/desirable or need to persist in the RAM disk across reboots. Some packages data for instance. Simply tar -czf what needs to be restored to /cf/conf/RAM_Disk_Store/*.tgz. See existing /etc/rc.backup*.sh for examples.