Sunday, November 30, 2014

Using Raspberry Pi as a Time Capsule to backup a Mac


Time Machine is the built-in backup feature of OS X. It keeps a copy of all your files, and remembers how your system looked on any given day so you can revisit your Mac as it appeared in the past. Apple sells a device called a Time Capsule, but rather than buy one of these I opted for a diy approach using my Raspberry Pi and so far it seems to be working well.

My setup consists of:
  • Raspberry Pi Model B running Raspbian connected via network cable to a router
  • MacBook Pro running OS X Yosemite v10.10.1 connected via Wifi to a router
  • External 2TB drive (with separate power) attached via USB to the Raspberry Pi
It was relatively easy to setup following the instructions at http://www.raspberrypi.org/forums/viewtopic.php?f=36&t=47029 . I am reiterating the instructions here just in case the page disappears (with a couple of additions I needed):
1. Start with a clean installation of Raspbian, configured for your network

2. Power down your Pi, connect your storage drive, and boot your Pi back up.

3. Since my Pi only has 2 USB ports, I wasn't able to have a Keyboard, Mouse and USB drive connected without using a USB hub. Since I didn't want to use a USB hub I installed a VNC server on the Pi and a VNC client application on the Mac using instructions from http://www.raspberrypi.org/documentation/remote-access/vnc/ which can be summarised as follows.
$ sudo apt-get install tightvncserver
$ tightvncserver
$ vncserver :0 -geometry 1920x1080 -depth 24

4. Install netatalk and gparted
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install netatalk gparted

5. Start up the graphical desktop on your Pi using startx, and run gparted (it's under "preferences" in your start menu). Select your storage drive (not your SD card), delete any existing partitions, and create a new single partition of type ext4. Then exit gparted.

6. Set your Pi to connect to your storage drive when you boot, and create a place in your Pi's filesystem for it to go
a) create the directory with appropriate permissions
$ sudo mkdir /mnt/TimeMachine
$ sudo chmod 777 /mnt/TimeMachine
b) setup auto boot
$ sudo echo "/dev/sda1 /mnt/TimeMachine ext4 defaults 0 2" >> /etc/fstab
This command came up with a Permission denied error so I instead manually updated the /etc/fstab file using nano with the entry in quotes (/dev/sda1 /mnt/TimeMachine ext4 defaults 0 2) added at the end.
$ sudo nano /etc/fstab
c) mount the drive
$ sudo mount /dev/sda1

7. Configure netatalk to share the directory
a) setup netatalk
$ sudo echo "/mnt/TimeMachine \"Time Machine\" options:tm" >> /etc/netatalk/AppleVolumes.default
This command came up with a Permission denied error so I instead manually updated the /etc/netatalk/AppleVolumes.default file using nano with /mnt/TimeMachine "Time Machine" options:tm added at the end (Note: the \'s have been removed from the echo command).
$ sudo nano /etc/netatalk/AppleVolumes.default
b) restart netatalk
$ sudo service netatalk restart

8. On your Mac open your Time Machine preferences, click Select Disk, and choose Time Machine on raspberrypi. I found initially that I couldn't find the Time Machine share so I went to Finder and connected to the Raspberry Pi at afp://pi_ip_address

9. The backup should commence after a couple of minutes.

Raspberry Pi is a trademark of the Raspberry Pi Foundation
Apple, Mac, MacBook, MacBook Pro, OS X, Time Capsule and Time Machine are trademarks of Apple Inc.

Saturday, June 21, 2014

Book Review: The 4-Hour Work Week: Escape the 9-5, Live Anywhere and Join the New Rich

"The 4-Hour Work Week: Escape the 9-5, Live Anywhere and Join the New Rich" by Tim Ferriss is one of those books I had heard about but not got around to reading until now.

My key takeaways:
  • Think about what parts of your work or personal life you could outsource to free up time to do other things (some good references are provided in the book such as elance, Your Man In India and Brickwork). 
  • There are some good reminders about time management, handling interruptions, testing (even down to product name testing via Google AdWords) and keeping it simple for the customer by reducing the number of decisions they need to make.
  • Some good advice was provided about having a minimum advertised pricing clause in order to prevent wholesaling wars (not only by organisations, but also by discounters on eBay)
  • There are some useful links to tools and sites to get a website up and running quickly, some good advice about projecting that your company is bigger than it is (e.g. by having multiple email addresses for multiple departments) and using this as an enabler to scale later.
I skimmed over many of the other parts of the book since it was a bit too verbose.

Sunday, January 12, 2014

Book Review: Nikola Tesla: Imagination and the Man That Invented the 20th Century

I found Nikola Tesla: Imagination and the Man That Invented the 20th Century to be a very quick read and a well written synopsis of Nikola Tesla and imagination. I had heard of Tesla but didn't know much more and this book was a great introduction to an amazing person and a great inspirational read about genius being a path anybody can take, never giving up, thinking being the enemy of creativity and varied knowledge and experiences being more likely lead to fresh ideas. It is not a book for getting an in depth understanding of Tesla or in depth information about self improvement or imagination, but it is a good short inspirational read.