Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How do I move or backup MacOS X 10.7 Lion Server wikis?

Hi,


I'm running OS X 10.7 Lion Server primarily for the Wiki server feature. I have a Mac Pro running 10.7 Lion Server and I can access the Mac Pro wiki from anywhere. The problem is the Mac Pro wiki is empty and I originally created a 10.7 Server Wiki on my MacBook Pro laptop. How do I backup and move the 10.7 Wiki from my laptop to my Mac Pro tower also on 10.7 Server? I've seen articles online about migrating Wiki from 10.5-10.6 to 10.7, but I've found nothing on the process of moving a 10.7 Lion Server wiki to another machine also running 10.7 Lion Server. How do I accomplish this?


Thank you!

Mac OS X (10.7), Mac OS X 10.7 Lion Server

Posted on Aug 6, 2011 9:50 AM

Reply
37 replies

Mar 14, 2012 9:29 AM in response to delmod

A correction to my last post ... copy and paste could be tricky.


The PostgreSQL files are in /var/pgsql and the socketfile is in /var/pgsql_socket.

The DB Backups are in /Library/Server/PostgreSQL/Backup.


@delmod :


First, I saw that you asked in a post before to restore the folder /Library/Server/Wiki/FileData without to change the filepermissions. Yes, it is possible - but if you don´t restore the filepermissions then this directory has as grouppermissions staff. Staff is a member of the group administrators - and that brings very big troubles.


Ok, to your new question. Lets say we have the file dumpall.psql.gz from /Library/Server/PostgreSQL/Backup. Be careful, there are a old file dumpall.psql.gz and a newer one called dumpall.psql - don´t know whats the difference, but I think the content is different (the older is not up to date as the new). Or you have a dump of the whole database cluster using.


sudo pg_dumpall -U _postgres > $HOME/howYouEverCallYour.Backup


Then you can restore it using (I write it as if all services are up and running).


sudo serveradmin stop addressbook

sudo serveradmin stop calendar

sudo serveradmin stop wiki

sudo serveradmin stop devicemgr

sudo serveradmin stop web

sudo serveradmin start postgres

sudo psql -U _postgres -f $HOME/howYouEverCallYour.Backup postgres

sudo serveradmin start addressbook

sudo serveradmin start calendar

sudo serveradmin start wiki

sudo serveradmin start devicemgr

sudo serveradmin start web


Attention, all databases are restored !


Don´t forget to restore your wiki folder.


sudo cp -R $HOME/FileData /Library/Server/Wiki/FileData

sudo chown -R _teamsserver:_teamsserver /Library/Server/Wiki/FileData

sudo chmod -R +a "www allow read" /Library/Server/Wiki/FileData


I Haven´t checked whether the other services had also folders with content as the wiki server has.


C. M.

Mar 14, 2012 10:00 AM in response to delmod

No need to say sorry - you are in a support community.


Yes, this command is ok if the file is in your home directory and if you have called it dumpall.psql.

Mar 14, 2012 10:18 AM in response to almafromburley

@almafromburley :


Also thanks.

were you when I spent 2 weeks figuring out a way to restore my wiki from Time Machine? 🙂

Let me think ... can´t remember. I wrote this things in february ... there are more things, look at www.mac.ph - even the most is in german but translate.google.com is your friend.

Mar 15, 2012 4:13 PM in response to Community User

Well. I followed your instructions and aparently all were fine but... nothing happens. Wiki is empty. When I reviewed Terminal this is what I was:

servidor:~ admin$ sudo psql -U _postgres -f $HOME/dumpall.psql postgres

You are now connected to database "postgres".


psql:/Users/admin/dumpall.psql:15: ERROR: role "_devicemgr" already exists

ALTER ROLE

psql:/Users/admin/dumpall.psql:17: ERROR: role "_postgres" already exists

ALTER ROLE

psql:/Users/admin/dumpall.psql:19: ERROR: role "caldav" already exists

ALTER ROLE

psql:/Users/admin/dumpall.psql:21: ERROR: role "collab" already exists

ALTER ROLE

psql:/Users/admin/dumpall.psql:23: ERROR: role "roundcube" already exists

ALTER ROLE

psql:/Users/admin/dumpall.psql:35: ERROR: database "caldav" already exists

