https://gist.github.com/cam8001/ff5880d8a70e14661af2
#!/bin/bash # See http://mybookworld.wikidot.com/forum/t-583096 # See http://tech.roxee.tv/2012/06/12/solving-the-my-book-live-insane-load/ # http://community.wd.com/t5/My-Book-Live-Duo/New-MyBook-Duo-4Tb-astonishingly-slow-I-mean-really-soul/td-p/417642/page/5 # Disable all this stuff, but also make miocrawler drops its logs. # vi /etc/rsyslog.d/miocrawler.conf # [root@storagecasa rsyslog.d]# cat miocrawler.conf ## local4.* /var/log/miocrawler.log # local4.* /dev/null # Make mediacrawler service unexecutable, and disable the 'tally' script in miocrawler.conf. /etc/init.d/nfs-kernel-server stop /etc/init.d/nfs-common stop /etc/init.d/netatalk stop /etc/init.d/portmap stop /etc/init.d/upnp_nas stop /etc/init.d/mDNSResponder stop /etc/init.d/smb-daemon stop /etc/init.d/orion stop
http://www.smallnetbuilder.com/nas/nas-howto/31828-fun-with-rsync-and-more-on-the-wd-my-book-live
Setting Up Rsync This leaves rsync support as the piece missing from the My Book Live, but that turns out to not be a problem. WD provides a hidden page to enable SSH access, which, once enabled, provides full root access and the ability to modify its Debian-based OS, assuming you are willing to discard warranty protection. Entering http://mybooklive/UI/ssh (case sensitive!) into your browser brings up the hidden page shown in the opening graphic above, complete with login info. WARNING! WD provides full root access with the ability to modify any system files and save the changes. This means that you can brick or mess up your My Book Live if you are not careful. The first thing you need to do after logging in with an SSH client such as PuTTY or WinSCP is enable the rsync daemon. Edit /etc/default/rsync and make it look like the code below. All you really need to do is remove the # in front of the RSYNC_ENABLE=true line.
# defaults file for rsync daemon mode # start rsync in daemon mode from init.d script? # only allowed values are "true", "false", and "inetd" # Use "inetd" if you want to start the rsyncd from inetd, # all this does is prevent the init.d script from printing a message # about not starting rsyncd (you still need to modify inetd's config yourself). RSYNC_ENABLE=true # which file should be used as the configuration file for rsync. # This file is used instead of the default /etc/rsyncd.conf # Warning: This option has no effect if the daemon is accessed # using a remote shell. When using a different file for # rsync you might want to symlink /etc/rsyncd.conf to # that file. # RSYNC_CONFIG_FILE= # what extra options to give rsync --daemon? # that excludes the --daemon; that's always done in the init.d script # Possibilities are: # --address=123.45.67.89 (bind to a specific IP address) # --port=8730 (bind to specified port; default 873) RSYNC_OPTS='' # run rsyncd at a nice level? # the rsync daemon can impact performance due to much I/O and CPU usage, # so you may want to run it at a nicer priority than the default priority. # Allowed values are 0 - 19 inclusive; 10 is a reasonable value. RSYNC_NICE='' # Don't forget to create an appropriate config file, # else the daemon will not start. We are using the default location of the rsyncd.conf file, which is in /etc. So navigate there and create the file as shown below. pid file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock log file = /var/log/rsync.log [rsync] path = /shares/rsync uid = root gid = share read only = no list = yes auth users = root secrets file = /etc/rsyncd.secrets
The first three lines are not essential. But I would recommend at least defining the log file, since it's handy to have while you are trying to figure out why you can't connect to your rsync target! The essential part starts at the [rsync] line. This configuration defines the rsync module named rsync, which is a share you need to create in the My Book Live root share directory as shown below. I created the share via the My Book Live admin and gave it Public access, as are all my other shares. If you want to name your rsync directory differently, just change the [rsync] name in brackets and set the path variable accordingly.
I got the uid and gid settings by navigating to the /shares directory and doing a listing as shown below. The uid (user id) is listed first, followed by the gid (group id).
My BookLive:/shares# ls -al total 388 drwxr-xr-x 7 root share 65536 Aug 1 09:52 . drwxr-xr-x 25 root root 4096 Jul 31 15:36 .. drwxr-xr-- 2 root root 65536 Aug 1 09:55 .mediacrawler drwxrwxr-x 5 root share 65536 Jul 7 16:19 Public drwxrwxr-x 30 root share 65536 Jul 31 15:11 nasrev_backup drwxrwxr-x 4 root share 65536 Jul 8 11:09 opti990_backup drwxrwxrwx 6 root share 65536 Mar 23 15:17 rsync
The rsync apps in the Synology and QNAP both require username and password to be entered, so I set root as the user (auth users = root in rsyncd.conf). The password needs to be entered in the rsyncd.secrets file, which is also located in /etc. I entered: root:root This is in the form username:password. Note that because the password is in cleartext, I had to limit access to only the file owner, which I did by entering the line below while in the /etc directory: chmod 600 rsyncd.secrets At this point, everything we need has been defined, so we need to start rsync with this command: /etc/init.d/rsync restart The first time you run this you will get a warning that rsync was not running. You can ignore this and you won't get the warning on subsequent restarts. If you make changes to any of the files described, be sure to restart rsync to get the changes to take. Update 9/18/2012 - A helpful reader pointed out that you can make rsync automatically start at boot time.
Navigate to the /etc/rc2.d directory, then enter the following at the command line: ln -s ../init.d/rsync S91rsync When you reboot, rsync will automatically be started and you will not get a warning that rsync is not running.
Disable all the stuff we don't need on a MyBookLive.