Sunday, February 20, 2011

Time Machine backups on plug computer

I found a lot of posts on how to configure a TimeMachine to work on USB hard drive over the network. But it wasn't such an easy setup. I didn't work on the first run, and ran quite unreliably.

The basic idea of how to do this is to first create a sparsebundle, where the backup will be stored. Then move this bundle to the machine that will host the backup. Then configure AFP (atalk) to make the sparsebundle accessible to the Mac. That's it. Here are the links I found most useful:

Create sparsebundle: Setup AFP and Avahi:
And here are my findings on how to make all this work:
  • I tried placing the sparsebundle first in on a hfsplus (Mac formatted) disk. That didn't work well, probably because the Linux box doesn't work well with this format. I then tried using ext3 format, and that worked great;
  • In the end, I had to create a backup from scratch. Some some reason, the previous TimeMachine backup I had didn't work so well. Maybe it will work for others.

Streaming videos from plug computer

Plug computers are great. I have a SheevaPlug, made by Marvell. In essence, it gives me a Linux box running 24/7, consuming only an average of 5W. My setup has two WD 500GB Passport USB hard drives, running Amahi. It's pretty cool.

It serves my music, using Squeezebox server (I have the SqueezeBox Boom), videos, performs my TimeMachine backups and backs up my other computers (using Unison). I have to admit, it wasn't such an easy setup, but it's working great and pretty reliably today.

One of the biggest issues of using the SheevaPlug, which runs on an ARM processor, is that not everything runs on such processors. Today, I was trying to run Videos5 on plug computer, an app that encodes videos in H264 format, so that your videos can be streamed to pretty much any device, from your iPhone, computer, Blackberry, etc. Videos5 uses HandBrakeCLI to encode the videos, but that doesn't work on the ARM processor when encoding in H264 format.
So I just did a quick workaround, and changed the encode command so as to performed the encoding on a different machine, then send the video back to the plug.

This is the script I used to do that:
#!/bin/bashDIR=`dirname $1`FILE=`basename $1`OUT_FILE=`basename $2`REMOTE_DIR='./Downloads/'HANDBRAKE='/Users/rlotufo/bin/HandBrakeCLI'HOST='rlotufo@vilasaojoao'
scp $1 $HOST:$REMOTE_DIRssh $HOST "nice $HANDBRAKE -L -i $REMOTE_DIR/$FILE -o $REMOTE_DIR/$OUT_FILE -e x264 -q 20.0 -a 1 -E faac -B 160 -6 dpl2 -R 48 -D 0.0 -f mp4 -X 720 -Y 480 --loose-anamorphic -m -x cabac=0:ref=2:me=umh:bframes=0:8x8dct=0:trellis=0:subme=6; if [ \$? == "0" ]; then rm $REMOTE_DIR/$FILE; fi"
scp $HOST:$REMOTE_DIR/$OUT_FILE $DIR/$OUT_FILEif [ $? == '0' ]; then
ssh $HOST "rm $REMOTE_DIR/$OUT_FILE"fi
For that to work, you need to configure ssh to login without password. Then you need to change the encode command in Videos5:
bash> mysql videos5 -u videos5 -p (password is videos5)
msql> update settings set value = 'path-to-script/script.sh $input $output' where name = 'encode_command'
That's it. But I'm still waiting for a better service to stream my videos to my TV. A friend recommended the WD Live TV, but that requires a wired LAN connection, and apparently, NetFlix service only works in the U.S. I'm really looking forward for Google TV to finally be a success (damn those media companies who are blocking Google TV!). Logitech Revue seems to be an interesting device, particularly because it a computer to you TV, with good input devices.

Today, I plug my computer to my TV, but you need to have a separate keyboard and mouse, which is pretty terrible. I currently watch my Netflix using Wii, which works well, as Wii is just point and click. It's only bad when you need to search for something.

So I'm still working on perfecting my media center with my plug computer. In the future I'll add some more posts on how I set up my TimeMachine backups, and backups with Unison.