psql:/Users/admin/dumpall.psql:36: ERROR: database "collab" already exists

psql:/Users/admin/dumpall.psql:37: ERROR: database "device_management" already exists

psql:/Users/admin/dumpall.psql:38: ERROR: database "roundcubemail" already exists

…...

You are now connected to database "caldav".

psql:/Users/admin/dumpall.psql:78: ERROR: relation "resource_id_seq" already exists

ALTER TABLE


SET

psql:/Users/admin/dumpall.psql:102: ERROR: relation "addressbook" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:120: ERROR: relation "addressbook_bind" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:132: ERROR: relation "addressbook_home" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:144: ERROR: relation "addressbook_home_metadata" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:162: ERROR: relation "addressbook_object" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:176: ERROR: relation "revision_seq" already exists

ALTER TABLE


psql:/Users/admin/dumpall.psql:199: ERROR: relation "addressbook_object_revisions" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:213: ERROR: relation "apn_subscriptions" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:231: ERROR: relation "attachment" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:244: ERROR: relation "calendar" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:256: ERROR: relation "calendar_access_type" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:274: ERROR: relation "calendar_bind" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:286: ERROR: relation "calendar_bind_mode" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:298: ERROR: relation "calendar_bind_status" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:310: ERROR: relation "calendar_home" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:322: ERROR: relation "calendar_home_metadata" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:351: ERROR: relation "calendar_object" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:363: ERROR: relation "calendar_object_attachments_mode" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:379: ERROR: relation "calendar_object_revisions" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:391: ERROR: relation "calendarserver" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:403: ERROR: relation "free_busy_type" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:417: ERROR: relation "instance_id_seq" already exists

ALTER TABLE

setval

--------------------------------------------------------


-----------------------


psql:/Users/admin/dumpall.psql:32401: ERROR: relation "contacts" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:32423: ERROR: relation "identities" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:32437: ERROR: relation "identity_ids" already exists

ALTER TABLE

setval

--------

1

(1 row)


psql:/Users/admin/dumpall.psql:32458: ERROR: relation "message_ids" already exists

ALTER TABLE

setval

--------

1

(1 row)


psql:/Users/admin/dumpall.psql:32490: ERROR: relation "messages" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:32505: ERROR: relation "session" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:32519: ERROR: relation "user_ids" already exists

ALTER TABLE

setval

--------

1

(1 row)


psql:/Users/admin/dumpall.psql:32544: ERROR: relation "users" already exists

ALTER TABLE

psql:/Users/admin/dumpall.psql:32587: ERROR: duplicate key value violates unique constraint "identities_pkey"

DETAIL: Key (identity_id)=(1) already exists.

CONTEXT: COPY identities, line 1: "1 1 2011-10-31 17:28:05.382256+01 0 delmod \N delmod@servidor.ivance.net \N \N \N 0"

psql:/Users/admin/dumpall.psql:32604: ERROR: duplicate key value violates unique constraint "session_pkey"

DETAIL: Key (sess_id)=(jrt154upbs4hic4nv8asau20eentq5do) already exists.

CONTEXT: COPY session, line 1: "jrt154upbs4hic4nv8asau20eentq5do 2011-10-31 17:29:30+01 2011-10-31 17:29:30+01 192.168.11.20 bGFuZ3V..."

psql:/Users/admin/dumpall.psql:32613: ERROR: duplicate key value violates unique constraint "users_pkey"

DETAIL: Key (user_id)=(1) already exists.

CONTEXT: COPY users, line 1: "1 delmod servidor.ivance.net 2011-10-31 17:28:05.341198+01 2011-10-31 17:28:05.341198+01 es_ES "

psql:/Users/admin/dumpall.psql:32621: ERROR: multiple primary keys for table "cache" are not allowed

psql:/Users/admin/dumpall.psql:32629: ERROR: multiple primary keys for table "contactgroupmembers" are not allowed

psql:/Users/admin/dumpall.psql:32637: ERROR: multiple primary keys for table "contactgroups" are not allowed

psql:/Users/admin/dumpall.psql:32645: ERROR: multiple primary keys for table "contacts" are not allowed

psql:/Users/admin/dumpall.psql:32653: ERROR: multiple primary keys for table "identities" are not allowed

