Backups

Moving your TimeMachine

Tags: 

It's bound to happen to everyone, they outgrow their TimeMachine and want a new one, a bigger one, one that will allow them to go further into the past... I'm talking about OSX's built-in backup system here, I don't know what you were thinking..

So ever since starting to use OSX Leopard I've been using TimeMachine to keep a running backup of my laptop for two reasons - I can instantly jump back to an old revision of a file, and it keeps a near-constant mirror of the OS as it is with all of the software & settings intact. My laptop came with a 120gb drive and I've been using a 160gb USB drive for TimeMachine. Obviously enough, when this is my main machine I move a lot of files around - download lots of files (all legit), delete some, move others to a file server, but with TimeMachine keeping a regular hourly backup of all change files it can end up bloating up pretty quickly. Sure enough, within a few short months I'd filled up the drive and for the past three or four months it regularly informs me that it has flushed some older backups in preference to keeping newer data.

It's 2009 and hard drives of all sorts are insanely cheap. Taking advantage of the early sales I snagged a 320gb replacement internal drive for the laptop and a 500gb external drive for TimeMachine. Incidentally, both of the drives were made by Seagate, as all of my drives are, as all of their drives (at least up through their January 2009 new models) come with a five year warranty, so between backups I'm (mostly) guaranteed five years of usable storage.

Moving on.

I personally don't like moving data off a primary drive due to the inherent reliability problems of external storage - if it's important data then it needs to be on an actively used internal drive, not on a DVD or CD sitting on a shelf somewhere for grubby little fingers to play with (or get knocked over), and definitely not on a USB memory key that's going to get put through it's paces in the next laundry cycle. All external storage formats should be used for backups exclusively. End of story.

So, in order to keep my data intact I planned a drive shuffle. First I was going to migrate the TimeMachine backup data to the new external drive, then I was going to swap out the internal drives and follow up with a quick restore off the backup drive to the main OS drive. Simple enough, and something I've done before.

Well the first step, as mentioned, was to migrate the 160gb (actually only 145gb due to drive companies lying about the size of a "gigabyte") to the new 500gb drive so I could retain the last few months of data as an active backup. That seemed simple enough. Because the drive comes pre-formatted for use with Windows (NTFS), I plugged the new drive to my laptop, ran the funky Seagate software installer & allowed it to wipe & repartition my drive for OSX. After rebooting (yeah, go figure, silly company) I has a 465gb usable drive. But it didn't have my TimeMachine data.

The official guideline on migrating TimeMachine data is to use DiskUtility to "restore" the data to a new drive - odd terminology, but it kinda makes sense. Well, for some odd reason it started giving me an error when I tried this. Just to be sure (and because computers make us crazy by expecting different outcomes for repeating the same procedures) I tried again, and sure enough, the same error.

Poop.

A quick google later and I find two shareware utilities that might also do the trick - CarbonCopyCloner and the amusingly titled SuperDuper. Long story short - both tools would run for a few minutes and then seem to get stuck, sitting with zero change in progress while saying they're copying this file that's actually rather tiny (so it wasn't that it was just moving a huge file). Enough of that, back to google.

A bit more research turned up an article on the excellent MacOSXHints.com which detailed how to use the UNIX tool dd to copy a drive, including to use it to recover lost data off a partition. So I gave it a spin.

The instructions are simple. First off, use the tool "df" to find out the exact location of the partitions or drives you wish to copy (the first column marked "Filesystem"), e.g. the 160gb drive showed as "/dev/disk3" and its partition as "/dev/disk3s2", while the 500gb drive was "/dev/disk2". Then, once you know the drives you just run the following command: "dd olddrive newdrive" e.g. "dd /dev/disk3 /dev/disk2".

Well, while I was overjoyed that my first h@rDk0r3 use of UNIX in some time actually started to do something, I was dismayed to see it say the average copy speed was "1705KB" i.e. 1.7meg per second, and at that rate would take 26 hours to complete. Bummer. As it turns out, by default it works with tiny 512byte data blocks, which obviously takes FOREVER.

While researching it I come across another tool that bids itself as a simpler tool for migrating partitions called "ddrescue". I do a quick download, compile and run, and sure enough it's using the same block size. Sure enough, there's a handy little option called "--block-size", or just "-b" for short, that lets you tell it to use larger blocks of data at a time. A quick "-b 4096" later and the transfer speed jumped to ~5KB. Good enough, though it still took six hours.

After the six hours I now had a drive that seemed to all be there, but it only said it was 145gb and my efforts to resize it with Disk Utility just gave a wonderfully error that says "Error with partition: MediaKit reports partition (map) too small".

Back to the drawing board.

I then thought "maybe I have to copy just the partition instead of the entire drive. Six hours later... and I was left with basically the same thing - Disk Utility said that the entire drive was in one large 465gb partition, but Finder said it was only 145gb.

Back to the drawing board. Again.

And back to Disk Utility.

This time around I deleted the existing partition first so that the 500gb drive was completely blank. I then set the Rescue action to erase the destination. Four hours later it had copied all of the data, another two hours later and it had verified the data.

Golden. Or so I thought.

I now have a single, 465gb partition that shows up in Finder and Disk Utility. The only problem is that Disk Utility says that the drive itself has no partitions! While I'm stumped, I think I'm going to count my blessings, just deal with it - TimeMachine works again, and if I find a fix I'll post an update.

Mozy Backup - 2gb of online encrypted backup for free

Tags: 

I've mentioned Mozy Backup before, a service that gives you 2gb of free online backup space for your Windows or Mac computer. Well they've just released their "version 1.0" update for the Mac software so I think it's time to give it a go, you have nothing to loose. One minor note - I really wouldn't recommend trying the service if you only have a dialup internet service, it will take a long time to upload your data on a modem though once the first backup is finished additional ones should run pretty quickly for most people. Lastly, if you like it and need more than 2gb of space you can buy "unlimited" space for $5 per month per computer.

Laptops are complicated wee beasties!

Tags: 

Last night when I went to bed my new (to me anyway) Powerbook G4 was working fine. This morning when I got up it was severely misbehaving - there was 9.5gb of RAM in use and nothing was responding. I started shutting everything down and at one point tried to turn off the local ColdFusion 8 server using sudo, only to have an error that my account wasn't in the sudoers list; given that my account was an administrator, this was not good. I left it to continue rebooting but when I got back, a half hour later, it had pretty much frozen up trying to load a few starter apps. This, along with the noise coming from the drive, told me what I already knew - the drive was dead.

Given that I bought the laptop off a guy on ebay two weeks previously, and that there was no extended warranty on it, I was up the proverbial creek. Given that I had to go meet someone anyway, I jumped in the car and picked up a new drive, along with an external USB chassis for the off-chance I'd be able to access the data one last time.

Well, that was the easy part. The tricky part was opening up the blasted laptop. There is a covered panel on the bottom of the 12" Powerbook G4 (1.33ghz model) that for some reason in my anxiety I mistook to be where the drive went, despite the obvious fact it was too small, and the fact that the nice KLACK!! noise came from elsewhere. The first problem of the repair - I didn't have a screwdriver the correct size. So off I go looking for a repair kit that would have a full set of screwdrivers and other tools; the first store I checked stopped carrying tools because they wanted to sell their services (or simply a new computer), and finally I got the last set of six "precision" screwdrivers at Wallyworld. After opening up said panel I felt like slapping myself as I was presented with: the memory upgrade slot. Yay.

At this point google was my friend and I found a full manual that detailed exactly how to disassemble our Powerbook. Let me tell you, this was a complicated wee beasty - tonnes of screws all over the place, some hidden behind keys on the keyboard. In addition there were two "allen"-type screws that I didn't have a correctly sized key for, so off I go to Lowes. Some of the screws were also very tightly in place, and there were several times I had to awkwardly put pressure on this tiny little screwdriver so that it would break the seal, but not so much pressure that it broke anything else; and did I mention the screwdriver was tiny so it was difficult to twist?

After much frustration I finally got all the way down to the very last screw holding in the dead drive only to realize that a) the screw was really tight, the screwdriver was wearing away and would probably rip the threads off the screw, which would have been bad. So off I go to Lowes again to get another set of screwdrivers, and this time I struck gold - a larger screwdriver with interchangeable tips, which worked wonderfully well, and I wish I'd had it earlier.

So finally I get the new drive installed, close it all back up, boot and... it works! After last week's data loss I'd made a full backup of the now dead HD to an external drive so was able to do a restore off it. Eight hours after discovering that the drive was dead I was finally able to work again. ARGH!!! <sigh>.

On the other hand, I'm looking forward to OSX Leopard's new Time Machine backup system. Since I'd ran the backup I'd copied about 100 pictures off a camera memory card and saved some timesheets - the pictures I'll probably be able to recover off the card, but I'm going to have to retrace my time for the timesheets, and hope I get it right.

Oh, and annoyingly, with the price of the replacement drive and all the hours of work I've lost for the day, I could have bought a refurbished MacBook that had an actual warranty. Argh.

So, did I mention that you should backup often?

Backup your data *now*, damnit!

Tags: 

Nothing scares you into realizing how fragile our data is until you accidentally delete something important.

In my case it was trying to get some pictures off my phone; the bluetooth connection was misbehaving so I figured I'd just pop out the memory card, only it wasn't working in the card reader, so I put it back in the camera to try the bluetooth again when sccccrrrraaaaapppe! it scratches against the slot and gets jammed. I had to pry the card out and when it did it had two small but visible scratches across it, and for a teeny-tiny MicroSD card even small scratches appear to make a difference. I plugged the card back in, carefully this time, but it wouldn't work. I rebooted the phone in case that might wake it up - nothing! I'd just lost about 30 pictures of the family and half a dozen movie clips including some utterly adorable ones.

So let this be a lesson to all of you - back up your data, and don't fool around with important files if you a) don't have backups and b) aren't paying attention to what you're doing.

Backup script for RimuHosting

Tags: 

A handy little one - a backup script for RimuHosting that will backup your Rails app and copy it to the provided backup storage account. To use it you first have to add Geoffrey Grosenbach's backup.rake script to your lib/tasks directory, then sign up for RimuHosting's backup service, then just save out this script as e.g. "backup.sh" and add it to your crontab. Easy when you know how.

export TIMESTAMP=`date +'%Y%m%d%H%M'`
rm -f backup.zip
rake db:backup RAILS_ENV=production
zip -r -9 -q backup.zip *
lftp -u 'myaccount,mypassword' backupspace.rimuhosting.com -e "set ftp:ssl-protect-data true; put backup.zip -o backup_$TIMESTAMP.zip; exit"

Subscribe to Backups