Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Commonmark migration
Source Link

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:

  1. According to Postgres Documentation, one method would be to use the initdb command with the -D option.

    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.

initdb will attempt to create the directory you specify if it does not already exist.

  1. 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.

  2. 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

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.

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:

  1. 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.

  1. 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.

  2. 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.

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:

  1. 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.

  2. 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.

  3. 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.

Source Link
John
  • 536
  • 3
  • 5
  • 13

Moving postgres data folder on NFS drive. Is it better to symlink, reinit cluster, or modify init.d script?

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:

  1. 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.

  1. 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.

  2. 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.