psql:/Users/admin/dumpall.psql:32661: ERROR: multiple primary keys for table "messages" are not allowed

psql:/Users/admin/dumpall.psql:32669: ERROR: relation "messages_user_id_key" already exists

psql:/Users/admin/dumpall.psql:32677: ERROR: multiple primary keys for table "session" are not allowed

psql:/Users/admin/dumpall.psql:32685: ERROR: multiple primary keys for table "users" are not allowed

psql:/Users/admin/dumpall.psql:32693: ERROR: relation "users_username_key" already exists

psql:/Users/admin/dumpall.psql:32700: ERROR: relation "cache_created_idx" already exists

psql:/Users/admin/dumpall.psql:32707: ERROR: relation "cache_user_id_idx" already exists

psql:/Users/admin/dumpall.psql:32714: ERROR: relation "contactgroups_user_id_idx" already exists

psql:/Users/admin/dumpall.psql:32721: ERROR: relation "contacts_user_id_idx" already exists

psql:/Users/admin/dumpall.psql:32728: ERROR: relation "identities_user_id_idx" already exists

psql:/Users/admin/dumpall.psql:32735: ERROR: relation "messages_created_idx" already exists

psql:/Users/admin/dumpall.psql:32742: ERROR: relation "messages_index_idx" already exists

psql:/Users/admin/dumpall.psql:32749: ERROR: relation "session_changed_idx" already exists

psql:/Users/admin/dumpall.psql:32756: ERROR: relation "users_alias_id_idx" already exists

psql:/Users/admin/dumpall.psql:32764: ERROR: constraint "cache_user_id_fkey" for relation "cache" already exists

psql:/Users/admin/dumpall.psql:32772: ERROR: constraint "contactgroupmembers_contact_id_fkey" for relation "contactgroupmembers" already exists

psql:/Users/admin/dumpall.psql:32780: ERROR: constraint "contactgroupmembers_contactgroup_id_fkey" for relation "contactgroupmembers" already exists

psql:/Users/admin/dumpall.psql:32788: ERROR: constraint "contactgroups_user_id_fkey" for relation "contactgroups" already exists

psql:/Users/admin/dumpall.psql:32796: ERROR: constraint "contacts_user_id_fkey" for relation "contacts" already exists

psql:/Users/admin/dumpall.psql:32804: ERROR: constraint "identities_user_id_fkey" for relation "identities" already exists

psql:/Users/admin/dumpall.psql:32812: ERROR: constraint "messages_user_id_fkey" for relation "messages" already exists


servidor:~ admin$


Any idea?

Mar 15, 2012 4:45 PM in response to delmod

Yes and no. This hapoened if you run a pg_dumpall without the -c option (to drop existing objects).


See the manual page of psql using "man psql" on how to drop a database. But before drop a database be 100 % sure about what you do and that the dump is complete - because there is no way to restore a droped database.


See also the output of.


sudo psql -U _postgres --list


To see what it should look.

And don´t forget to stop all services.

Mar 16, 2012 1:57 AM in response to Community User

I´m one of the "The server for everyone" Apple client and now I'm learning UNIX. My only UNIX knowledge is reading this forum and copy-paste command lines. Please let me review the steps and confirm me sintaxis.


1. First I need to stop services and leave only postgres.


sudo serveradmin stop addressbook
sudo serveradmin stop calendar
sudo serveradmin stop wiki
sudo serveradmin stop devicemgr
sudo serveradmin stop web
sudo serveradmin start postgres


2. Second: Make a backup of the actual (is empty) wiki db and delete it:

pg_dump -U _postgres collab -c > $HOME/collab.sql

because I don´t need to restore the rest of the DB, I continue with the third step. I can backup and delete the rest of the DB in a similar way if it's necesary.


If now I do:

sudo psql -U _postgres --list


the collab DB will not appear.



3. Third: I restore from my "dumpall.psql" archive in the HOME directory:


sudo serveradmin start postgres
sudo psql -U _postgres -f $HOME/dumpall.psql postgres
sudo serveradmin start addressbook
sudo serveradmin start calendar
sudo serveradmin start wiki
sudo serveradmin start devicemgr
sudo serveradmin start web


Because I don´t drop calendar, devicemgr, adressbook and web, this DB will not be altered, only wiki.


