Move PGdata to a different drive

Started by Jennifer Treyalmost 17 years ago7 messagesgeneral
Jump to latest
#1Jennifer Trey
jennifer.trey@gmail.com

Hi,
What file should I be working with?

Thanks in advance / Jennifer

#2Bruce Momjian
bruce@momjian.us
In reply to: Jennifer Trey (#1)
Re: Move PGdata to a different drive

Jennifer Trey wrote:

Hi,
What file should I be working with?

Just shut down the server and move the directory whever you want and
restart the server. There are no file contents that need changing. Of
course should adjust your scripts or PGDATA environment variable.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

#3Jennifer Trey
jennifer.trey@gmail.com
In reply to: Bruce Momjian (#2)
Re: Move PGdata to a different drive

Ook.. thats what I wanted to know. I figured there has to be a place to
change the pointer to the new location of the data.
Thank you / Jennifer

On Thu, Jun 4, 2009 at 6:11 PM, Bruce Momjian <bruce@momjian.us> wrote:

Show quoted text

Jennifer Trey wrote:

Hi,
What file should I be working with?

Just shut down the server and move the directory whever you want and
restart the server. There are no file contents that need changing. Of
course should adjust your scripts or PGDATA environment variable.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In reply to: Jennifer Trey (#3)
Re: Move PGdata to a different drive

Probably you do not have any script to start PostgreSQL, but it is started
as a service.

The data directory is a parameter of the service within services.msc, there
is
... pg_ctl.exe ... -D "<your drive>":\your\directory"

Read up on pg_ctl --help how to change this information

(pg_ctl --register)

Best wishes,

HArald

On Thu, Jun 4, 2009 at 5:13 PM, Jennifer Trey <jennifer.trey@gmail.com>wrote:

Ook.. thats what I wanted to know. I figured there has to be a place to
change the pointer to the new location of the data.
Thank you / Jennifer

On Thu, Jun 4, 2009 at 6:11 PM, Bruce Momjian <bruce@momjian.us> wrote:

Jennifer Trey wrote:

Hi,
What file should I be working with?

Just shut down the server and move the directory whever you want and
restart the server. There are no file contents that need changing. Of
course should adjust your scripts or PGDATA environment variable.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

--
GHUM Harald Massa
persuadere et programmare
Harald Armin Massa
Spielberger Straße 49
70435 Stuttgart
0173/9409607
no fx, no carrier pigeon
-
LASIK good, steroids bad?

#5David Fetter
david@fetter.org
In reply to: Bruce Momjian (#2)
Re: Move PGdata to a different drive

On Thu, Jun 04, 2009 at 11:11:29AM -0400, Bruce Momjian wrote:

Jennifer Trey wrote:

Hi,
What file should I be working with?

Just shut down the server and move the directory whever you want and
restart the server. There are no file contents that need changing.
Of course should adjust your scripts or PGDATA environment variable.

Another way to do this is to mount the drive at the place where PGDATA
used to be. The down side of this approach is that it only works if
you want your PGDATA at the root of that new drive.

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

#6Yaroslav Tykhiy
yar@barnet.com.au
In reply to: David Fetter (#5)
Re: Move PGdata to a different drive

David Fetter wrote:

On Thu, Jun 04, 2009 at 11:11:29AM -0400, Bruce Momjian wrote:

Jennifer Trey wrote:

Hi,
What file should I be working with?

Just shut down the server and move the directory whever you want and
restart the server. There are no file contents that need changing.
Of course should adjust your scripts or PGDATA environment variable.

Another way to do this is to mount the drive at the place where PGDATA
used to be. The down side of this approach is that it only works if
you want your PGDATA at the root of that new drive.

And of course one can create a safety symlink to the new location of
PGDATA from the old location just in case, e.g., if one suspects
hidden references to PGDATA location in home-made scripts etc. Of
course, that had better be straightened out sooner than later and the
safety symlink removed for the sake of clarity, but when you need to
get everything rolling *ASAP*, temporary symlinks can be helpful.

Yar

#7Jasen Betts
jasen@xnet.co.nz
In reply to: Jennifer Trey (#1)
Re: Move PGdata to a different drive

On 2009-06-05, David Fetter <david@fetter.org> wrote:

On Thu, Jun 04, 2009 at 11:11:29AM -0400, Bruce Momjian wrote:

Jennifer Trey wrote:

Hi,
What file should I be working with?

Just shut down the server and move the directory whever you want and
restart the server. There are no file contents that need changing.
Of course should adjust your scripts or PGDATA environment variable.

Another way to do this is to mount the drive at the place where PGDATA
used to be. The down side of this approach is that it only works if
you want your PGDATA at the root of that new drive.

linux (2.4 and later) can mount paths using --bind

That is, you can use mount like a symlink (except unlike a symlink the mounted
directories are still there after chroot)

Show quoted text

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate