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 1o5lQi-0007ky-45 for pgsql-general@arkaria.postgresql.org; Mon, 27 Jun 2022 09:53:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o5lQg-0004rv-Rr for pgsql-general@arkaria.postgresql.org; Mon, 27 Jun 2022 09:53:14 +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 1o5lQg-0004rl-Bn for pgsql-general@lists.postgresql.org; Mon, 27 Jun 2022 09:53:14 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o5lQb-00030m-Pc for pgsql-general@lists.postgresql.org; Mon, 27 Jun 2022 09:53:13 +0000 Received: by mail-wm1-x330.google.com with SMTP id n185so5034655wmn.4 for ; Mon, 27 Jun 2022 02:53:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=2zwlL8HXQBKEyUO5UrD+EMdiEZOJN6EOEgKFhC3SNn8=; b=KNYbYIzjfR+2qsdcVi/gpTw2+MXKwOCSzCOJ6Po5cOkczmNTWBpqjTwG7UUVQW2xl2 UkUzPxsH2aPWD8l/nyrsECd1jCv88MqZWQcReRHxEDMZtdQ2AxtJqQAua/dx+5axQhdW 6q/SIwm9nkd4aICOacowufBo3HpCu8hIPPyD9DkqN18ZjL09cWsBtEfpSu/xZ+WmBnlc VIPxF/9vYVH9hY6eXMcT/KQWK1Nrm2MlLRTdRcSU/LwOSDxItmYU37/6F4EaAOv8z9nR b+9Xxs4pqpkBnlY4iVK485C1+xHjYoQEZO8s9E0FMZ6jQyn0/Kf9VYtskyVOuL2v/B0g pc8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=2zwlL8HXQBKEyUO5UrD+EMdiEZOJN6EOEgKFhC3SNn8=; b=s5dvJB5pV0vrCGf5Z1nPtCufxqraVFLCs6F69rr/K7mAnCCplV+3MjtmQJ4Y/YaZ1K 6qtCONE8hlbSbph8dsFQc45g80nSpEbibsUX4eeQD1YWS6XCU0PRrc88ko1mDod5ISYV 15u39ciGLxwwtj4WoYzsDmeXh6So3e4V7ACbSFLSaiMkagNRJ7V8TYDiR6/KmOKWb3By iKI26ccy0sr5EHt3m3OXWHMj32xyw9U9T836eIInMdEslApRCQcZA0X6/8CUoP0ReV8Y SnGZjy+//ZTeK160YVdW4kJwuB1Rr5qMVlOe/DYPKs+uY6WBa3iesobhi7pHGU2t4N/D VaZg== X-Gm-Message-State: AJIora9fiooMeA+HSiYaNLxd+0ygSO/GCvPSfK6fnLMsRms6LaY/bS/R q+LHhyh+sz+niqSB5tG0Odg= X-Google-Smtp-Source: AGRyM1upPZF9TXZRVHI4myOg9M4dxWBokC53Mv1aNhUalp+8fF/h1jEQWTPk8tWfD+ayuo/dGQ45lw== X-Received: by 2002:a05:600c:1f17:b0:39e:e931:ced9 with SMTP id bd23-20020a05600c1f1700b0039ee931ced9mr14332245wmb.27.1656323588115; Mon, 27 Jun 2022 02:53:08 -0700 (PDT) Received: from smtpclient.apple (ppp-94-66-221-109.home.otenet.gr. [94.66.221.109]) by smtp.gmail.com with ESMTPSA id n9-20020a7bcbc9000000b003a039054567sm12767609wmi.18.2022.06.27.02.53.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jun 2022 02:53:07 -0700 (PDT) From: Florents Tselai Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_15A446C6-1987-402A-9E48-E7873AC61255" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) Subject: Re: Table space not returned to the OS ? Date: Mon, 27 Jun 2022 12:53:06 +0300 In-Reply-To: Cc: pgsql-general To: Magnus Hagander References: <35BEB990-A045-413D-8F0F-EA372754960C@gmail.com> X-Mailer: Apple Mail (2.3696.100.31) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_15A446C6-1987-402A-9E48-E7873AC61255 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 27 Jun 2022, at 12:38 PM, Magnus Hagander = wrote: >=20 >=20 >=20 > On Mon, Jun 27, 2022 at 11:30 AM Florents Tselai = > wrote: > Hi, >=20 > A few months back (October) I had upgraded a Postgres instance from = v12 =E2=80=94> 14. >=20 > The database disk size under /var/lib/postgresql/12 was around 800GB+ = back then. > Note, that IIRC I had used hard-linking during the upgrade. >=20 > In the database itself, lots of things have changed since.=20 > In fact, that database itself has been dropped at some point and = restored from a backup. >=20 > As I was running out of disk space, I started investigating and found = out that=20 >=20 > /var/lib/postgresql/12/main/base/16385 =E2=80=94> 886GB+=20 > /var/lib/postgresql/14 =E2=80=94> 400GB >=20 > The last modification date on that directory (../12/) appears to be = around a month ago, > When the table with relied 16385 was in fact dropped. >=20 > Now, In my update scripts (I use this db as an OLAP) I occasionally = run VACUUM. >=20 > Is it weird that the 886GB space hasn=E2=80=99t been returned to the = OS yet?=20 >=20 > What=E2=80=99s the safest way to return it to the OS manually? >=20 >=20 > When you use hardlinks in the upgrade all the files remain in the old = directory when they are removed from the new one such as when you drop a = relation. it is there for emergency recoveries. It's only the contents = of the files that's "mirrored", not the existance. >=20 > It looks like you didn't actually delete the old cluster, which you = are supposed to do once you have verified that the new one works. This = looks like a debian/ubuntu system, which means you probably forgot to = run "pg_dropcluster 12 main"? Or if it's not a debian cluster, the = equivalent of that which results in Ah, you=E2=80=99re right=20 pg_dropcluster 12 main && systemctl daemon-reload=20 worked fine. Thanks. > removing the data directory for 12 along with any configuration files = it has elsewhere. >=20 > -- > Magnus Hagander > Me: https://www.hagander.net/ > Work: https://www.redpill-linpro.com/ = --Apple-Mail=_15A446C6-1987-402A-9E48-E7873AC61255 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On 27 Jun 2022, at 12:38 PM, Magnus Hagander <magnus@hagander.net>= wrote:



