OS X Server Migration (Mountain Lion)

I use OS X Server at work for about 20 staff. We use it for basic Wiki and file sharing at the moment. Having OS X server allows the user to sync their whole system profile to the server so there will be daily backup of all their work. We are not heavy user of the server at the moment, just running the server with a spare Mac Mini with a large 10T RAID drive. Every year, Apple release a new version of their operating system and it pushes us to keep updating the software on all the machines. Here are just some technical notes on how to backup the server before attempting an upgrade.

Open Directory

To Backup, run from teminal, your backup will be stored at /tmp as a image file, copy that to somewhere for the backup:

sudo slapconfig -backupdb /tmp/odbackups

If there is an error, take a look at the error log. If it is keychain related, “Unable to create archive image as keychain could not be read.”, take a look at:
Basically, it might be that the keychain item is missing, you need to recreate it.
For Mountain Lion, you need the item to recreate is
rather than the com.apple.opendirectory one which the articles above described.

To restore OD, follow the instructions at OS X Server: Advanced Administration:
To restore Open Directory data, open the Terminal app (located in the Other folder in Launchpad) and enter the following command:
sudo slapconfig -restoredb /full/path/to/archive.sparseimage
For example, /full/path/to/archive.sparseimage could be /Volumes/Data/myODArchive.sparseimage


Backup the following:
/etc/dns/ (if exist)



This will backup all the wiki on your server. When you restore, it will overwrite all the wiki on the target server.

Update to OS X Server v2.2 or later on both the source and destination servers.

On the source server, execute these commands in Terminal as an administrator, in order to dump the Postgres database to a file:
cd /Applications/Server.app/Contents/ServerRoot/usr/bin/
sudo ./pg_dump -h “/Library/Server/PostgreSQL For Server Services/Socket” –format=c –compress=9 –blobs –username=collab –file=/tmp/collab.pgdump collab
Copy /tmp/collab.pgdump from the source server to /tmp/collab.pgdump on the destination server, then copy the contents of /Library/Server/Wiki/FileData on the source server to /Library/Server/Wiki/FileData on the destination server.
Log in to the destination server as an administrator and execute the following commands in Terminal to ensure correct ownership and permissions, start the Postgres database, populate it with the data dumped from the source server, and finally start up the wiki service:
sudo chown -R _teamsserver:_teamsserver /Library/Server/Wiki/FileData
sudo chmod -R +a “www allow search” /Library/Server/Wiki/FileData
sudo serveradmin stop wiki
sudo serveradmin start postgres_server
cd /Applications/Server.app/Contents/ServerRoot/usr/bin/
sudo ./dropdb -h “/Library/Server/PostgreSQL For Server Services/Socket” -U collab collab
sudo ./createdb -h “/Library/Server/PostgreSQL For Server Services/Socket” -U collab collab
sudo -u _postgres ./pg_restore -h “/Library/Server/PostgreSQL For Server Services/Socket” -d collab -U collab –single-transaction /tmp/collab.pgdump
sudo serveradmin start wiki
Important: These steps will cause any wikis already present on the destination server to be lost.

Software Update

First, switch the SWUS off. Then, check what is the default path:

sudo serveradmin fullstatus swupdate

When you can see the current path of the swupdate files, you can save them as backup. It saves you from having to download gigabytes of data again on your new server.

On your new server, set the path with:
sudo serveradmin settings swupdate:updatesDocRoot = “/Volumes/Data/SWUS/”


Leave a Reply