Wednesday, September 11, 2024

How I Saved a Mac Using Ubuntu

Datamation content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

As a general rule, OS X is not really best buddies with its Linux distribution cousins.

The reasons vary, depending on who you ask. But at the end of the day, the division is a solid one. Still, it is worth mentioning that since today’s Mac runs with an Intel CPU, most Linux distributions run great on it.

As luck would have it, the Mac’s compatibility with Linux recently saved my bacon after my wife’s iMac went into a bit of a meltdown.

This is a walk-through detailing how Ubuntu 12.04 saved my wife’s Mac (data).

Recovery is easy—data recovery is another matter

Anyone with a third grade education can drop in an OS X CD and follow along with the prompts. And those with more knowledge are able to use the bounty of recovery options that come with an OS X installation. Yet sadly, even with Time Machine setup to do faithful backups, disaster can still strike.

Apparently, the installation of OS X my wife was running had become corrupted. After trying a multitude of recovery solutions, we finally decided it was time to revert back to an earlier state with Time Machine. Oddly, something had messed up her instance of Time Machine and it wasn’t cooperating.

After running a battery of OS X friendly hardware tests, I decided that it was time to simply prep the disk for a clean installation. Only one thing prevented me from making this a smooth re-install – the lack of a functioning backup thanks to a Time Machine crash.

Now to be fair, we’ve had good luck with Time Machine in the past. However because I got caught up with other stuff, I failed to have my wife’s Mac setup on a plan B backup solution. And now, we were paying a price for it.

Home recovery with Ubuntu

After determining that the memory and hard drive were not failing, I was ready to grab my Ubuntu CD and get to work. The first step was to boot up the CD. After inserting the Ubuntu CD, I found that holding down the Alt button provided me with the option of choosing the CD to boot from.

Comically, the Mac referred to this CD as Windows. Apparently in OS X world, anything not OS X is Windows if it’s an OS.

After Ubuntu was booted up and the LiveCD presented me with the desktop, I immediately prepped an external hard drive that I had laying around in my home office.

On this hard drive, I had already setup a NTFS partition that was large enough to accommodate anything that might be in my wife’s home directory. However, using a simple drag and drop method led to a number of permission issues.

Realizing this would be a problem, I instead opted to use the terminal under sudo credentials to copy my wife’s home directory over to the other hard drive. I figured, get it copied and sort out the damage later on.

For those of you wondering, the reason I opted to use an NTFS file system for the backup is because it would read/write nicely between both OS X and Ubuntu. OS X’s native file system support under Linux is fine for reading. However, for writing, things can be a little messy and I needed results.

Now I know what many of you are thinking – there are half a dozen methods of copying over data from one drive to another, from rsync to a bare metal backup. For my needs, however, I wanted to keep it simple. Before booting to the LiveCD, I had concerns about data corruption. Unfortunately, these concerns turned out to be accurate. But for the time being, I simply needed to copy a home directory to an NTFS directory.

So I ran the following command to get the ball rolling:

cp -r OSX/Home-Directory External-hard-drive/directory

I let this data copy over for what must have been about an hour. Once the copying process was completed, I was able to look through the verbose information in the terminal. At this point, I was surprised by a few files that had been turned into alias files.

This basically meant the files weren’t there anymore, only a remnant of them remained. Since the few missing files weren’t ever made into alias files, I decided to research the issue. After doing a bit of digging, it seems that this isn’t uncommon on Snow Leopard.

Worse, no one seems to have pointed to an exact cause, either. And since it happened to unrelated file formats, I was unable to point to Adobe or another third party vendor as the culprit.

Accepting that the files that were missing weren’t critical, and that the needed home directory content had been backed up safely, we were ready to re-install OS X on my wife’s Mac.

Now I must confess that I was very tempted to simply install Ubuntu instead. Even on the LiveCD, Ubuntu out-performed her now dated OS X release. But alas, it’s not my computer. So I obeyed her wishes and began the OS X reinstall process. First I re-prepped her hard drive using the Snow Leopard CD.

Recovery is only half the battle

With my wife’s Mac back up and running, I then began the process of moving select directories back into her new home directory. The files I chose to restore were very general and had nothing to do with software or other data from the previous OS X install. No, I wanted this to be a clean restore, so I kept it simple – images, docs, music, and application specific files only.

Once again, I opted to use the terminal to restore this data. Using the same command as I used above, but in reverse, I was able to use the OS X terminal to restore my wife’s data back to her Mac. After I re-installed her Adobe software, plus a few other titles, my wife was back in business, as if no serious errors had ever occurred.

Overall, I consider the entire experience to be a lesson learned. For the time being, we’re using local drag and drop backups in conjunction with Time Machine. This way if something happens to Time Machine again, no harm is done. There is another backup ready to go. However, this has gotten me to thinking that it may be time to look into something like rsync for OS X, to ensure that everything is backed up properly. Not being a big OS X guy, I did some digging and was disappointed with what I found.

Time Machine is helpful in the way that say, System Restore on Windows is helpful. But I have concerns with trusting it after it failed last time. Not knocking it at all, rather saying that I’d like to add another layer of protection in our backup routine. I finally decided on doing an old fashion rsync backup to a NAS server here in my home. Yes, I will keep using Time Machine on the system, as it’s a great tool.

I think that by adding rsync to the mix, this will provide a good solution that meets my wife’s needs for her Mac, while ensuring her data is safe. Plus, it’ll also mean I can refrain from dealing with OS X again in the near future. It’s a fine OS, but it’s not for me.

Closing thoughts

As I ponder back to that fateful evening, I was fortunate on a number of levels. First, Macs and Ubuntu play well together, thanks to their *Nix roots. Second, it has served as a reminder that no one method of backup for any OS should be trusted completely. If the data is important, have a plan B in place ahead of time.

The last thing I want to leave you with is this thought. There has been talk about Ubuntu putting a stop to their LiveCD.

And while there are certainly other distributions out there that offer LiveCD solutions, it would mean that Ubuntu would no longer be a viable option for data rescue. To some of you, this may not sound like a big deal. However, stop to consider how many people encounter Linux for the first time from an Ubuntu LiveCD. Sure, a LiveUSB or DVD option is still available, however for those folks with older computers, this will have a huge impact.

Subscribe to Data Insider

Learn the latest news and best practices about data science, big data analytics, artificial intelligence, data security, and more.

Similar articles

Get the Free Newsletter!

Subscribe to Data Insider for top news, trends & analysis

Latest Articles