If you back up an OS X server that has a separate data store drive, then restoring this with Time Machine may require use of the Terminal.
by Topher Kessler
Apple’s Time Machine is a convenient option for backing up files in OS X, and for most people running the standard “client” version of OS X, the use of Time Machine is fairly straightforward. However, Apple offers a Server variant of OS X that can be used for running work groups, classrooms, and other business applications, which, depending on your setup, might take some extra steps when managing via Time Machine.
If you run into a problem with the configuration for a single service in your server, then restoring components is usually fairly straightforward. In most cases besides the executable files, services are composed of a configuration and a data store, so if you are familiar with the locations of these files in your server then you can use Time Machine to target and restore backups of them, making the recovery of configuration problems or data loss rather painless in some situations.
For instance, if you administer an SQL database and erroneously corrupt the database or delete items in it, while you can try using the server administration tools to attempt reimporting of a database backup, this requires that you had made a backup just prior to the problem occurring, and often such manual backups might be missing a fair number of entries. Other times, re-importing can result in odd configuration errors that need to be contended with before the restored database will function properly.
As an alternative to such approaches, if you have a Time Machine backup of the database data store, then you can locate all the files that the SQL service uses (configurations and data store), and restoring all of them using Time Machine to revert the service’s configuration to as it was before the problem occurred. This can often be done without needing to shut down the server, and only requires you stop the service, locate the configuration files on disk, restore older versions from Time Machine, and restart the service. The one caveat is that you need to understand the service in question well enough to know what files the service uses, but in many cases this is relatively easy to do if you are familiar with server administration and the nuances of your server setup.
The one area with restoring an OS X server using Time Machine that might be a bit tricky is if you need to restore the entire installation. Time Machine is built primarily to recover the OS boot volume and visible files contained on a single disk, so if you have a server set up on one boot volume then you can easily follow standard Time Machine recovery procedures to restore the system; however, if you have your server set up on multiple disks (such as having a data store on a separate drive — a common setup for server systems), then restoring with Time Machine will take a few extra steps.
While Time Machine should back up all the files from your data store volume just fine, in a recent Knowledgebase article, Apple outlines that if you need to restore this volume to a new or formatted drive, you will need to ensure that a few setup requirements are met. First be sure the volume name is the same as the previous one, since services will access their data using the full path of /Volumes/<volume name>, and secondly you will need to use the Time Machine command line utility in the following manner to restore the data, instead of using the Time Machine interface:
- Go to the desired backup location on the Time Machine disk by navigating to Time Machine Disk > Backups.backupdb > computername in the Finder.
- Open the Terminal utility and type “/usr/bin/tmutil restore -v” followed by a single space.
- Locate the desired backup instance (the “Latest” folder is the most recent one, but others should be listed by date and time), and open it to find the folder for the data drive.
- Drag the data drive folder it to the Terminal window, followed by deleting the trailing space and typing “/*” to complete the path and reference everything within the folder.
- Finally press the Space bar once and drag the newly formatted data drive to the Terminal window. When you are done, the command should look similar to the following (note that file paths and disk names will be unique to your setup):
/usr/bin/tmutil restore -v <path to desired backup>/DataStore/* /Volumes/DataStore
When executed, this command will restore the entire contents of the Time Machine backup for the data store drive to the newly formatted partition you have designated to be your new data store. Once completed, your restored services and OS installation should continue to function and reference the files and configurations on the data store disk as they did before the restoration was needed.