Western Digital MyBook as a Backup System
June 17th, 2009
I came to the realization that I have too many computers constantly running in my house. It’s not so much a “go green” thing to use less electricity as it is me being cheap and wanting to lower our bill. It’d also be nice to walk in a room and hear silence rather than whirring computer fans or have to clean dead spiders from multiple desktops. After reading an article in Linux Journal about hacking the MyBook (external network drive that runs linux under the covers), it looked like it could serve a lot of uses, starting off with being the house file server and backup system.
So far, I’m off to a good start. To begin with, the Linux Journal article is already somewhat obsolete as there’s no need to hack it anymore. The latest firmware flat out gives you the option to enable SSH on the device; once you’re in you can do pretty much whatever you want. One click in the web UI and one terminal later, I was logged directly into the system.
The MyBook runs BusyBox linux. I’ve never worked on a stripped down linux install like this, but other than missing a few commands I’ve come to love (I continue to type less; my brain just refuses to acknowledge that it’s not there) it’s pretty easy to navigate if you’re comfortable on linux.
Initial Setup
The instructions tell you to install the included software which only runs on Windows, at which point I promptly said f-that and tossed the guides. Once you plug the box into the network, it will use DHCP by default to get an IP. Use your preferred means for figuring out that IP, such as checking your router logs for the lease information. I went a different route and just port scanned my network looking for an IP I didn’t recognize.
-> nmap -sP 192.168.0.1/24 Starting Nmap 4.76 ( http://nmap.org ) at 2009-06-16 17:42 EDT Host 192.168.0.1 appears to be up. ... Host 192.168.0.112 appears to be up. ...
I snipped out the rest the results, but you get the idea. I only have a handful of non-static IPs internally so it wasn’t too hard to figure out which one was new. The box runs lighttpd and has a pretty slick (albeit a bit slow) interface to most of its guts, so after digging the included CD out of the trash to look up the default password, I was able to connect to it and start dorking around.
The MyBook comes with a lot of features, with the small caveat that I don’t actually need most of them. So the first thing I did was run around disabling things. It’s very cool that the device supports Samba and AFP, but frankly, I just don’t need them (I’ve had the wife running linux for years now, she rocks). I also killed FTP and the Mionet software. It wasn’t all slash and burn; I enabled SSH and NFS and made a new user for myself. Ultimately I’ll turn off the daemon that controls the slick white light on the front of it, but the novelty is still there and it looks damn cool at night (and really creeps my wife out since the light pulsates).
At that point, I was able to SSH into the box and (potentially) really get myself in trouble.
Enabling Cron
The file sharing aspect of the box is very handy, but part of wanting a device I could hack away at is to have it do more than just be a dumb file server. To start with, I want it to run out and backup my web sites (this blog included) nightly. I have a series of scripts on the system this is replacing that already do the task, it was just a matter of getting the MyBook to do them.
Cron is on the system, but it doesn’t work out of the box. I had to make one small change: creating the directory in which it’s going to store the schedules.
mkdir /var/spool/cron/crontabs
Here’s where I got lazy. I just set the permissions on the cron and crontabs directories to 777 to make my life easier. It’s far from secure, but I’ll work on that later. For now, I just wanted to get my non-root user to be able to schedule things.
The other change that needed to be made was to start the crond daemon. I didn’t find anything in the web UI to support this, but given the rate at which the firmware is exposing functionality I wouldn’t be surprised to find it there in the near future. I hacked up a pretty rudimentary init.d script so it would auto-start on reboot and was on my way.
SSH
Once I had the ability to schedule tasks, I needed the MyBook to be able to log into my web server. The ssh client is already installed, however it took a bit of hacking to get to a point where I could generate public/private keys to automate the login.
The main issue is that the home directory for all created users is simply defaulted to /shares. That directory serves as the root of all of shared files. Not that I’m expecting to create a ton of users, but I didn’t like the idea of a single .ssh directory for all users. I didn’t find any user mod tools on the install, so I just changed the /etc/passwd file to give my user a different (read: private) home directory. After that, it was as simple as running ssh-keygen like any other linux system (I won’t get into those details here, but it’s pretty easy to google around for generating SSH keys).
After installing the public key on my webserver, I was good to go for automatically logging in.
Rsync
I was happy to find
rsync was installed and working out of box. Between that and scp, I was pretty set for my current backup needs.
Profit
The rest of my backup automation fell into place. I had to edit my scripts a bit since the MyBook doesn’t come with bash, but otherwise the rest of the process was painless. Nightly, my MyBook runs out to my webserver, backups a snapshot of the database, and copies over any changed files. All of this from a 6 inch by 6 inch little box on my desk. The desktop that previously did this has been powered down since the weekend. Awesome.
I’ve also copied over the “family” shared files to the MyBook, such as music and pictures. It was done simply through NFS so I won’t go into details here other than to say that there were no unexpected hiccups in the process.
There’s more I want to tinker with on the box. The web UI is in PHP and after a bit of looking around, I was able to find and start editing the web UI site. I’m thinking of adding my own section that will at very least report on the previous night’s backups. I’ll get to that eventually, for now I’m happy to have replaced one of the desktops in my house.

Mission Control
June 10th, 2009
In case you haven’t noticed, there is a pretty common theme among geeks: “Because I can.”
One of the things I was looking forward to in Fedora 11 is better support for dual monitors. I wasn’t disappointed, the UI is very intuitive and it just worked, allowing me to share my laptop screen onto a spare monitor (seriously, I have too much hardware just lying around). So my home office now looks like:

Something else to realize is that with my synergy setup, a single mouse/keyboard is used to control both systems, meaning I can move the mouse from the leftmost side of the laptop to the rightmost side of the right monitor, an act that currently requires me to pick the mouse up to get more space 6 times (yes, I actually counted).
Not sure how long I’ll try this setup out; I’m guessing I’ll have a wicked headache before lunch. But that doesn’t change the fact that my office looks like a NOC right now.
I love you, Newegg
June 9th, 2009
I ordered the replacement video card for my MythTV box–
Actually, that’s not entirely accurate. I could have ordered a cheap replacement card for the Myth box. All it really needs to do is output to DVI, nothing fancy. The alternative is to take my video card from my gaming rig and move that to the Myth box, providing a reason to upgrade my gaming rig. That’s way more expensive, but I was careful to just tell the wife “I ordered a replacement video card.” I never said if I was using a cost optimal solution.
Where was I… oh ya, so I ordered a new video card yesterday at lunch. It arrived today at lunch. For no extra charge. When science perfects instant teleportation of objects, Newegg is going to raise the bar by just guessing at what hardware you need and sending it before you realize you need it.
*Poof*
June 9th, 2009
Last week I was catching up on some shows I recorded on my MythTV box (essentially a computer made into a home made Tivo) when the picture just disappeared. When I rebooted, it didn’t even show the BIOS, so I figured the video card died. I built the box back in 2004 and it’s always on, so it actually had a really good run.
While I’m waiting for the replacement card to arrive from newegg.com, I decided to take the existing card out, make sure the fan still spun, and reseat it back into the motherboard. It was worth a shot.
The inside of the box itself was a disaster. I try to air dust my desktops about once a month, but apparently I’m behind on this one. I tried to take a picture, but it doesn’t do it justice. I’ll simply point out that there is a dead spider inside.
Whenever I’m dealing with a piece of hardware that doesn’t work, I inevitably turn it around in my hands looking for… well, I don’t know what I’m looking for. I’m not an engineer, so short of seeing smoke coming from a part, no amount of physical inspection has ever yielded results.
This time was a bit different. Take a look at the second column of cylinders on the card below. I don’t know what they are or what they do, but I’m pretty sure the tops aren’t supposed to be blown out like that. The one closest to the camera even had what looked like ash coming out of it.


Might be time to plug in some of the fans I disabled to make the box run quieter.
And as a public service announcement, airdust your computer. It will love you for it.
Comment of the Day: You mean the bug, right?
June 8th, 2009
any joy on reproducing?
I sit in a number of non-Spacewalk/Satellite chat rooms at work. This was just seen in a conversation in one of those rooms discussing… well, to be honest, I don’t actually care what bug they were talking about. Taken out of context is way funnier.
Comment of the Day: We filter what?
June 5th, 2009
... // Now we filter out an List retval = new LinkedList(); ...
Shit. Ok, so it’s not too much code after that to see what the filtering is doing, but the comment still left me hanging.
Teaching an Old Dog
May 17th, 2009
I turned 30 a few weeks ago. Ok, so it’s probably time I learned how to ride a bike.
The actual learning process itself was pretty uneventful. My wife and I went up to the parking lot of the community pool, I got on her bike, and just went. No catastrophic falls, no accidentally riding into oncoming traffic. Twenty minutes later we were at Dick’s buying me my own shiny bike.
I became addicted. I’ve gone riding every day since then, even if it was just 30 minutes at lunch. I’m happy to report that I haven’t fallen yet. Though after that much riding that quickly, I have to admit that my ass is killing me.
That isn’t to say it’s been without incident. My wife and I have been taking the baby for rides after work (she has a baby seat on her bike, I’m not daring enough to risk Leanne’s well being, just my own). Every time we go, I insist we leave the front door unlocked. That’s in addition to my wife leaving the garage door unlocked when she closes it. Call me paranoid.
Call me unlucky too. The one time I forget to leave the front door unlocked is the one time I accidentally locked the garage door when I closed it. Seven years of instinct in simultaneously closing and locking the door kicked in before I realized it. Half a second after I heard the click I realized what had happened. Then I cursed. Loudly.
It gets worse. Here we find the family locked out of the house, yet I could see the spare key. It was in the little box attached to our front door for when realtors come to show the house. There it hung a mere 4 inches below the lock itself, mocking me.
I thought back to a month ago when we put the house on the market. The realtor gave us an option…
“Do you guys want the fancy digital one that only realtors can unlock or a combination one that you guys could unlock as well?”
The geek in me smelled technology.
“We’ll take the digital one. We’ve been here seven years and haven’t locked ourselves out yet, why the hell would we need the combo lock?”
In addition to my keys, I also left my cell phone inside. So on top of everything else, I had to suffer the indignity of asking a neighbor to borrow his phone so I could call our realtor to come let me in. To make sure I fully paint the picture of how big of a douche I looked like, realize I was wearing one of those stupid looking bike helmets at the time.
So one 45 minute bike ride later, our realtor showed up to let us back into our own house. Any longer and I was about to carry out my carefully devised yet extraordinarily stupid plan to scale the outside deck to the second floor screen door into the kitchen which, by our estimates, had about a 66% chance that we left it unlocked.
Getting back to the actual bike riding, the timing of my new found skill is great. I was running out of new options for cardio at the gym. We had been looking for something to do outdoors as a family. And I had been looking into possible Python projects for the summer, and I already know of a really cool combination of the two.
So what did I learn from this whole experience? Apparently not much, since I once again declined when the realtor offered to swap out the digital key holder for the combination one (I don’t think she wanted to be called out here again the next time we do this). Mmm… the sweet smell of digital technology on my front door…

