Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gmK2q-0002E5-7m for pgsql-general@arkaria.postgresql.org; Wed, 23 Jan 2019 15:02:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gmK2o-0005QB-Mm for pgsql-general@arkaria.postgresql.org; Wed, 23 Jan 2019 15:02:22 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gmK2o-0005Q4-BL for pgsql-general@lists.postgresql.org; Wed, 23 Jan 2019 15:02:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gmK2g-0007Og-O4 for pgsql-general@postgresql.org; Wed, 23 Jan 2019 15:02:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x0NF21tl026694; Wed, 23 Jan 2019 10:02:01 -0500 From: Tom Lane To: Alban Hertroys cc: pgsql-general@postgresql.org Subject: Re: Reclaiming space for dropped database In-reply-to: References: Comments: In-reply-to Alban Hertroys message dated "Wed, 23 Jan 2019 13:33:20 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26692.1548255721.1@sss.pgh.pa.us> Date: Wed, 23 Jan 2019 10:02:01 -0500 Message-ID: <26693.1548255721@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alban Hertroys writes: > Our current development database server is running a bit low on diskspace, > so I dropped an old but rather large database with the intention of > claiming back some space. However, the space remains claimed. > This server was upgraded from PG10 to PG11 using pg_upgrade's --link > option. If you used --link, then all the files would remain hard-linked from both the old and new database directories. You've got to remove them from the old DB directory as well. There's not really any point in keeping around the source DB directory once you've completed a --link migration. Starting the postmaster in the old DB directory would be disastrous because the files are inconsistent from its standpoint once the new postmaster has modified them at all. (In fact, I think pg_upgrade intentionally makes the old directory non-runnable to prevent that error.) So you might as well just "rm -rf ./10", not only its biggest subdirectory. regards, tom lane