4. Fourth Restore Fildata:

sudo cp -R $HOME/FileData /Library/Server/Wiki/FileData
sudo chown -R _teamsserver:_teamsserver /Library/Server/Wiki/FileData
sudo chmod -R +a "www allow read" /Library/Server/Wiki/FileData


Please may you confirm me if sintaxis to drop de collab DB, and if "the concept" of wiki selective restore from the "dumpall.psql" are correct?


Thanks a lot.

Mar 16, 2012 2:54 AM in response to delmod

@delmod :


Learning by doing is always the best way.


1.) Yes, stop running services - I listed here all possible servies. All servies must be stoppen and only PostgreSQL must be startet.

2.) The pg_dump makes a dump of the DB only nothing will be deleted or droped. The -c option is to delete or drop existing objects during restore the database (like drop a object and create it new).

This is not the rest of the DB - you have for (near) every service a own DB. If you use the -c option then there is no need to drop anything manually - but use the way Apple suggests (see below).

We talk here about two different things, you asked me to use the Apple dump. I have told you that I don´t know what is in it and I also don´t know how they dump it (it looks as without the -c switch).


If the wiki is empty it could be that the DB is not created at this time. Start a wiki, blog or whatever and check the --list again. I havn´t looked which DB´s are there in a clean and blank install.


3.) NO - there is no way (I mean I know nothing) to get out a single DB from a dumpall archive - ALL DB´s are restored. There are only the 2 ways dumpall or only single DB´s which you need. I mean if you dump all and the DB´s are empty it is no problem to restore it because it is nothing in it. But if the DB´s in the dump are empty and you put in the meantime something in it - then this content will be deleted !


So in your situation, if you have only the dumpall archive from Apple and need it to restore from there AND also you can delete the other DB´s (in the cluster of the system not in the file) then drop all by hand and restore all.


If you can make a backup of the wiki DB then use the long way as Apple suggests to do.


1. Backup DB and data directory :


sudo pg_dump --format=c --compress=9 --blobs --username=collab --file=$HOME/collab.pgdump collab

sudo cp -R /Library/Server/Wiki/FileData $HOME/FileData


2. Restore data directory :


sudo cp -R $HOME/FileData /Library/Server/Wiki/FileData

sudo chown -R _teamsserver:_teamsserver /Library/Server/Wiki/FileData

sudo chmod -R +a "www allow read" /Library/Server/Wiki/FileData


3. Restore the wiki DB :


sudo serveradmin stop wiki

sudo serveradmin start postgres

sudo rake -f /usr/share/collabd/server/Rakefile db:drop

sudo createuser -U _postgres -d -s collab

sudo createdb -U collab collab

sudo -u _postgres pg_restore -d collab -U collab --single-transaction $HOME/collab.pgdump

sudo serveradmin start wiki


The rakefile db:drop drops the existing collab DB. This works only for wiki not for the other DB´s.

Mar 16, 2012 5:51 AM in response to Community User

Christoph Murauer wrote:


So in your situation, if you have only the dumpall archive from Apple and need it to restore from there AND also you can delete the other DB´s (in the cluster of the system not in the file) then drop all by hand and restore all.


OK. This is my situation. How can I drop "caldav", "collab", "_devicemgr", "roundcube"?

Mar 17, 2012 6:18 AM in response to delmod

How sad, it looks like as if you don't read the manual page of psql using the command "man psql".


Ok, back to your question. To drop a datasabe you can use :


sudo dropdb -U _postgres -i databaseName


The -i switch let you confirm the drop of the DB if you have misstyped.


Or, you can also use :


sudo psql -U _postgres -d postgres

DROP DATABASE databaseName;

\q


The second version is a SQL statement and requires the ; at the end of the line. If you press return and took the false database - **** happend, I have warned you.


To create the databases (don't know whether this is automatic done if you restore a whole archive) and eventually users see the Apple steps above.

Mar 19, 2012 4:45 PM in response to leskovartem

@leskovartem :


Less informations brings less answers.

Mount the volume and copy the data folder and the dumpall file. Then restore it as described.


Could it be that you have no backup from the old system before you update to Lion 10.7.3 ?

How do I move or backup MacOS X 10.7 Lion Server wikis?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.