Performance Optimization

The default installation of the WD MyBook devices provides very slow speeds on file transfers because of the high memory usage and a lot of noise produced by the hard drive frequent spins up. In order to reduce the memory usage and to reduce the fan and drive noises some patches may be applied.

This chapter is based on Reducing disk usage

Requirements

To apply the fallowing patches you need to access the device throw SSH and to have root privileges

  1. Start SSH server – Access the Admin web interface to enable the SSH support.
  2. Connect to the device using a ssh client (Putty) and log as a normal user.
  3. Change the user in root.
$ su -

The author and the development team do not assume responsability for any harm or loss you may suffer if you execute the fallowing code. The information provided is considered experimental and if you don't know what you are doing you may crash your device for good.

Patches

Every patch is independent of each other and the order in which they can be applied is not important.

First consider fallowing the previous steps in the WD MyBook World Edition Hacks tutorial

Disable Mionet

Mionet is a service used by WD to provide secure access to the device from anywhere in the world through their website. Another way to securely access the device from the Internet is to install SSH/SFTP. The Mionet proccess uses up to 30% of the internal memory. Thus you can stop mionet from starting at boot time.

  1. Edit /etc/init.d/post_network_start.sh file
  2. Comment the lines containing $SCRIPTS_PATH/mionet.sh

Depending on the current firmware these 3 lines should be commented:

...
# $SCRIPTS_PATH/mionet.sh start
...
# $SCRIPTS_PATH/mionet.sh stop
...
# $SCRIPTS_PATH/mionet.sh cleanup
...

This will prevent mionet to start at boot time, to stop at shutdown and to execute the cleanup process. Note that the intermediary lines are removed.

Disable Leds Disk Usage

The device provides a way to show the disk usage by lighting leds in the front panel. Another way, and a more accurate one, is to connect to the web interface and to colect information from the statistics box. To disable this service:

  1. Edit /etc/init.d/post_network_start.sh file
  2. Comment the lines containing $SCRIPTS_PATH/fuel_gauge.sh

Depending on the current firmware these 3 lines should be commented:

...
# $SCRIPTS_PATH/fuel_gauge.sh start
...
# $SCRIPTS_PATH/fuel_gauge.sh stop
...
# $SCRIPTS_PATH/fuel_gauge.sh cleanup
...

This will prevent the service to start at boot time, to stop at shutdown and to execute the cleanup process. Note that the intermediary lines are removed. The final source code (including removing mionet) may look like this:

#!/bin/sh
#
# post_network_start.sh
#
# Script to start/stop all services that need to start after all the network
# dependent services
#
 
SCRIPTS_PATH=/etc/init.d
STATUS_FILES_PATH=/var/run
POST_NETWORK_STARTED_FILE=$STATUS_FILES_PATH/post_network_started
 
start() {
	if [ ! -e "$POST_NETWORK_STARTED_FILE" ]
	then
		$SCRIPTS_PATH/shares-cleanup.sh start
		$SCRIPTS_PATH/crond.sh start
#		$SCRIPTS_PATH/fuel_gauge.sh start
#		$SCRIPTS_PATH/mionet.sh start
		touch $POST_NETWORK_STARTED_FILE
	fi
}
 
stop() {
	if [ -e "$POST_NETWORK_STARTED_FILE" ]
	then
		$SCRIPTS_PATH/shares-cleanup.sh stop
#		$SCRIPTS_PATH/mionet.sh stop
#		$SCRIPTS_PATH/fuel_gauge.sh stop
		$SCRIPTS_PATH/crond.sh stop
		rm $POST_NETWORK_STARTED_FILE
	fi
}
 
restart() {
	stop
	start
}
 
cleanup() {
	rm -f $POST_NETWORK_STARTED_FILE
	$SCRIPTS_PATH/crond.sh cleanup
#	$SCRIPTS_PATH/fuel_gauge.sh cleanup
#	$SCRIPTS_PATH/mionet.sh cleanup
}
 
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		restart
		;;
	cleanup)
		cleanup
		;;
	*)
		echo $"Usage: $0 {start|stop|restart}"
		exit 1
