From jay@dracodigital.com Tue Mar 20 04:38:07 2001 Received: from server.skillpositions.com (mail.skillpositions.net [208.189.31.33] (may be forged)) by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2K4c7N39961 for ; Mon, 19 Mar 2001 23:38:07 -0500 (EST) (envelope-from jay@dracodigital.com) Received: from jh (216.49.232-ip-95.ckt.net [216.49.232.95]) by server.skillpositions.com (8.9.3/8.8.7) with SMTP id WAA32242 for ; Mon, 19 Mar 2001 22:38:00 -0600 Message-ID: <007501c0b0f8$39eec060$3d6efea9@jh> From: "Jay Hodges" To: Subject: Moving databases Date: Mon, 19 Mar 2001 22:42:52 -0600 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0072_01C0B0C5.EE6ADAC0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Archive-Number: 200103/148 X-Sequence-Number: 996 This is a multi-part message in MIME format. ------=_NextPart_000_0072_01C0B0C5.EE6ADAC0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have a problem. I installed PostgreSQL, RH 6.1 and it put the database f= iles in /var/lib/pgsql, there also exists /usr/lib/pgsql that is not being = used. Now that my database is becoming quite large, it has outgrown the /var/ par= ition and I would like to move at least one database to /usr partition, or = to a NFS. can this be done easily, and if so, what would be the procedure to move the= files with no losses (all databases are currently active on the Internet t= o the public, but downtime is acceptable for moving them) Thanks in advance. Jay Hodges ------=_NextPart_000_0072_01C0B0C5.EE6ADAC0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I have a problem.  I installed Postgr= eSQL, RH=20 6.1 and it put the database files in /var/lib/pgsql, there also exists=20 /usr/lib/pgsql that is not being used.
 
Now that my database is becoming quite lar= ge, it=20 has outgrown the /var/ parition and I would like to move at least one datab= ase=20 to /usr partition, or to a NFS.
 
can this be done easily, and if so, what w= ould be=20 the procedure to move the files with no losses (all databases are currently= =20 active on the Internet to the public, but downtime is acceptable for moving= =20 them)
 
Thanks in advance.
Jay Hodges
 
------=_NextPart_000_0072_01C0B0C5.EE6ADAC0-- From tgl@sss.pgh.pa.us Tue Mar 20 06:34:57 2001 Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2K6YvN50938 for ; Tue, 20 Mar 2001 01:34:57 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.1/8.11.1) with ESMTP id f2K6YTt10055; Tue, 20 Mar 2001 01:34:29 -0500 (EST) To: "Jay Hodges" cc: pgsql-admin@postgresql.org Subject: Re: Moving databases In-reply-to: <007501c0b0f8$39eec060$3d6efea9@jh> References: <007501c0b0f8$39eec060$3d6efea9@jh> Comments: In-reply-to "Jay Hodges" message dated "Mon, 19 Mar 2001 22:42:52 -0600" Date: Tue, 20 Mar 2001 01:34:28 -0500 Message-ID: <10052.985070068@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200103/149 X-Sequence-Number: 997 "Jay Hodges" writes: > Now that my database is becoming quite large, it has outgrown the /var/ par= > ition and I would like to move at least one database to /usr partition, or = > to a NFS. > can this be done easily, and if so, what would be the procedure to move the= > files with no losses (all databases are currently active on the Internet t= > o the public, but downtime is acceptable for moving them) As long as you can afford downtime, it's not too tough to move a specific database to another partition: 1. Shutdown database (stop postmaster). 2. Move target database to new location (tar and untar, or cp -r -p should do). You want to transfer the whole subdirectory $PGDATA/base/yourdb/ to /some/place/else. 3. Make a symlink at $PGDATA/base/yourdb pointing to /some/place/else. 4. Restart postmaster, et voila. (Or, if you want to move the whole installation to a larger partition, just copy the whole $PGDATA tree, and adjust your postmaster start script to supply the new PGDATA location.) This is of course a tad ungraceful, but it's plenty effective as long as your space-management needs can be met by shifting whole databases. There are discussions in the archives about moving individual tables around via symlinks, but that's a lot more tedious to maintain. One thing to keep in mind is that a dump/restore will not preserve the symlink structures; you should keep notes so that you can manually reconstruct the layout if necessary. Better space management tools are on the TODO list, but that's where things stand for now. regards, tom lane PS: keeping a database on an NFS server is NOT recommended --- see past discussions in the archives, most recently in pgsql-general around 9-Feb.