[root@ ~]# grep postgres /etc/passwd postgres:x:88:88::/var/lib/postgres:/bin/bash [root@ ~]# cat /etc/conf.d/postgresql # # Parameters to be passed to postgresql # PGROOT="/var/lib/postgres" INITOPTS="--locale $LANG" [root@ ~]# ls -alhd /var/lib/postgres* drwxr-x--- 3 postgres postgres 4,0K dic 27 15:10 /var/lib/postgres drwxr-x--- 3 postgres postgres 4,0K dic 21 03:22 /var/lib/postgres_old_20101227 [root@ ~]# su postgres [postgres@ ~]$ cd ~/data/ [postgres@ ~]$ pg_dumpall > pgs_db.out [postgres@ ~]$ exit [root@ ~]# /etc/rc.d/postgresql stop :: Stopping PostgreSQL [BUSY] waiting for server to shut down..... done server stopped [DONE] [root@ ~]# mv /var/lib/postgres /var/lib/postgres_old [root@ ~]# ls -alhd /var/lib/postgres* drwxr-x--- 3 postgres postgres 4,0K dic 27 15:10 /var/lib/postgres_old drwxr-x--- 3 postgres postgres 4,0K dic 21 03:22 /var/lib/postgres_old_20101227 [root@ ~]# pacman -S postgresql . . . ... update postgresql ... . . . [root@ ~]# /etc/rc.d/postgresql start :: Starting PostgreSQL [BUSY] su: warning: cannot change directory to /var/lib/postgres: Permission denied could not change directory to "/root" The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale C. The default database encoding has accordingly been set to SQL_ASCII. The default text search configuration will be set to "english". initdb: could not access directory "/var/lib/postgres/data": Permission denied su: warning: cannot change directory to /var/lib/postgres: Permission denied could not change directory to "/root" pg_ctl: could not open PID file "/var/lib/postgres/data/postmaster.pid": Permission denied [root@ ~]# ls -alhd /var/lib/postgres* drwxr-x--- 3 root root 4,0K dic 27 18:33 /var/lib/postgres drwxr-x--- 3 postgres postgres 4,0K dic 27 15:10 /var/lib/postgres_old drwxr-x--- 3 postgres postgres 4,0K dic 21 03:22 /var/lib/postgres_old_20101227 [root@ ~]# cat postgres.patch 19c19 < [ -d $PGROOT ] && chown -R postgres.postgres $PGROOT --- > [ -d $PGROOT ] && chown -R postgres:postgres $PGROOT 23c23 < mkdir -p $PGROOT/data && chown -R postgres.postgres $PGROOT/data --- > mkdir -p $PGROOT/data && chown postgres:postgres $PGROOT && chown -R postgres:postgres $PGROOT/data [root@ ~]# patch /etc/rc.d/postgresql postgres.patch patching file /etc/rc.d/postgresql [root@ ~]# rm -r /var/lib/postgres [root@ ~]# /etc/rc.d/postgresql start :: Starting PostgreSQL [BUSY] The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale C. The default database encoding has accordingly been set to SQL_ASCII. The default text search configuration will be set to "english". fixing permissions on existing directory /var/lib/postgres/data ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 24MB creating configuration files ... ok creating template1 database in /var/lib/postgres/data/base/1 ... ok initializing pg_authid ... ok initializing dependencies ... ok creating system views ... ok loading system objects' descriptions ... ok creating conversions ... ok creating dictionaries ... ok setting privileges on built-in objects ... ok creating information schema ... ok loading PL/pgSQL server-side language ... ok vacuuming database template1 ... ok copying template1 to template0 ... ok copying template1 to postgres ... ok WARNING: enabling "trust" authentication for local connections You can change this by editing pg_hba.conf or using the -A option the next time you run initdb. Success. You can now start the database server using: /usr/bin/postgres -D /var/lib/postgres/data or /usr/bin/pg_ctl -D /var/lib/postgres/data -l logfile start server starting [DONE] [root@ ~]# ls -alhd /var/lib/postgres* drwxr-x--- 3 postgres postgres 4,0K dic 27 19:03 /var/lib/postgres drwxr-x--- 3 postgres postgres 4,0K dic 27 15:10 /var/lib/postgres_old drwxr-x--- 3 postgres postgres 4,0K dic 21 03:22 /var/lib/postgres_old_20101227 [root@ ~]# ls -alhd /var/lib/postgres/data drwx------ 12 postgres postgres 4,0K dic 27 19:03 /var/lib/postgres/data [root@ ~]# ls -alh /var/lib/postgres/data total 88K drwx------ 12 postgres postgres 4,0K dic 27 19:03 . drwxr-x--- 3 postgres postgres 4,0K dic 27 19:03 .. drwx------ 5 postgres postgres 4,0K dic 27 19:03 base drwx------ 2 postgres postgres 4,0K dic 27 19:03 global drwx------ 2 postgres postgres 4,0K dic 27 19:03 pg_clog -rw------- 1 postgres postgres 3,9K dic 27 19:03 pg_hba.conf -rw------- 1 postgres postgres 1,6K dic 27 19:03 pg_ident.conf drwx------ 4 postgres postgres 4,0K dic 27 19:03 pg_multixact drwx------ 2 postgres postgres 4,0K dic 27 19:03 pg_notify drwx------ 2 postgres postgres 4,0K dic 27 19:04 pg_stat_tmp drwx------ 2 postgres postgres 4,0K dic 27 19:03 pg_subtrans drwx------ 2 postgres postgres 4,0K dic 27 19:03 pg_tblspc drwx------ 2 postgres postgres 4,0K dic 27 19:03 pg_twophase -rw------- 1 postgres postgres 4 dic 27 19:03 PG_VERSION drwx------ 3 postgres postgres 4,0K dic 27 19:03 pg_xlog -rw------- 1 postgres postgres 18K dic 27 19:03 postgresql.conf -rw------- 1 postgres postgres 48 dic 27 19:03 postmaster.opts -rw------- 1 postgres postgres 49 dic 27 19:03 postmaster.pid [root@ ~]#