Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kz9h2-0003cu-EX for pgsql-general@arkaria.postgresql.org; Tue, 12 Jan 2021 02:46:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kz9h1-00035F-7U for pgsql-general@arkaria.postgresql.org; Tue, 12 Jan 2021 02:45:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kz9h0-000358-W2 for pgsql-general@lists.postgresql.org; Tue, 12 Jan 2021 02:45:58 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kz9gy-0003NV-R6 for pgsql-general@postgresql.org; Tue, 12 Jan 2021 02:45:57 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1kz9gk-0006xE-0V; Mon, 11 Jan 2021 21:45:42 -0500 Date: Mon, 11 Jan 2021 21:45:42 -0500 From: Bruce Momjian To: =?utf-8?B?SmFtZXMo546L5petKQ==?= Cc: pgsql-general Subject: Re: What to do with tablespaces when upgrading to pg13 from pg1X? Message-ID: <20210112024541.GA4329@momjian.us> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Jan 12, 2021 at 10:28:52AM +0800, James(王旭) wrote: > Hello, > I was planning to upgrade from 12 to 13 using this command: > > /usr/pgsql-13/bin/pg_upgrade -b /usr/pgsql-12/bin/ -B /usr/pgsql-13/bin/ -d > /data/pg/ -D /pg/pgdata_13/ --jobs=10 > > > And I got this output: > > Checking for presence of required libraries ok > Checking database user is the install user ok > Checking for prepared transactions ok > Checking for new cluster tablespace directories > new cluster tablespace directory already exists: "/data/tsdb/metas/ > PG_13_202007201" > Failure, exiting > > I think it's because /data/tsdb was my tablespace dir which was out of the old > main data directory(/data/pg/). > > So what should I do with old tablespaces when upgrading ? There should be a subdirectory under your tablespace directory for every major version, e.g., PG_13_202007201. I have no idea why your _new_ version already has a directory there. Do you have a second cluster on the machine that is using that tablespace directory for PG 13? -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee