Todo #12145
closedConvert RAM disks to ``tmpfs``
100%
Description
For various reasons we may want to switch the RAM disks from ufs on md devices to tmpfs .
Appears to be a simple source change:
diff --git a/src/etc/rc.ramdisk_functions.sh b/src/etc/rc.ramdisk_functions.sh
index 522b7f2b1e..0ec9894f70 100755
--- a/src/etc/rc.ramdisk_functions.sh
+++ b/src/etc/rc.ramdisk_functions.sh
@@ -101,7 +101,7 @@ ramdisk_try_mount () {
NAME=$1
if [ ramdisk_check_size ]; then
SIZE=$(eval echo \${${NAME}size})m
- /sbin/mdmfs -S -M -s ${SIZE} md /${NAME}
+ /sbin/mount -o rw,size=${SIZE},mode=1777 -t tmpfs tmpfs /${NAME}
return $?
else
return 1;
diff --git a/src/usr/local/www/includes/functions.inc.php b/src/usr/local/www/includes/functions.inc.php
index c25ccebaca..3edeeade3b 100644
--- a/src/usr/local/www/includes/functions.inc.php
+++ b/src/usr/local/www/includes/functions.inc.php
@@ -158,7 +158,7 @@ function get_temp() {
function get_mounted_filesystems() {
$mout = "";
$filesystems = array();
- exec("/bin/df -Tht ufs,zfs,cd9660 | /usr/bin/awk '{print $1, $2, $3, $6, $7;}'", $mout);
+ exec("/bin/df -Tht ufs,zfs,tmpfs,cd9660 | /usr/bin/awk '{print $1, $2, $3, $6, $7;}'", $mout);
/* Get rid of the header */
array_shift($mout);
Naturally that could be deceptively oversimplifying it. Needs lots of testing.
Feel free to kick ahead as needed.
Updated by Jim Pingle over 3 years ago
One additional item I found is needed: In source:usr/local/www/includes/functions.inc.php#L163 df -Tht
is executed and passed the filesystem types to filter, tmpfs
will need added to that list.
Updated by Jim Pingle over 3 years ago
- Description updated (diff)
- Assignee set to Jim Pingle
- % Done changed from 0 to 20
Updated the diff for testing but hit another thing we need to account for.
Currently we check if there is sufficient kernel memory for use by the memory disks. tmpfs does not use kernel memory, so it doesn't suffer the same restrictions, but we still need to make sure there is sufficient RAM to host the tmpfs disks.
Currently we calculate based on the value of vm.kmem_map_free
(value in bytes), but this should be changed to vm.stats.vm.v_free_count
(# of free pages) multiplied by vm.stats.vm.v_page_size
(page size in bytes). This size check is performed in two files: source:src/etc/rc.ramdisk_functions.sh#L82 and source:src/usr/local/pfSense/include/www/system_advanced_misc.inc (multiple places, search for available_kernel_memory
)
Updated by Jim Pingle over 3 years ago
- Status changed from New to Feedback
- % Done changed from 20 to 100
Applied in changeset d566427f1b210e9ce08ed9be376b0919c113e83b.
Updated by Jim Pingle over 3 years ago
- Status changed from Feedback to In Progress
Systems using RAM disks are good now, but on systems not using RAM disks, /var/run is still using md/ufs.
Updated by Jim Pingle over 3 years ago
- Status changed from In Progress to Feedback
Applied in changeset 3ff300c630e9decc06d7640136260d07ad566c19.
Updated by Loh Phat over 3 years ago
Would anything need to change in the dashboard UI code to display tempfs vs ufs where appropriate, or is it already dynamic?
Updated by Jim Pingle about 3 years ago
Darin May wrote in #note-6:
Would anything need to change in the dashboard UI code to display tempfs vs ufs where appropriate, or is it already dynamic?
That's already covered in the commits made to implement this change.
Updated by Jim Pingle about 3 years ago
- Plus Target Version changed from 21.09 to 22.01
Updated by Jim Pingle almost 3 years ago
- Status changed from Feedback to Resolved
This has been working well since it went in, no sign of problems thus far.