Posts Tagged ‘organize’

Automatically backup your Mac to Amazon S3

Friday, February 1st, 2008

With the new version of OS X (Leopard) Apple has included some great functionality in Time Machine. Your Mac will automatically backup to an external drive every hour. It includes the ability to recover deleted files in a timeline. The one downside to the Time Machine approach is that the data isn’t remotely stored. A couple years ago my wife and I had a house fire where most of our things were destroyed. Fortunately the fire was extinguished before it spread to where our computers were so we didn’t lose any data. If it had been elsewhere in the house it could have been a serious situation for us if we lost all of our digital files.

After the fire I have followed a manual process of backing up our files on an external drive that I store in our fire safe. The problem with this is it requires me to actually do the work, which I often put-off. When Amazon S3 was introduced I immediately saw the potential to use it as an automatic remote backup source. I hadn’t invested much time in it up until now, but I just got a new computer (MacBook Air!!) and while setting it up I thought it would be a good opportunity to get my backup situation in order.

There are some great tools already in existence that can do most of the heavy lifting for you. The primary tool for doing remote directory syncs is called s3sync which is a script written in Ruby. Lucky for us OS X comes with Ruby pre-installed so there isn’t much work to get it working.

Here is my step-by-step guide to getting your machine setup to do automatic daily backups to Amazon. I developed these steps on my MacBook Air running Leopard however they should work for previous versions of OS X as well.

Step 1) First off, your going to need and Amazon Web Services account. Head over to http://aws.amazon.com/ and sign-up for an account to use S3. The prices are very cheap ($0.15/GB/Month). Once you have your account setup you will need two things to use Amazon S3. Your Amazon access key and your secret key. These are what s3sync will use to authenticate you to Amazon.

Step 2) I’ve packaged together a zip file with all the files you are going to need to get this setup along with SSL. Download the file at http://vallery.net/s3backup.zip. You can go to http://s3sync.net/ to see if a newer version if you like but you’ll need to figure some of this out on your own.

Step 3) You need to create a “bucket” in amazon to store your files. A bucket is similar to a folder, however it is globally uniquely named across all Amazon S3 users. In order to create the bucket you are going to need one of the S3 GUI applications that exist. I have included in the zip file the one I have used called “S3 Browser”. You can find the latest version at http://people.no-distance.net/ol/software/s3/. Once you launch S3 browser click on “connection” then “new connection”. You’ll need to provide the access details you got from Amazon in step 1. Once you have connected click the “Add” button which will allow you to create a new bucket. Because the name has to be globally unique I used “vallery-macbookair-backup” where vallery is my last name. Keep track of this bucket name because you need it in the next step.

s3browser.png

Step 4) Once you have the zip file I created downloaded it should automatically extract itself into your downloads folder creating a new folder called “s3backup”. Within the s3backup folder are all the files and scripts you will need in order to get this working. There is one key file that needs to be edited in order to make this all work which is called “backup.sh”. Open the file “backup.sh” and replace the place holder access key, secret key, bucket name with the ones you obtained form Amazon and step 3.

backupsh.png

Step 5) Now that you have all the files ready to go you need to select a place to store them. The application will run as root at the system level in order to prevent file access issues, therefore I recommend storing the entire s3backup folder in your /Library folder. You should copy the entire folder using finder to /Library. There are a few other paths in “backup.sh” that will need to be updated if you choose to store the file elsewhere.

Step 6) You need to setup your Mac to automatically run the backup shell script on a regular interval. There are a couple ways to do this. Since I am Unix guy I immediately started looking at cron. I discovered however that Apple recommends you use launchd for scheduled tasks. It is fairly complex to setup a scheduled task using launchd but thankfully someone has already created a simple GUI that will let you do it. The application Lingon can be used for this. I’ve included the latest version at the time of writing this in the s3backup directory but you can always obtain the latest version from http://lingon.sourceforge.net/. Once you have launched Lingon you need provide some information. Click the “New” button to start a new agent. Choose “Users Daemons” so that the script will run as root and have access to all of the users on your Mac. Once you have created your new daemon you need to give it a name. I recommend something like com.vallery.s3backup where vallery is your name. You need to give the command line action for what to execute. Again, this assumes that you have stored the s3backup folder in /Library. Enter: “/bin/bash /Library/s3backup/backup.sh > /dev/null”. Lastly you need to give it a schedule as to when to run. I have mine setup to “At a specific date” with “Every day” selected and the time set to 4:00am. This is great if your leave your Mac on all the time. You might select a different option so that you can make sure your Mac isn’t in use when it is doing the backup. Click the “Save” button. It will require you to type in your admin password and then restart your computer.

lingon.png

That is it, your system should run the first backup as schedule. It will take a long time initially as the upload speed is limited to your internet connection. Once the initial upload has taken place it will only upload files that are new or have changed going forward. The script is setup to backup everything in the /Users folder. If you would like to limit what is being backed up you can change this to something else.

In the unfortunate event you actually need to get data out of the s3 store there are a number of applications that you can use to do this. Initially I have been using Panic’s Transmit however it seems to have problems with the way s3sync is storing the data. I found another great free app called “S3 Browser” which has worked well for me. You can also use the Firefox plugin S3 Fox.

10 steps to organize your digital life on OS X and Windows

Tuesday, April 10th, 2007

In meat space my wife and I are far from organized. It’s a real problem because we are always losing important things like our car keys. Unfortunately, this how-to won’t help me solve that problem. In the digital world however, I’m extremely anal retentive and organized. Everything is in its place and easily searchable. It allows me to be much more productive since I don’t have to waste my time trying to find things. I’m using a Mac and OS X Tiger at home and Windows XP in my day job at work, so that even further complicates my digital lifestyle. A lot of these tips can be platform agnostic and work under Windows and Linux as well. These suggestions work hand in hand with an indexed search capability. In OS X we have the built in, and fantastic, Spotlight. On Windows XP you can download Google Desktop. Of course Windows Vista has search built in. On Linux, if you are using Gnome there is Tracker. Also on OS X, take a look at Quicksilver

In no particular order my tips are:

1) Directory structures: In your personal document space (Your home directory on a Mac or Linux, “My Documents” on Windows) you need to create a document hierarchy to store your files. Depending on the amount of documents that you store, your system might include date as a component of the hierarchy so that your folders don’t become too large and unmanageable. I first divide my home directory up with a folder for each of the categories of documents that I might have. Word processing, spreadsheet, presentation, and notes. Under that I have it broken down by type. These are categories of the types of projects I might be working on. At work, this is the name of which of my clients for whom the document is relevant. From there, I have sub-directories for each year. 2007, 2006, and so on.

2) File names: All of my files are named with a standard convention. The convention is PROJECT/CLIENT_DESCRIPTION_YYYYMMDD_TYPE.EXT. Including the document type is helpful because sometimes the file extension doesn’t always give it away, or on some machines file extensions might be hidden. So for example if I had a Excel document for a client named Acme that contained a data extract, I would name the file ACME_DATAEXTRACT_20070410_EXCEL.xls

3) Music: I use iTunes to manage my music library. Part by force, since I own 4 iPods and an Apple TV, but part because I enjoy it. I think iTunes is a great interface for music management. I’ve done a few extra things in iTunes that help me stay organized. One of the most important data fields on a music track I find is “Album Artist”. This field is a recent addition to iTunes, but it really makes finding my music easier, especially from the iPod interface. For the music you purchase from the iTunes store, this is typically done for you already. If you’ve ripped your CDs, the CDDB database doesn’t always have this information however. The first thing I do after I’ve ripped a new CD is go and verify if the Album Artist field has info, and that it is correct. If not I manualy update this field based on the artist. This is especially useful on CDs that have a large number of collaborations on them. The second iTunes tip I have is use the rating system. When you are listening to your music, take the few seconds to go and rate the song. If you have a large music library, it is really handy to be able to just put on a playlist of your top rated songs when friends are over. You don’t want them to know you have the Macarena in your library!

4) Feeds: I use Google Reader to organize my feeds. In Google Reader you are able to setup multiple folders that each can contain multiple feeds. I have a folder for friends blogs, a folder for tech news, a folder for blog research, and a folder for each of my other interests. I can quickly see where new articles are and view just the topics I’m interesting in looking at. I also setup keyword searches on Google Blog Search and Google News and add the feed into Google Reader. This lets me get all the information I want, in a single easy to digest location.

5) Photos: We take a lot of digital photos, and we like to publish them online so that family can view them at their leisure. We have literally thousands of digital pictures that we have taken over the years. Keeping them all organized is no easy task. Recently I’ve begun the painstaking process of tagging all of the pictures in iPhoto. I tag the photos based on who is in the picture, the location of the picture, and anything that is particularly unique to the picture. Once the photos are tagged I upload them to our gallery using the iPhotoToGallery plugin. The gallery itself is powered by Gallery, a fantastic open source PHP based web gallery.

