• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 533
  • Last Modified:

How do I configure Postgres9 to have the database on it's own partition in Linux?

Experts,

        I have a requirement of installing Postgres 9 database on it's own partition in RHEL5.  What are the steps to have DATA on it's own partition?

       I already installed Postgres, do I need to uninstall and reconfigure the software?

 In building the VM, I did designate two hard drives and two ethernet .

Thanks, Missymadi
0
missymadi
Asked:
missymadi
  • 3
  • 3
  • 2
1 Solution
 
Alex MatzingerDatabase AdministratorCommented:
You should be able to do this by setting the PGDATA environment variable to the partition you want data to be on, and then re initialzing the database.
export PGDATA =</partition/DATA folder>

initdb

pg_ctl start

Open in new window


All done as the postgres user.
0
 
Alex MatzingerDatabase AdministratorCommented:
Sorry, no space inbetween the PGDATA and = sign
export PGDATA=</partition/DATA folder>

Open in new window

0
 
missymadiAuthor Commented:
I'm new to Linux. Could you point me in the right direction of how to find the hard drive names and a command to find out the size of each. I'm guessing the lesser size of the two is where you would assign the pgdata to?

Thanks, Missymadi
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
Alex MatzingerDatabase AdministratorCommented:
The command is df.  

To get a more readable outpt use df -H which will output the resutls into k or M or G depending on the size of the drive. (h = human readable)  ... (you can do the same thing with ls -lh to see the real size of files as well)
0
 
missymadiAuthor Commented:
This is strange. I tried to su postgres and the system is telling me that postgres does not exist?? How did this happen? How can I resolve this?
0
 
data_n_pokerCommented:
Check to make sure that the postgres directories are still on the machine.  If they are then try recreting the postgres user with root:
su - root
useradd -p <PASSWORD> postgres

Open in new window

0
 
missymadiAuthor Commented:
I added postgres back. How could that have happened? We do have custom scripts but I would'nt think that they would want postgres to be disabled or deleted?

Anyway - we do have custom scripts. It looks like our data is captured in a directory
opt/co/DATA   which contains directories, base, global, pg_clog, pg_log, pg_multixact  etc. Is this the DATA directory that I want to point to the separate partition? I did a find on PGDATA and did not find anything.

Thanks, Missymadi
0
 
data_n_pokerCommented:
It would appear that perhaps one of your custom scripts erased, or moved the postgres user...not sure how that would happen.  Now just set PGDATA to opt/co/DATA and you should be good to go
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now