How can I move postgresql data to another directory on Ubuntu over Amazon EC2? -


we've been running postgresql 8.4 quite time. database, reaching our threshold space. added 8 gb ebs drive , mounted our instance , configured work on directory called /files

within /files, manually created

correct me if i'm wrong, believe postgresql data stored in /var/lib/postgresql/8.4/main

i backed database , ran sudo /etc/init.d/postgresql stop. stops postgresql server. tried copy , paste contents of /var/lib/postgresql/8.4/main /files directory turned out huge mess! due file permissions. had go in , chmod contents of folder copy , paste them. files did not copy because of root permissions. modified data_directory parameter in postgresql.conf point files directory

 data_directory = '/files/postgresql/main' 

and ran sudo /etc/init.d/postgresql restart , server failed start. again due permission issues. amazon ec2 allows access service ubuntu default. can access root within terminal makes lot more complicated.

is there cleaner , more efficient step step way of doing this?

stop server.

copy datadir while retaining permissions - use cp -arv.

then (easiest, avoids need modify initscripts) move old datadir aside , symlink old path new location.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -