summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xetc/init.d/vyatta-router18
1 files changed, 16 insertions, 2 deletions
diff --git a/etc/init.d/vyatta-router b/etc/init.d/vyatta-router
index c9b9786..87e96f7 100755
--- a/etc/init.d/vyatta-router
+++ b/etc/init.d/vyatta-router
@@ -188,8 +188,22 @@ mount_slash_config ()
start ()
{
log_action_begin_msg "Mounting Vyatta Config"
- mount -o nosuid,nodev,mode=775 -t tmpfs none ${vyatta_configdir} && \
- chgrp ${GROUP} ${vyatta_configdir}
+ # ensure the vyatta_configdir supports a large number of inodes since
+ # the config hierarchy is often inode-bound (instead of size).
+ # impose a minimum and then scale up dynamically with the actual size
+ # of the system memory.
+ local tmem=$(sed -n 's/^MemTotal: \+\([0-9]\+\) kB$/\1/p' /proc/meminfo)
+ local tpages
+ local max_inodes=300000
+ if [ -n "$tmem" ]; then
+ (( tpages = tmem / 4 ))
+ if (( tpages > max_inodes )); then
+ (( max_inodes = tpages ))
+ fi
+ fi
+ local tmpfs_opts="nosuid,nodev,mode=775,nr_inodes=$max_inodes"
+ mount -o $tmpfs_opts -t tmpfs none ${vyatta_configdir} \
+ && chgrp ${GROUP} ${vyatta_configdir}
log_action_end_msg $?
disabled bootfile || init_bootfile