I didn't pay attention when i installed postgresql with aptitude, but it installed the databases in the wrong partition.

Now my partitions look like this:

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md1               10G  8.7G  793M  92% /
tmpfs                 2.0G     0  2.0G   0% /lib/init/rw
udev                   10M  176K  9.9M   2% /dev
tmpfs                 2.0G     0  2.0G   0% /dev/shm
/dev/md2              683G  197M  649G   1% /home

I checked and postgresql data is installed on /dev/md1

This will be a problem in no time, and I would like to fix this. What is the best approach ? Can i simply move the postgresql directory and patch some configuration file ? Can I extend the size of the partition dev/md1 ?

I'm looking for a way to do any of this successfully.

link|improve this question

Yes you can. No problem. – mailq Jan 12 at 21:46
feedback

1 Answer

up vote 1 down vote accepted

Shut down postgresql, move its directory to a new location, then either create a symlink from the old to the new location, or edit the configuration file, make sure the permissions are correct after moving (!). Finally start postgresql.

I have done this many times with mysql, or even oracle, it's perfectly fine as long as you don't mind the downtime. Don't try it on a running database server of course. In that case use the ways provided by the server to move files around. But at least in oracle's case you will still cause a bit of interruption of service since you'd have to take tablespace temporarily offline.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.