Sunday, February 22, 2015

The Time [Capsule] Machine

No posts for the past couple of weeks as I've been trying to track down an I/O error occuring on my OWC SSD, but that's a story for another day.  I'm positive it's the drives cable and not the drive itself.

Coincidentally, the errors started right after I had completed some configurations to mount my Apple Time Capsule as a CIFS volume on my Wheezy install, which happens to be the subject of this post.  About 5 or 6 years ago, my girlfriend (now my wife) and I invested in an 500 GB Time Capsule, model A1254, we could use to back up both of our Macs.  At the time, I only owned a white 2008 2.4 GHz Penryn MacBook (my first Mac) and had just started using it only a couple of months prior.  OS X Leopard had just come out and one of the major touted features was that of Time Machine; the quick and easy way to back up any Mac.  Because of those two reasons, we decided it would be useful to backup our more important school work.

Fast forward to present day, and I have since upgraded the drive in the Time Capsule (TC) from a 500 GB HD, to a 1TB, and eventually to a 2 TB 3.5" hard drive.  I'm having hard time remembering what brand I installed and the RPMs. I have also recently replaced the internal power supply as the Time Capsule finally kicked the bucket one day, but I had been expecting it as the handy little machine had been chugging nonstop 24/7 365 for almost 5 years.  The little guy is currently the backup device for my wife's iMac (she is a photographer), the backup for our MacBook Pro, and the backup for my OS X Leopard install on the G4 PowerBook.  It may seem like a bad idea having all of these eggs backups in one basket, but I also routinely make bootable clones of each of my systems using SuperDuper, a utility I know many are familiar with along with Carbon Copy Cloner.

If you don't currently own a Time Capsule, I'd encourage you to check them out as they can be quite useful in several different regards.  The first is that it can act as a networked storage device for storing your files or backups, create its own Wi-Fi network supporting even 802.11n (which was only in draft at the time) or bridge an existing Wi-Fi network and extend the signal by acting as another available access point (AP).  Other notable features include NAT firewall, MAC address filtering, and RADIUS authentication support. Some of the newer models obviously offer newer wireless protocols and features, but I'd save some cash and go with an older model such as the one we own.  Replacement parts are cheap and it is relatively straightforward to gain access to the Capsule's innards. I should also add it also contains a single USB port for you to attach yet another external drive and I currently have an external 1 TB Seagate attached to the USB port.  And last not but not least, it contains 3 Gigabit LAN ports and a single Gigabit WAN port for reliable wired connectivity. 

Anyways, I want to use it as a backup source for my Debian install as well. I haven't quite narrowed down what I want to deem worthy of backing up, but I'm positive it will consist of my etc directory as well as my home directory.  Eventually I'll look into what existing backup utilities are available and review them on this blog, but for now, I will write simple shell scripts to back up a few things I find important and necessary. I also plan to create a bootable clone of my Wheezy system onto an external HD.

After a bit of online research and light reading, I discovered the most common way of mounting the TC was using the Common Internet File System (CIFS), although mounting as an AFP share was possible as well if you installed the netatalk utility. I wanted to keep things fairly simple and since mounting it as a CIFS share was feasible without the need for installation and configuration of additional software, I went that route.  I should add here that another part of this set up is that I want access to the disk share to be secured via account authorization instead of having it freely available for anybody to mount and peruse.  In short we need to complete the following tasks:
  1. Set up an dedicated account for Debian to use for access
  2. Determine Time Capsule's IP Address or Hostname
  3. Mount the network share using the mount command.
  4. Optionally configure it to be mounted at startup
So let me describe the necessary steps to set this up using Apple's Airport Utility in OS X. I'll be doing this from Airport Utility v5.6.1, which also happens to be the last version made available to OS X Leopard.

  1. Select and authenticated with your Time Capsule as well as select the option to make changes (versus restoring the unit to factory settings).  
  2. Skip the option to change the TC's name and access password or change it if you feel the need
  3. The second screen you reach after hitting Continue is the place where you can edit and update your Time Capsule's disk sharing settings. Select the option to Change these settings.  Under the Secure Shared Disks: option, select the option With accounts from the drop down menu. 
  4. Now you should be able to click the + to add as many accounts as you would like.  For each account you should set the username, password, and set the account to have read and write access.  Obviously you can select the other available permissions as well if the need is there.
  5. Under the option, Airport Disk Guest Access, I'd recommend Not Allowed since you are taking the time to set up account based access.  
  6. From there, go ahead and click Continue repeatedly until you come across Finish where you can apply your changes to the Time Capsule.
Now that is out of the way we can work on actually mounting the share. Before we can do that though, we need to know the TC's IPv4 address or DNS hostname, which you can obtain using a number of different methods such as using Apple's Airport Configuration Utility in OS X, your router's DHCP table available from its web interface, or using a utility such as Angry IP Scanner.

Onto step 3.  As mentioned, we need to use the well known mount command to make the share available for use.  Now, there's a plethora of information available in this command's man pages, but eventually I constructed the following command:

sudo mount.cifs //192.168.66.7/Data /media/Backup -o username=MyUser,password=MyPass,uid=1000

Let's break this command down piece by piece so we're aware of exactly what it is accomplishing for us.
  • mount - the command keyword telling Debian we are wanting to mount another filesystem available via a directly attached device or network share
  • //192.168.66.7/Data - the IPv4 address and mount point of the share you created on your Time Capsule
  • /media/Backup - Destination folder for mounted share.  This could be anywhere you wanted, but I'd keep it either under /media or /mnt
  • cifs - tells the system the share is of type CIFS
  • -o - specifies you are providing an additional list of options
  • username= - the user created with access to the TC share
  • password= - password of the user above
  • uid= - sets the owner of the filesystem share.  In my case, I set it to 1000 as that is my user account id.
Last but not least, let's add the necessary addition to our /etc/fstab file so the new CIFS share is mounted automatically when the system boots.  A lot of what you see here is almost exactly what was used to originally mount the share, so no surprises here.  Note the / at the end of line 2.  Merely a means to indicate the command continues on the next line.

# Mount CIFS Backup Share
//192.168.66.7/Data /media/Backup /

cifs /username=MyUser,password=MyPassword,uid=1000 0 0

Save the changes and reboot to the awesomeness.

Simple enough am I right?  Luckily, there's a lot of documentation and other blog posts about this exact same topic, but hopefully all the information here helps you get the job done in one fell swoop.  If you want to make this work with your own Time Capsule and run into any issues, let me know and I'd be glad to help.  Given that my blog is dedicated to making the most out of our older aging hardware, I thought this would be an excellent way to continue using an older network storage device to store or backup your files for you on a still supported PPC OS.

I do have an update on the 1400 PB coming down the pipe.  And yes, the Clang post is coming too.  I'm just slow moving and always more nervous about posts regarding coding. :) Anyways, in the words of Joe Dirt, "Keep on keeping on."