So that my harddisk does not get noisy every 5 seconds
$ cat bin/disk-low-write-mode.sh #!/bin/sh # age time, in seconds MAX_AGE=600 # allowed dirty ratio, in pct DIRTY_RATIO=40 # kernel default dirty buffer age DEF_AGE=30 DEF_UPDATE=5 DEF_DIRTY_BACKGROUND_RATIO=10 DEF_DIRTY_RATIO=40 REMOUNT_PART="/ /home /pub" case "$1" in start) AGE=$((100*$MAX_AGE)) echo "$AGE" > /proc/sys/vm/dirty_expire_centisecs echo "$AGE" > /proc/sys/vm/dirty_writeback_centisecs echo "$DIRTY_RATIO" > /proc/sys/vm/dirty_ratio echo "$DIRTY_RATIO" > /proc/sys/vm/dirty_background_ratio for part in $REMOUNT_PART; do mount $part -o remount,relatime,commit=$MAX_AGE done ;; stop) U_AGE=$((100*$DEF_UPDATE)) B_AGE=$((100*$DEF_AGE)) echo "$B_AGE" > /proc/sys/vm/dirty_writeback_centisecs echo "$U_AGE" > /proc/sys/vm/dirty_expire_centisecs echo "$DEF_DIRTY_RATIO" > /proc/sys/vm/dirty_ratio echo "$DEF_DIRTY_BACKGROUND_RATIO" > /proc/sys/vm/dirty_backgrou nd_ratio for part in $REMOUNT_PART; do mount $part -o remount,commit=$DEF_UPDATE done ;; *) echo "$0 {start|stop}" ;; esac exit 0
Comments are closed for this story.
Trackbacks are closed for this story.