esac
 
exit $?

Disable the Date Save Cron

  1. Edit /etc/crontabs/root file
  2. Comment the lines containing 0 0 * * * date +%m%d%H%M%Y.%S > /var/lib/now
# standard crontab format for busybox cron daemon.
# fields may be lists
# min    hour day month wd  command
#  *      *    *   *     *   dosomething
 
# save the date every day at midnight
#0   0    *   *     *   date +%m%d%H%M%Y.%S > /var/lib/now

Disable System Logs

Linux Sysklogd provides two system utilities which provide support for system logging and kernel message trapping. System logging is provided by a version of syslogd derived from the stock BSD sources. Support for kernel logging is provided by the klogd utility which allows kernel logging to be conducted in either a standalone fashion or as a client of syslogd. To prevent these services to start at boot time:

  1. Edit /etc/inittab file
  2. Comment the lines containing:
::respawn:/sbin/syslogd -n -m 0
::respawn:/sbin/klogd -n

Disable ntpd Log

NTP is Network Time Protocol. The ntpd program is an operating system daemon that synchronizes the system clock with remote NTP time servers or local reference clocks. It is a complete implementation of the Network Time Protocol (NTP) version 4, but also retains compatibility with version 3, as defined by RFC-1305, and version 1 and 2, as defined by RFC-1059 and RFC-1119, respectively. The service save a log entry for each time check.

  1. Edit /etc/ntp.conf file
  2. Change the log file to null:
logfile=/dev/null

Disable Web Interface

The web interface is used to access and administer the device from a web browser. As the default, the web interface is the only way the user can change the device settings. The system provides a web server (Lighty) and a script interpreter (Perl) together with the WD source code. The web server consume a very small part of the internal memory and it is one of the fastest available servers. The problem comes with the script interpreter (Perl) that is run as a fast-cgi socket (that it consumes up to 40% of the RAM memory).

The author recommends NOT to disable the web interface. THIS MIGHT BE THE ONLY WAY YOU CAN ACCESS THE DEVICE. If you are still planning to disable it, first consider to enable SSH access and to make sure that SSH service is started at boot time. Otherwise, next time you are gonna boot the machine, you will loose any chance to change the settings. THE WEB INTERFACE IS USED TO ENABLE SSH ACCESS!

  • Start SSH server – Access the Admin web interface to enable the SSH support.

If you are planning not to use the web server at all:

  1. Edit /etc/init.d/network_servers.sh file
  2. Comment the lines containing $SCRIPTS_PATH/lighttpd.sh
...
# $SCRIPTS_PATH/lighttpd.sh start
...
# $SCRIPTS_PATH/lighttpd.sh stop
...
# $SCRIPTS_PATH/lighttpd.sh cleanup
...

If you are planning not to use Perl / Web interface, but use Lighty for other purpose

  1. Edit /etc/lighttpd/lighttpd.conf file
  2. Comment the lines containing:
fastcgi.server = ( ".pl" =>
    (( "socket" => "/tmp/lighttpd.fcgi.socket",
       "bin-path" => "/usr/www/lib/nasMaster.pl",
       "check-local" => "disable",
       "min-procs" => 1,
       "max-procs" => 1,
       "idle-timeout" => 30,
       "bin-environment" => (
		# Environment variables for nasMaster.pl
                "PERL5LIB" => "/usr/www/lib",
		"NAS_NBIN" => "/usr/www/nbin",
       ),
    )),
	"nasMaster.pl" => ((  "socket" => "/tmp/lighttpd.fcgi.socket",              
		"check-local" => "disable",
		"idle-timeout" => 30,                 
	))                                                   
)

Before exiting SSH / rebooting the device, MAKE SURE THE SSH IS CONFIGURED AS REQUIRED AND IT IS SET TO START AT BOOT TIME! If the Web interface is stoped and SSH is not started it will be very hard (impossible) to access the device's settings.

  • Start SSH server – Access the Admin web interface to enable the SSH support.

Related Resources

 
devices/mybookworld/optimize.txt · Last modified: 2008/05/04 05:39 (external edit)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki