Tag: MyBook

  • Opportunity Locks

    It seems Samba on the MyBook (fw 01.02.04) has trouble with big files. I haven’t hit this problem first-hand but have had the MyBook deciding to just not save files and throw-up “overload” warnings on the webgui even though nothing is going on on the box. The CIFS log reads:

    “read_data: read failure for 4 bytes to client 10.44.1.20. Error = Connection reset by peer”

    Apparently one possible cause is opportunistic locking. so I’ve turned it off by applying the registry key suggested here. One other option is to get the NAS to power cycle every day to clear any issues bubbling under with the SAMBA daemon.

    Hopefully there will be a fix for this one soon.

    Turning off oplocks on the client just caused the error more often though. Maybe I need to turn it off on the server instead or as well as…

    For details on how to turn oplocks on or off on Windows 7, click here.

    For details on how to do the same at the SAMBA/MyBook end, click here.

    For an example of what Oplocks are and how they can barf, click here.

  • WD MyBook as a backup device for another MyBook

    I bought a new MyBook World Edition from PC World and another older model from ebay. The ebay one is purely as a backup for the primary.

    With the old Thecus N299 (don’t buy one), the backup method was to run XCOPY from the NAS to a USB drive. It worked but was clunky and required me to actually get the disk out of the box and run the backup.

    As I’ve forked out £100 on the single-disk MyBook, I wanted a better backup solution. £40 later I have the second MyBook. How to make it a backup?

    There are lots of details on the MyBook Hacks wiki on ways to break into the OS on the MyBook. It is basically a Linux appliance with a very cut-down feature set. The newer unit has an SSH enable tick box which exposes the CLI. The older box needs a hack to get the same but is safe enough and worth the trouble.

    Once you have CLI, tweaking the config to always boot SSH and never start the mionet tool is a must. Then, I dropped on OPTWARE and installed FTPCOPY.

    A short script later along the lines of this to copy anything new in the last 30 days:

    ftpcopy -u myname -p mypasswd -m 30 192.168.1.11 simkin /shares/internal/SIMKIN

    OR if you want to mirror (like Microosft SyncToy) do this:

    lftp -c ‘open -e “mirror /myshare/ /shares/internal/MYSHARE” -d -u myname,mypasswd 192.168.1.11’

    MyBook Backup

    and I have the last 30 days of changes from my main NAS to this local one. This assumes you have created the user and local shares already.

    I have more comprehensive details below on how I did all this but to be honest, the wiki tells the story much better than me.

    I heartily recommend these little disk devices. Only one drive in the entry-level units but quick enough, quiet and customisable. Get two if you can and hack the life out of one to backup the primary. Better deal than running a RAID1 NAS 24×7 in my view considering disk life is pretty good and the NAS barfing or dropping its config is more likely than a spindle failing. With physical separation of the boxes (one of mine is in the shed), you get as good protection as RAID1 without the noise, costs and hassles.

    ——-

    The Spoon-feed:

    I assume you have a blue-ring and white stripe WD MyBook sitting on your network as follows:

    MyBook #1 (Primary):

    • This is the newer “white stripe” model – WDH1NC10000, WDH1NC20000.
    • 192.168.1.101
    • There is a user called “myuser” with password “mypasswd”
    • There is a share called “myshare”
    • ftp server is enabled

    MyBook #2 (Secondary):

    • This is the older “blue circle” model – WD5000G032, WD7500G032, WD10000G032.
    • 192.168.1.102
    • There is a user called “myuser” with password “mypasswd”
    • There is a share called “myshare”
    • No hacks have been undertaken so far.

    All the following activity happens on the older “blue circle” model, MyBook #2:

    1. Enable SSH

    http://martin.hinner.info/mybook/sshaccess.php

    2. Follow instructions to make sshd boot every time. It involves using vi to edit /etc/inittab. Here is the 30 second guidebook:

    By default, vi starts in command mode which means if you start typing you will just wreck the file.

    Instead, use the h(left)j(down)k(up)l(right) keys to move around the file

    i will put you into insert mode. Type what you want and press <ESC> to get back to command mode.

    a will put you in append mode. Type what you want and press <ESC> to get back to command mode.

    x will delete the character to the left of the cursor

    dd will delete the whole line

    When in command mode, <ESC>:wq!  will write the file (save it) and quit. :q!  will exit without saving.

    Adding the line to inittab works something like this:

    vi /etc/inittab

    kkkkki::sysinit:/usr/sbin/sshd<RETURN><ESC>:wq!

    3. Change the root user password from blank to something you can remember:

    passwd welc0me

    4. Install Optware:

    wget http://mybookworld.wikidot.com/local–files/optware/setup-optware.sh

    sh setup-optware.sh

    echo “/opt/lib” >>/etc/ld.so.conf

    ldconfig

    vi /root/.bashrc   and add this line:

    export LD_LIBRARY_PATH=/opt/lib

    echo “export PATH=$PATH:/opt/bin” >> /root/.bashrc

    echo “export PATH=$PATH:/opt/bin” >> /etc/profile

    /opt/bin/ipkg update

    5a. Install ftpcopy rather than lftp

    /opt/bin/ipkg install ftpcopy

    5b. OR Install lftp instead of ftpcopy

    /opt/bin/ipkg install libiconv

    /opt/bin/ipkg install lftp

    6. Create a backup script

    cd /root

    Use vi to create a file called backup.sh containing this line:

    ftpcopy -u myuser -p mypasswd -m 30 192.168.1.11 myshare /shares/internal/MYSHARE

    or

    lftp -c ‘open -e “mirror /myshare/ /shares/internal/MYSHARE” -d -u myuser,mypasswd 192.168.1.11’

    7. Make it run at 4am every sunday morning

    vi /etc/crontabs/root   and add these lines:

    # run the backup script at 4am on sunday

    * 4 * * Sun /root/backup.sh

    8. Restart the cron daemon

    crond reload

    9. Go make a cuppa and have a good sit down because you’ve just setup your backup.

    10. Work out how to amend the above to provide some logging that you can view using the built-in web-browser on the MyBook without filling up the disk and comment on here before I post how to do it.

    Extra info on ftpcopy: http://www.ohse.de/uwe/ftpcopy/ftpcopy.html

    Extra info on cron:  http://www.unixgeeks.org/security/newbie/unix/cron-1.html