Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.7: Updating Lion Server if using CalDAV and CardDAV OS X Server
If you plan to update your OS X Server to 10.7.2 be sure to restart your machine and stop all server services, especially iCal Server and Address book server before applying the update.

It happened to me yesterday that I applied the OS X 10.7.2 update to my Mac mini server without closing any apps. I just ran it. After the update it turned out, this was a big mistake. All calendar entries of the past three weeks and many contacts were lost.

I was not able to recover anything from time machine. Lion server keeps the CalDAV and CardDAV data in a PostgreSQL database which is apparently not backed up by TimeMachine. Also, the PostgreSQL uses transactions which need to be 'closed' before they end up being permanently written into the DB tables.

What I found from reviewing the postgres log file (/Library/Logs/PostgreSQL.log) is that the 10.7.2 server update will apply a whole bunch of database structure updates to PostgreSQL but without committing the latest transaction. Given that CalDAV entries a quite small, the transaction log may contain a lot of data which is then lost.

So, be aware to make sure you have your transaction log committed before you run the update. I assume a proper server shutdown (or reboot) and stopping of the server processes will do just this. Afterwards it should be safe to update.

Alternatively (and this is my weekend-fun-duty) have a client with all up to date calendars off-line and aside which servers as a backup.

[crarko adds: I haven't tested this one. In fact, I haven't had the chance to try Lion Server at all yet. I'd be interested to hear if others have experienced issues like the one described here.]
  • Currently 1.25 / 5
  You rated: 2 / 5 (182 votes cast)

10.7: Updating Lion Server if using CalDAV and CardDAV | 5 comments | Create New Account
Click here to return to the '10.7: Updating Lion Server if using CalDAV and CardDAV' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.7: Updating Lion Server if using CalDAV and CardDAV
Authored by: diamondsw on Feb 06, '12 08:09:15AM

While it sounds like the poster has done his homework in tracking this down, I can't say I saw any effect on my own Lion Server when I updated to 10.7.3, with both CardDAV and CalDAV services running.

[ Reply to This | # ]
10.7: Updating Lion Server if using CalDAV and CardDAV
Authored by: alexiskai on Feb 06, '12 10:13:42AM
This is a good time to point out that you can - and should - back up your 10.7 Server PostgreSQL databases independently of Time Machine. iCal, Address Book, and Wiki services all use PostgreSQL DBs to store their data. This means they need to have periodic DB dumps done, just like any other live DB. You can use the built-in postgres tools to automate this for you. For example, here's a crontab line you can use to back up the wiki DB:

PGUSER=_postgres /usr/bin/pg_dump -U _postgres collab -Fc -f /Library/Server/PostgreSQL/Backup/collab.sql > /dev/null 2>&1

This will dump the "collab" DB to file collab.sql in the Backup folder. You can repeat this for the other DBs. Use crontab to set backup frequency and type; you can also add other lines to control backup renaming and grooming, offsite copying, etc. I don't know the names of the iCal and CardDAV DBs offhand, but you can probably look them up, or maybe someone else here knows.

Edit: BTW, that's the root crontab I'm referring to.
Edited on Feb 06, '12 10:15:34AM by alexiskai

[ Reply to This | # ]
10.7: Updating Lion Server if using CalDAV and CardDAV
Authored by: agentx on Feb 06, '12 11:21:27AM

I have 10 Lion Servers in Production and 2 test servers ATM with another 8 more being deployed soon.

Server updates can always be a bit touch and go and one should always be prepared for the worst. ( been there done that got the T-Shirt !). I also always use System Combo updates and never trust deltas via software update system.

My procedures are to stop services, backup TM/SysClone , backup OD & SQL/PSQL/FMS Databases separately as well as /etc. If all goes well your downtime is no more than 1hour from start to finish.

On another note, I am pleased about the move to a more robust backend DB for these services and certainly do not trust TimeMachine on servers (not a big fan/user of TM anyway). Profile Manager is part of PSQL DB schema which currently has a mind of its own and seems to require a lot of nurturing to keep running ;-)

I feel compelled to point you all to for some more very useful under the hood info on all this "new" Lion server stuff. Personally cannot wait for his book.

[ Reply to This | # ]
10.7: Updating Lion Server if using CalDAV and CardDAV
Authored by: lairdo on Feb 10, '12 04:05:24AM

I have tried twice to upgrade from Snow Leopard Server to Lion, both times without success. The server is used mainly for address book and iCal and some Time Machine back ups. Both times, I was able to restore from my Time Machine back up without losing any data. But now I wonder if the issue I saw relates to this post. I will have to try again.

Does anyone know if there are any issues with DNS servers and the upgrade? I actually think my problem was related to that, but as I am not very versed in such things, I was unable to track down the root cause.

[ Reply to This | # ]
10.7: Updating Lion Server if using CalDAV and CardDAV
Authored by: archetrix on Feb 10, '12 09:15:31AM

I don't think this data loss is update-related. At least i had to deal with data loss in postgres databases (trac, ical) after simply shutting down the server and starting up after hardware maintenance. So i think it's rather a shutdown database issue.

Still looking for a safe way to have postgres automatically shut down cleanly prior to reboots or shutdown.

[ Reply to This | # ]