Hi Pete Smith,

> Attempting to restart pgsql gives me the following output:
>
> [root lost+found]# /etc/rc.d/init.d/postgresql start
> Setting up PostgreSQL: no database files found.  creating...
> This database system will be initialized with username "postgres".
> This user will own all the data files and must also own the server process.
>
> Fixing permissions on pre-existing data directory /var/lib/pgsql/data
> Creating database system directory /var/lib/pgsql/data/base
> Creating database XLOG directory /var/lib/pgsql/data/pg_xlog
> Creating template database in /var/lib/pgsql/data/base/template1
> Creating global relations in /var/lib/pgsql/data/base
> Adding template1 database to pg_database
> /usr/bin/initdb: /tmp/initdb.18807: Permission denied
> /usr/bin/initdb: /tmp/initdb.18807: Permission denied
> /usr/bin/initdb: /tmp/initdb.18807: Permission denied
> /usr/bin/initdb: /tmp/initdb.18807: No such file or directory
>
> initdb failed.
> Removing /var/lib/pgsql/data.
> rm: cannot remove directory `/var/lib/pgsql/data': Permission denied
> Failed.
> Removing temp file /tmp/initdb.18807.
> failed!

This guide assumes that your Postgres installation (except for the corrupted 
databases) is still ok:

1.) Backup and move old Postgres database:

    /etc/rc.d/init.d/postgresql stop
    mv /var/lib/pgsql /var/lib/pgsql.bak

2.) Restart Postgres again:

    /etc/rc.d/init.d/postgresql start

That will re-create /var/lib/pgsql/ again and sets up the empty database 
structures.

3.) Repopulate the Postgres Database:

    /usr/local/sbin/meta-verify -f -i
    /usr/local/sbin/meta-verify -f -a
    /usr/local/sbin/swatch


"meta-verify" will read info from various config files to piece all missing 
information together to repopulate Postgres with email aliases, site settings 
and such. "swatch" will populate Postgres in regards to user-, group- and 
site-quota, plus status from active monitor. So these three commands fully 
repopulate the empty Postgres database with all relevant info.

I also have a full guide on my page which contains slightly more steps. That's 
for cases where Postgres itself may also be hosed. So that guide explains how 
to reinstall Postgres from a PKG file and afterwards it guides through the 
steps needed for a re-population of the databases:

http://www.solarspeed.net/kb/963.php


-- 

With best regards,

Michael Stauber

_______________________________________________
Cobaltfacts site list
[email protected]
http://list.cobaltfacts.com/mailman/listinfo.cgi/cobaltfacts

Reply via email to