I'm attempting to upgrade from 9.6.2 to 10.5 using pg_upgrade
My upgrade command (from OpenBSD pkg-readme):
su _postgresql -c "cd /var/postgresql && \
pg_upgrade --link -b /usr/local/bin/postgresql-9.6/ -B /usr/local/bin \
-U postgres -d /var/postgresql/data-9.6/ -D /var/postgresql/data"
results in the following error
CREATE TABLESPACE "mydb" OWNER "mydb" LOCATION '/path/to/postgresql/mydb'; psql:pg_upgrade_dump_globals.sql:87: ERROR: directory "/path/to/postgresql/mydb/PG_10_201707211" already in use as a tablespace
I'm using --link
because the tablespace mentioned above is using 1.5TB of the available 1.8TB on its partition. So I don't think I'd have the disk space to do pg_upgrade without --link
I have disk space on other partitions if that helps.
EDIT
Before I encountered this error, I ran thepg_upgrade
command without the --link
flag, but then killed it when I realized there was insufficient disk space. After that I re-ran initdb
followed by the pg_upgrade command above.
Now I have 9.6 running again, but I have two directories in my tablespace location:
[root@host:~]$ls /path/to/postgresql/mydb/
PG_10_201707211 PG_9.6_201608131
Can I safely rename PG_10_201707211 to PG_9.6_201707211 and try the upgrade again?
Best Answer
"PG_10_201707211" must be a left over directory from your aborted attempt at running pg_upgrade without the --link flag. You can delete it, or out of an abundance of caution move it to one of your other partitions. Renaming it the way you describe wouldn't accomplish much and would be very confusing if you have more problems in the future which require more investigation.