9 Replies Latest reply: Apr 18, 2013 4:43 PM by cavalieredona
jheipmann Level 1 Level 1 (0 points)

Dear community


Due to bad luck combined with stupidity and laziness I lost my open directory master, and therefore also all network users (and yes, the back up of OD I did, but that file is corrupted), so that I end up recreating users in the OD.  That by itself is not that bad, but the potential loss of data is. To be more precise, currently I am not able to recover the Mailboxes, and specifically for about 10 iPad/iPhone only users, I have no chance to recover them from a time machine backup. So here goes my questions:


1.) Is there a way to copy / import from the old user id to the new one for Mail (Dovecot) ?

Simply copying the files from the old subdirectory to the new one does not work (seems to be secondary permissions), and I did not have any success by using doveadm tools.


2.) Same goes for iCal and Contacts server?

Any suggestions? Haven't tried those yet.


3.) For Home Directories including Mobile users homes I think copying the data and doing a chmod should be sufficient

Clearly the clients would have to delete their mobile homes first and then sync back, but in any case here I could use the TM backups in worst case.




So, can anyone point me in the right direction especially for the mail folders?


Thanks in advance



Mac OS X (10.7.2), Lion Server
  • jheipmann Level 1 Level 1 (0 points)

    So, in the meantime I figured out some of the topics.


    For 1.), the procedure is fairly simple, as long as the old mail directories are still there:

    - Log on to IMAP Server with your new user ID

    - Stop the mail service

    - In Server-Admin, Maintenance Tab, you will find the full user name twice, once with and second without any data in it. You will also find the old and new storage locations of the mails, so simply copy all the contents from the old directory to the new one, then do a

    chown -R _dovecot

    on it's content.

    - Start the mail service


    As thought, for migrating the user homes 3.) simply do a

    chown -R username /Users/username

    that's it.


    Leaves me with 2), iCal and Contacts.

    Both use the caldav service, and both store their data in the database with the same name in postgres. There is a procedure to backup those dbs here:

    Lion OS Collaboration Services - Manually Backing Up and Restoring

    Be careful, restoring to the db should actually restore to "caldav" not to "collab", so the correct command is


    # psql -U _postgres -d caldav -f /Library/Server/PostgreSQL/Backup/caldav.sql


    So, basically you can replace the old GUID of a user with the new one in the backed up file, and restore it. That worked for me, but in the meantime I rebooted and now caldav and contacts are not workiung anymore, I can not even log into any of the accounts. I guess that has to do with loosing contact to the OD master after the reboot, so I guess I will have to dig into more logs.


    Message was edited by: jheipmann

  • Twistan Level 1 Level 1 (5 points)


    I noticed this typo


    # psql -U _postgres -d caldav -f /Library/Server/PostgreSQL/Backup/caldav.sql


    as well !


    Well spotted !






    One of my users can longer log in to his iCal account. I do not know how this happened but I remember that I deleted a jointly used iCal account (I mean an account that was used by all) and that that user, who can no longer log-in to his iCal account, had delegation status for that deleted account.

    I do not know of this is imprtant. I am by no means a postgrep or server expert. Just an experienced and seasoned physicist and mathematician.


    I think I shall delete the old server account and create a new one for that user. I don't know if that deletes any contributions to Wiki pages by that user.


    Apple have made trouble-shooting very difficult for Lion server that "everyone" can set-up but not administer properly.

  • jheipmann Level 1 Level 1 (0 points)

    Hi all


    Obviously I left this topic open although I solved it myself. Sorry. Basically above mentioned procedures do work although a little time consuming. The lost access to the collab services was once again due to certificate trouble.


    @twistan: thanks for confirming the typo, for the inaccessible user due to delegation I cannot provide any help.


    Best regards



  • delmod Level 1 Level 1 (0 points)

    I'm in a similar situation. I need to restore my wiki after a clean installation. Let me see if I have understood:

    1. First I need to restore the dumpall.psql.gz archive with Time Machine
    2. Second in Terminal: # psql -U _postgres -d collab -f /Library/Server/PostgreSQL/Backup/collab.sql


    Is it necesary do something with the folders "Collaboration" and "Wiki"?


    Thanks in advance for your help.

  • Twistan Level 1 Level 1 (5 points)

    Hi Joern,

    thanks for that. I took the gamble and I simply deleted and re-defined the user's account (same short name and password). User had iCal working again imediately.

    The user's Wiki read and write ACL's did not work but I found a group (very strange) with the user's name which I deleted as well and now all is fine again.

    By the way, the user's wiki entries were not deleted as I had feared.




  • Twistan Level 1 Level 1 (5 points)


    please refer to



    In my (lay) view you have to dump (back up) all individual databases first:


    $ sudo -s

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


    Only if you done that can you restore using the second command

    # psql -U _postgres -d collab -f /Library/Server/PostgreSQL/Backup/collab.sql

    But I could be mistaken.




  • delmod Level 1 Level 1 (0 points)

    What about to restore the complete database?:

    • First restore the dumpall.psql.gz archive with Time Machine
    • Second in Terminal:¿¿¿???



  • Twistan Level 1 Level 1 (5 points)


    good question, but I do not know the answer.

    Maybe someone more knowledgable can answer this ?




  • cavalieredona Level 1 Level 1 (0 points)

    Please Joern, I am now in your same trouble you were last year but a newbie and I need to know how to type chown -r _dovecot . I mean I guess by terminal. I open it and type only this?


    Besides, how can I copy the all contents? I go in data mail and I just make a copy and paste into the new folder?


    Thank you for your help.


    Best Regards