| Summary: | emerge --config dev-db/postgresql-server fail on a new dedicated ext3 partition (partition not empty) | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Alain Toussaint <atoussaint76> |
| Component: | [OLD] Server | Assignee: | PgSQL Bugs <pgsql-bugs> |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | CC: | jmbsvicetto, titanofold |
| Priority: | High | ||
| Version: | unspecified | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
|
Description
Alain Toussaint
2011-01-08 04:00:05 UTC
Instead of mapping the partition to the PGDATA dir, wny don't you create the PGDATA dir under the new partition? If postgres works similarly to mysql, it likely won't accept what you're trying to do. This isn't a bug; it's a feature. initdb won't allow an install to take place where data already exists. It may be a bit heavy handed, but it's easier to program for "if there's anything there" than it is to program for "if any of these files are there". I'm guessing you edited the PGDATA variable in /etc/conf.d/postgresql-9.0 to contain: PGDATA="/pgdata" Instead, go for: PGDATA="/pgdata/9.0/" That is the recommended manner as it allows you to know which data belongs to which branch. In this case, /pgdata/9.0/ is PostgreSQL 9.0.x and /pgdata/9.1/ is PostgreSQL 9.1.x. Furthermore, you're going to have to adjust the 'postgres' Unix account to have it's home relocated to /pgdata/. Or, you could go the easy way and mount the separate partition to /var/lib/postgresql/ and stick with the defaults. (In reply to comment #1) > Instead of mapping the partition to the PGDATA dir, wny don't you create the > PGDATA dir under the new partition? > If postgres works similarly to mysql, it likely won't accept what you're trying > to do. > It will certainly allow the reporter to specify where he wants the data directory to be. The directory just need to be empty. (In reply to comment #3) > (In reply to comment #1) > > Instead of mapping the partition to the PGDATA dir, wny don't you create the > > PGDATA dir under the new partition? > > If postgres works similarly to mysql, it likely won't accept what you're trying > > to do. > > > > It will certainly allow the reporter to specify where he wants the data > directory to be. The directory just need to be empty. Right, but an ext3 root will never be empty (lost+found). What I was suggesting is similar to what you said in the previous comment. If the user was trying to use /pgdata, why not have the partition mounted as /pgdata, but tell postgresql to store the files under /pgdata/<something>? (In reply to comment #4) > (In reply to comment #3) > > (In reply to comment #1) > > > Instead of mapping the partition to the PGDATA dir, wny don't you create the > > > PGDATA dir under the new partition? > > > If postgres works similarly to mysql, it likely won't accept what you're trying > > > to do. > > > > > > > It will certainly allow the reporter to specify where he wants the data > > directory to be. The directory just need to be empty. > > Right, but an ext3 root will never be empty (lost+found). > > What I was suggesting is similar to what you said in the previous comment. If > the user was trying to use /pgdata, why not have the partition mounted as > /pgdata, but tell postgresql to store the files under /pgdata/<something>? > I have a feeling we might be writing past each other. I wasn't arguing against mounting the partition to /pgdata, only that fewer changes need to be made if it's mounted to /var/lib/postgresql/. As for making /pgdata a directory on the dedicated partition and then mounting it to /, that may not be such a good idea as it could interfere with /'s lost+found. As for having initdb automatically install to ${something} regardless of what the system administrator's desires: It is the system administrator's responsibility to determine what's best and work with the software based on its requirements. In this case, initdb requires an empty directory, so it is up to the system administrator to change PGDATA="/pgdata" to PGDATA="/pgdata/${something}" -- or some other solution -- so that initdb will have an empty directory to use. Thanks you very much for the comments. I'll keep postgresql in a directory under /pgdata (/pgdata/9.0), the changes remaining to be done is to adjust pg's home dir to the new location for consistency with my setup (I have a few softwares which I install and they are not available in portage). |