{"id":204,"date":"2010-09-17T00:09:08","date_gmt":"2010-09-16T23:09:08","guid":{"rendered":"http:\/\/simkin.org\/wordpress\/?p=204"},"modified":"2010-09-22T00:59:16","modified_gmt":"2010-09-21T23:59:16","slug":"wd-mybook-as-a-backup-device-for-another-mybook","status":"publish","type":"post","link":"http:\/\/simkin.org\/wordpress\/?p=204","title":{"rendered":"WD MyBook as a backup device for another MyBook"},"content":{"rendered":"<p>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.<\/p>\n<p>With the old Thecus N299 (don&#8217;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.<\/p>\n<p>As I&#8217;ve forked out \u00c2\u00a3100 on the single-disk MyBook, I wanted a better backup solution. \u00c2\u00a340 later I have the second MyBook. How to make it a backup?<\/p>\n<p>There are lots of details on the <a href=\"http:\/\/mybookworld.wikidot.com\/start\">MyBook Hacks wiki <\/a>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 href=\"http:\/\/martin.hinner.info\/mybook\/sshaccess.php\">a hack<\/a> to get the same but is safe enough and worth the trouble.<\/p>\n<p>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.<\/p>\n<p>A short script later along the lines of this to copy anything new in the last 30 days:<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 0cm;\">ftpcopy -u myname -p mypasswd -m 30 192.168.1.11 simkin \/shares\/internal\/SIMKIN<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 0cm;\">OR if you want to mirror (like Microosft SyncToy) do this:<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 0cm;\">lftp -c &#8216;open -e &#8220;mirror \/myshare\/ \/shares\/internal\/MYSHARE&#8221; -d -u myname,mypasswd 192.168.1.11\u00e2\u20ac\u2122<\/p>\n<p><img class=\"aligncenter\" src=\"http:\/\/simkin.org\/images\/mybook\/mybook-backup.jpg\" alt=\"MyBook Backup\" \/><\/p>\n<p>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.<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 0cm;\">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.<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 0cm;\">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&#215;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.<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 0cm;\">&#8212;&#8212;-<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 0cm;\">The Spoon-feed:<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 0cm;\">I assume you have a blue-ring and white stripe WD MyBook sitting on your network as follows:<\/p>\n<p class=\"MsoListParagraph\" style=\"margin-left: 0cm;\">MyBook #1 (Primary):<\/p>\n<ul>\n<li>This is the newer <a href=\"http:\/\/support.wdc.com\/product\/download.asp?groupid=117&amp;lang=en\">&#8220;white stripe&#8221;<\/a> model &#8211; WDH1NC10000, WDH1NC20000.<\/li>\n<li>192.168.1.101<\/li>\n<li>There is a user called &#8220;myuser&#8221; with password &#8220;mypasswd&#8221;<\/li>\n<li>There is a share called &#8220;myshare&#8221;<\/li>\n<li>ftp server is enabled<\/li>\n<\/ul>\n<p class=\"MsoListParagraph\" style=\"margin-left: 0cm;\">MyBook #2 (Secondary):<\/p>\n<ul>\n<li>This is the older <a href=\"http:\/\/support.wdc.com\/product\/download.asp?groupid=106&amp;lang=en\">&#8220;blue circle&#8221;<\/a> model &#8211; WD5000G032, WD7500G032, WD10000G032.<\/li>\n<li>192.168.1.102<\/li>\n<li>There is a user called &#8220;myuser&#8221; with password &#8220;mypasswd&#8221;<\/li>\n<li>There is a share called &#8220;myshare&#8221;<\/li>\n<li>No hacks have been undertaken so far.<\/li>\n<\/ul>\n<p>All the following activity happens on the older &#8220;blue circle&#8221; model, MyBook #2:<\/p>\n<p>1. Enable SSH<\/p>\n<p style=\"padding-left: 30px;\">http:\/\/martin.hinner.info\/mybook\/sshaccess.php<\/p>\n<p>2. Follow instructions to make sshd boot every time. It involves using vi to edit \/etc\/inittab. Here is the 30 second guidebook:<\/p>\n<p style=\"padding-left: 30px;\">By default, vi starts in command mode which means if you start typing you will just wreck the file.<\/p>\n<p style=\"padding-left: 30px;\">Instead, use the h(left)j(down)k(up)l(right) keys to move around the file<\/p>\n<p style=\"padding-left: 30px;\">i will put you into insert mode. Type what you want and press &lt;ESC&gt; to get back to command mode.<\/p>\n<p style=\"padding-left: 30px;\">a will put you in append mode. Type what you want and press &lt;ESC&gt; to get back to command mode.<\/p>\n<p style=\"padding-left: 30px;\">x will delete the character to the left of the cursor<\/p>\n<p style=\"padding-left: 30px;\">dd will delete the whole line<\/p>\n<p style=\"padding-left: 30px;\">When in command mode, &lt;ESC&gt;:wq!\u00c2\u00a0 will write the file (save it) and quit. :q!\u00c2\u00a0 will exit without saving.<\/p>\n<p style=\"padding-left: 30px;\">Adding the line to inittab works something like this:<\/p>\n<p style=\"padding-left: 30px;\">vi \/etc\/inittab<\/p>\n<p style=\"padding-left: 30px;\">kkkkki::sysinit:\/usr\/sbin\/sshd&lt;RETURN&gt;&lt;ESC&gt;:wq!<\/p>\n<p>3. Change the root user password from blank to something you can remember:<\/p>\n<p style=\"padding-left: 30px;\">passwd welc0me<\/p>\n<p>4. Install Optware:<\/p>\n<p style=\"padding-left: 30px;\">wget http:\/\/mybookworld.wikidot.com\/local&#8211;files\/optware\/setup-optware.sh<\/p>\n<p style=\"padding-left: 30px;\">sh setup-optware.sh<\/p>\n<p style=\"padding-left: 30px;\">echo &#8220;\/opt\/lib&#8221; &gt;&gt;\/etc\/ld.so.conf<\/p>\n<p style=\"padding-left: 30px;\">ldconfig<\/p>\n<p style=\"padding-left: 30px;\">vi \/root\/.bashrc\u00c2\u00a0\u00c2\u00a0 <em>and add this line:<\/em><\/p>\n<p style=\"padding-left: 60px;\"><span style=\"color: #800080;\">export LD_LIBRARY_PATH=\/opt\/lib<\/span><\/p>\n<p style=\"padding-left: 30px;\">echo &#8220;export PATH=$PATH:\/opt\/bin&#8221; &gt;&gt; \/root\/.bashrc<\/p>\n<p style=\"padding-left: 30px;\">echo &#8220;export PATH=$PATH:\/opt\/bin&#8221; &gt;&gt; \/etc\/profile<\/p>\n<p style=\"padding-left: 30px;\">\/opt\/bin\/ipkg update<\/p>\n<p>5a. Install ftpcopy rather than lftp<\/p>\n<p style=\"padding-left: 30px;\">\/opt\/bin\/ipkg install ftpcopy<\/p>\n<p>5b. OR Install lftp instead of ftpcopy<\/p>\n<p style=\"padding-left: 30px;\">\/opt\/bin\/ipkg install libiconv<\/p>\n<p style=\"padding-left: 30px;\">\/opt\/bin\/ipkg install lftp<\/p>\n<p>6. Create a backup script<\/p>\n<p style=\"padding-left: 30px;\">cd \/root<\/p>\n<p style=\"padding-left: 30px;\"><em>Use <strong>vi<\/strong> to create a file called <strong>backup.sh<\/strong> containing this line<\/em>:<\/p>\n<p style=\"padding-left: 60px;\"><span style=\"color: #800080;\">ftpcopy -u myuser -p mypasswd -m 30 192.168.1.11 myshare \/shares\/internal\/MYSHARE<\/span><\/p>\n<p style=\"padding-left: 60px;\">or<\/p>\n<p style=\"padding-left: 60px;\"><span style=\"color: #800080;\">lftp -c &#8216;open -e &#8220;mirror \/myshare\/ \/shares\/internal\/MYSHARE&#8221; -d -u myuser,mypasswd 192.168.1.11\u00e2\u20ac\u2122<\/span><\/p>\n<p>7. Make it run at 4am every sunday morning<\/p>\n<p style=\"padding-left: 30px;\">vi \/etc\/crontabs\/root\u00c2\u00a0\u00c2\u00a0 <em>and add these lines:<\/em><\/p>\n<p style=\"padding-left: 50px;\"><span style=\"color: #800080;\"># run the backup script at 4am on sunday<\/span><\/p>\n<p style=\"padding-left: 50px;\"><span style=\"color: #800080;\">* 4 * * Sun \/root\/backup.sh<\/span><\/p>\n<p>8. Restart the cron daemon<\/p>\n<p style=\"padding-left: 20px;\">crond reload<\/p>\n<p>9. Go make a cuppa and have a good sit down because you&#8217;ve just setup your backup.<\/p>\n<p>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.<\/p>\n<p>Extra info on ftpcopy: http:\/\/www.ohse.de\/uwe\/ftpcopy\/ftpcopy.html<\/p>\n<p>Extra info on cron:\u00c2\u00a0 http:\/\/www.unixgeeks.org\/security\/newbie\/unix\/cron-1.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I bought a new MyBook World Edition from PC World and another older model from ebay. The ebay one is &hellip; <a class=\"more-link\" href=\"http:\/\/simkin.org\/wordpress\/?p=204\">More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[3],"tags":[231,141,229,230],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/204"}],"collection":[{"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=204"}],"version-history":[{"count":0,"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/204\/revisions"}],"wp:attachment":[{"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=204"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}