6) Address book: Now my address book organization is a bit tricky. As I mentioned above, I live both in the Mac and the Windows universe when it comes to my day job. At work we use Exchange and I carry around a Blackberry that is synced to Exchange. At home, I use my Mac, and I soon hope to have an iPhone. It’s a real challenge to keep my contacts synced between all these devices without spending too much time on it. In AddressBook 4.0 there is a handy feature that allows Exchange users to sync their Mac address book with Outlook Web Edition. Unfortunately for me, my company is still on the very old Exchange 5.5, and so I don’t have outlook for the web yet. While I openly admit this solution is far from perfect, it’s the best I have been able to come up with. Currently, I use my Blackberry as the transport medium for contacts. Exchange and my Blackberry work very well together, so I can always trust them. The problem is getting that same information onto my Mac. PocketMac makes a great utility that syncs your Blackberry with iLife. If I set this up as a one way sync (Blackberry to Mac) it works fairly reliable. The downside is that in order to add a new contact I have to do it with either my Windows PC or my Blackberry. I hope a better solution presents itself soon, or perhaps I might just dump my exchange dependancy all together when the iPhone arrives.

7) Chat contacts: Like most Mac users, I use Adium for my instant messaging. Adium is great because I can merge contacts from different networks into a single entry on my contact list and then set the network priority so I can choose which protocol to use if available. If you have the same person listed twice in Adium under your contact list, drag the contact from the lower priority network on top of the contact for the higher priority network. Adium will then ask you if you want to merge these contacts.
Another handy feature of Adium is having contact information pulled from your Address Book. This way their display name is listed as their real name instead of whatever catchy tag they chose to display as their alias. The last adium tip I have is how I organize my contact list. In Adium you can sort your contact list by status (under the view menu), and then choose to only view online contacts. This greatly reduces the number of contacts displayed and lets me quickly see who is available.

8 ) Email: Again, like Address Book email is a challenge in the hybrid Mac/Windows world I am in. Thankfully my email addresses are fairly separate. Work email stays on Exchange and personal email sits in Mail.app. Since I have my own domain name I use the fantastic Gmail for domains service. Google acts as my mail server and stores all my incoming messages. They are also kind enough to do spam filtering and provide an amazing ~16GB storage limit. I enable pop mail on the account and then fetch all my email down to Mail.app for local viewing and management. Once in Mail.app I use smart mailboxes to automatically sort out messages from the mailing lists I subscribe to. In Mail.app click the cog icon in the lower left, below your list of folders. From there, chose “New Smart Mailbox..”. With this interface you can specify under what criteria the mail message should be moved to the folder. For most mailing lists it is easy because typically a ID tag is prepended to the message subject. You can also use smart folders to create for individuals who email you a lot, so you can immediately see if you have new messages from them. That way you can give them your attention, or ignore them as the case may be.

9) Calendar: Ok, yet again I get bitten by the Exchange vs iLife issue. Similarly to how I manage my contacts I manage my calendar. I use the PocketMac software to import my calendar entries from Exchange/Blackberry into iCal. In iCal I have 2 separate calendars, work and personal. In the work calendar I have everything that is synced from the Blackberry, in the personal calendar I have everything that falls outside of work. This has worked out well because it allows me to stay organized but still keep my personal appointments completely private from my colleagues on our Exchange server. The only downside to this approach is that I do not receive reminders on my Blackberry for my personal calendar appointments. Again, hopefully the iPhone fixes this problem

10) Bookmarks: Now this is an area where the Windows/Mac problem is truly solved. I use del.icio.us to organize all my bookmarks. I can tag them so I know what they are about and I can easily retrieve them later. On Windows there is the new Firefox Extension and on my Mac and Safari I use Pukka combined with a simple javascript entry in my Bookmarks bar

javascript:document.location.href='pukka:url='+encodeURIComponent(location.href)
+'&title='+encodeURIComponent(document.title)+'&extended='+encodeURIComponent(window.getSelection());

When clicked, the above javascript sends your current URL to Pukka, which the gives you a prompt to tag it and upload it to Del.icio.us. The end results is that I have my bookmarks well organized and tagged on all of my computers. To access my bookmarks I just subscribe to the Del.icio.us RSS feed in Safari.

Can you think of any I might have missed? Have a solution to my Windows/Mac Address Book and Calendar problems? Drop a note in the comments.