Re: pg_upgrade --link

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Brajendra Pratap Singh <singh(dot)bpratap766(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: pg_upgrade --link
Date: 2026-09-15 20:47:18
Message-ID: ce1ec43529283880f861a9ba17c6675d7bff1ff3.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2026-09-15 at 07:08 +0530, Brajendra Pratap Singh wrote:
> I have performed the production database upgrade from postgresql 13 to 17 version
> using pg_upgrade --link method on ubuntu 22.04 successfully.
>
> Now after few days of upgrade, while  dropped one database of size 900+ GB
> successfully, the space not get reclaimed physically from mount point /usr/pgdata.
>
> Old PG13 data directory: /usr/pgdata/data1 --> size 4.5TB
>
> New PG17 data directory:
> /usr/pgdata/data17 --> 5.6GB
>
> I didn't perform the delete_old_cluster.sh yet.
>
> I can see that the oid of this dropped database is present in PG13 data directory
> base location and occupying 972GB size, while it's not present in PG17 data
> directory base location.
>
> Now my doubt is if I removed Old data directory, will it cause any impact on
> running PG17 cluster.
>
> Please suggest the best and safe approach to reclaim the space.

Just go ahead and remove the old cluster.

With pg_upgrade --link, the data files exist only once, but are linked
in the data directory on both the old and the new server.

Try

du -sm /path/to/old/cluster /path/to/new/cluster

and the old cluster will appear large, while the new cluster will seem small
But if you run

du -sm /path/to/new/cluster /path/to/old/cluster

the new cluster will look big, and the new one will look small.

That is because the same files are referenced in both directories.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message 2026-09-16 15:35:15 Extract text from XML, pay attention to XML Entities
Previous Message Adrian Klaver 2026-09-15 15:22:13 Re: pg_upgrade --link