On Mon, Jun 27, 2022 at = 11:30 AM Florents Tselai <florents.tselai@gmail.com> wrote:
Hi,

A few months back (October) I had upgraded a = Postgres instance from v12 =E2=80=94> 14.

The database disk size under /var/lib/postgresql/12 was = around 800GB+ back then.
Note, that IIRC I had used = hard-linking during the upgrade.

In the = database itself, lots of things have changed since. 
In fact, = that database itself has been dropped at some point and restored from a = backup.

As I was running out of disk space, = I started investigating and found out that 

/var/lib/postgresql/12/main/base/16385  =E2=80=94> = ; 886GB+ 
/var/lib/postgresql/14 =E2=80=94> 400GB

The last modification date on that directory (../12/) appears = to be around a month ago,
When the table with relied 16385 = was in fact dropped.

Now, In my update = scripts (I use this db as an OLAP) I occasionally run VACUUM.

Is it weird that the 886GB space hasn=E2=80=99t = been returned to the OS yet? 

What=E2=80=99s the safest way to return it to the OS = manually?


When you use hardlinks in the = upgrade all the files remain in the old directory when they are removed = from the new one such as when you drop a relation. it is there for = emergency recoveries. It's only the contents of the files that's = "mirrored", not the existance.

It looks like you didn't actually = delete the old cluster, which you are supposed to do once you have = verified that the new one works. This looks like a debian/ubuntu system, = which means you probably forgot to run "pg_dropcluster 12 main"? Or if = it's not a debian cluster, the equivalent of that which results in =

Ah, = you=E2=80=99re right 
pg_dropcluster 12 main && = systemctl daemon-reload 
worked fine.

Thanks.

removing the data directory for 12 along with any = configuration files it has elsewhere.

--

= --Apple-Mail=_15A446C6-1987-402A-9E48-E7873AC61255--