I want to move my postgres data
folder to an NFS drive but I'm not sure what would be the best way to do it. I've got three options in mind:
According to Postgres Documentation, one method would be to use the
initdb
command with the-D
option.initdb
will attempt to create the directory you specify if it does not already exist.Another method listed on LinuxQuestions.org is to update the
postgressql
init script to point to the new directory, which in this case would be the NFS drive.Lastly, I was thinking I would just copy the
pgsql/data
folder to the NFS drive and simply symlink the folder.i.e.,
pgsql/data -> nfs/data
Symlinking or updating the init script seem like the simplest approach to me, but I'm not sure if they would be best or the safest way. This is where I hope someone can help me out. Any suggestions, concerns, and pros/cons would be appreciated.
Environment Information
- Red Hat Enterprise Linux Server 5.7
- PostgreSQL 8.3.6
Assume that the NFS drive is mounted with -maproot=root
option and that the NFS drive would be accessed by the root
user.