Note: This method backs up the entire drive, free space and all. If you have a 30G harddrive, you’ll need 30G free on the target Mac. If you only want to recove some of the files, check out my article HOWTO Recover Files from a Non-Bootable Windows PC using Ubuntu Live. In addition, that article doesn’t require the use of a Mac to retreive the files, you could use another Windows box, for example.

About a year ago, I posted a method for backing up a Windows Laptop with OS X, which used a Knoppix Live CD and NFS. Today, I needed to perform the same task. I wanted to use Windows file sharing instead of NFS, since support is built into OS X and can be enabled from System Preferences. I also wanted to use Ubuntu instead of Knoppix, since I had a Ubuntu 6.06 CD handy, and I’m a Ubuntu fan. While I had some issues, I came up with a method which I think is easier then the old one.

The laptop I needed to back up recently had a memory chip go south, so it only has 192M of memory, and I believe part of this is used for video memory. Unfortunately, this is below the recommended 256M minimum RAM for a Ubuntu Desktop install. I haven’t found a minimum requirement for running the live CD, but considering that no swap space is availble when running a Live CD, I expect it is at least the same. I found that running the Live CD on this machine was so slow as to be unusable.

Hoping to find a way to reduce memory requirements, I searched for a comprehensive guide to the Live CD’s boot options, with no success. I also searched for a way to boot the Live CD without X Windows (text mode only), also with no success. If anyone can help with either option, please leave a comment.

Stuck, I decided I’d have to download a different Live CD. Although other options exist, I decided this was a good opportunity to try XUbuntu , a Ubuntu variant that uses XFCE instead of Gnome for its desktop environment. XFCE is designed for machines with low resources, and the Live CD requires only 128M.

XUbuntu worked fine. I couldn’t find some of the GUI tools Ubuntu provides that I’ve used in past HOWTO’s, so this one is mostly command line. As a bonus, if you have a machine with a little extra RAM, and already have a Ubuntu Live CD handy, these instructions should work equally well.

On the Mac that will receive the backup, make sure that Windows Sharing is enabled via the Sharing pane in System Preferences. By default, this will share your home directory; that’s where we’ll put the backup. In the instructions below, my user name is jclark, substitute your own. Also, make a note of your Mac’s IP address. If you don’t know it, open Terminal and run ifconfig.

Boot the system to be backed up with a (X)Ubuntu Live CD (also called the Desktop CD in the latest release).

Run the Terminal application. Depending on your *Buntu of choice, it will be in one of the menus.

Install support for mounting Windows shares (will be installed in RAM only):

sudo apt-get install smbfs

Create a mount point (a local directory that will host your Mac home directory):

You will be prompted for a password, provide your Mac password. Note: using -t cifs instead of -t smbfs (as you may expect) avoids a 2GB file size limitation.

Copy the hard drive to your Mac. This assumes your Windows hard drive is ‘hda1′, which it probably is. If you know it isn’t (and you know the correct value), change accordingly.

sudo dd if=/dev/hda1 of=/mnt/mac/drive_backup.img

Wait. This could take a while. Backing up my 30G drive took 6.5 hours. I expected it to be faster, maybe the laptop only supports 10MBit Ethernet. If you’ve got 100MBit ethernet, this should be faster. Oh, and if you are on a machine with a wireless connection, assuming it even works under Ubuntu, I reccomend using a direct (wired) ethernet connection for this if at all possible.

When it finishes, unmount the shared drive:

sudo umount /mnt/mac

and shut down Ubuntu.

On the Mac, in your home directory, you now have a disk image named drive_backup.img. Double click it to open it like any other drive image. You can copy files out as needed.