Just finishing off my first ever backup of my MacBook. I’ve made a complete copy of the /Users folder, which should back up all the files and preferences of all the users on the computer.
Just for reference, and to show how I’m doing it, I’ll walk you through how I’m doing my backup.
I’m backing up to an external 200 GB hard drive, onto a partition formatted with NTFS. Thanks to MacFUSE and the NTFS 3G projects, I can safely write to the drive easily. I’m not going to cover how to install them here, so I’ll just assume you’re using some kind of external storage already set up for writing use on your Mac.
Now, we could just copy the files onto the storage medium in the Finder, but unless your removable disk is formatted with OS X’s native file system, you’ll lose Mac-specific metadata. While that’s not usually vital, it’s always better to preserve the original information and for that reason we’re going to make a disk image file (yes, like those .dmg files you download) in which to store our backups. Storing the files inside the DMG makes a mini filesystem-in-a-file which is formatted with HFS+ (the native format), so we keep all that extra information.
Once you’re logged on as an administrator user, launch Disk Utility in /Applications/Utilities/Disk Utility.app. Head to File > New > Blank disk image.
In the resulting dialogue, chose to save your disk image onto your removable drive (or wherever) and give it an appropriate name. At the bottom, choose Custom for the size and set it to slightly larger than you will need (check the size of the Users folder to determine how much you’ll need).
Leave encryption off (unless you’re really paranoid and want a super-secure backup), but make sure you set the Format to sparse disk image.
Don’t worry – because we’re using a sparse disk image, the size of the image file grows as needed – it won’t immediately take up as much space as you set in the size earlier.
Click Create and in a couple of seconds you’ll have your new disk image ready and automatically mounted on the desktop.
Now, we’re going to take a quick excursion into the terminal to actually copy the files (in theory, you could use the Finder, but there are occasions when that might not work, especially if you have multiple users).
Open it up from /Applications/Utilities/Terminal.app.
First of all you need to run the command to navigate to your disk image.
Substitute in the name of your image (just type the first few letters of it and press Tab to autocomplete). Hit enter when you’ve typed in that command.
Now we just copy the contents of the /Users folder into our new image, preserving all metadata.
sudo ditto -V --rsrc /Users .
Once you hit enter the process starts. If you’re asked for your password, just type it in and press enter (you won’t see any stars as you type, this is normal). You’re doing exactly the same as you’re doing when you unlock a secure System Preference, except that you’re doing it from the terminal. Once it’s done, you’ll be pushed back to the prompt again.
Once the copying is all done, then you should be done! You don’t actually have a .dmg, but you do have a perfectly good and usable .sparseimage that you can remount and copy back should you lose any data!
To finish, eject your disk image, before ejecting the removable drive and then you’re ready to go!