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 1krcu8-0004R7-2R for pgsql-general@arkaria.postgresql.org; Tue, 22 Dec 2020 08:20:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1krcu7-0005a4-0I for pgsql-general@arkaria.postgresql.org; Tue, 22 Dec 2020 08:20:23 +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 1krcu6-0005Zx-Ow for pgsql-general@lists.postgresql.org; Tue, 22 Dec 2020 08:20:22 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1krcu4-0007TP-D3 for pgsql-general@postgresql.org; Tue, 22 Dec 2020 08:20:21 +0000 Received: by mail-wr1-x42c.google.com with SMTP id d13so13579366wrc.13 for ; Tue, 22 Dec 2020 00:20:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=u2QjG3UjqDVqN462Fli4W/AGJ/t3p2pXddZDsgmGoNo=; b=RLCCxmzhKb/HncSsl7znBhVDo8A7QiA0ltmgYiycW8d6k/l6qzTEq1pkUubJ7npvl0 albMfMarDftgLiwnNWfjjnKr4UGHWu/jwG9hCsnOGxcllb1PEzcqFDGrhM3vnc8g5mZU P8/Yq86+FyIQcAdZVvugYOg32XbvEmJnE6BWwluCAR/Lr/nWQoh7+2hsJ/GZ+DzIexj/ knVPUITmFW1TRKUanznrpzp6qVBz/40ZLtDzd2T/uNkdwfdqe7nuW/t/oBALzGeigxYm N410JeuHaeKoW1JXWszOVbPWGXnwKz61iJGoN1Z/1QRPXo1/lirMN+2c8uKJ31eZT3Nb 38Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=u2QjG3UjqDVqN462Fli4W/AGJ/t3p2pXddZDsgmGoNo=; b=llZxanEvAzxpGuYpMDBNI47RqSiB1sUw4Seq1dCu9JKqZxcbOQx2U7A4jl+0F1dhJH 5GLSbgP8/E7t6z8Z/txH5UUs/I1LB/J9ynxlDyWpN/IDvYx+JOGlgUA8te5KIuNt0UIA C9G/0kpc6CY016bIlrEagfxyFJhsv/rDhe6mdLcc1GLb3qgyDlklPzeqxlRDfaHgVZE+ /lmXtZcC9tOJ04Ub8E9OidV9SkKKNunP/CPssp5lQzk+rL2KUE3kwZMKkgLHA/C+oS9u SxM7dXE0Dv1qyC8+s5sPiEXiJxnC8wjW2kUrYCd2bZ0/Ezzcu71DZvTVdNVm//pcZVnM u/EQ== X-Gm-Message-State: AOAM530Y0vdiM20P3UaDxmc+dm+i3MncbGNvgpflBvj5M/3afLH27RMZ h7rP5WYsM6dWafqgMaK8MkR+vVYNn48= X-Google-Smtp-Source: ABdhPJy5mBe8ANM7KRLD4zPQBYnjGJychKPGyi2SQFw4MifMc29sPDFN9wE3/a6fSXXiAZV8uuRkFA== X-Received: by 2002:adf:9d42:: with SMTP id o2mr14622680wre.135.1608625218025; Tue, 22 Dec 2020 00:20:18 -0800 (PST) Received: from [192.168.1.8] (241-57-239-77.dyn.cable.fcom.ch. [77.239.57.241]) by smtp.gmail.com with ESMTPSA id j15sm30992913wrr.85.2020.12.22.00.20.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2020 00:20:17 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: Re: pg_upgrade question From: =?utf-8?Q?Paul_F=C3=B6rster?= In-Reply-To: Date: Tue, 22 Dec 2020 09:20:15 +0100 Cc: "pgsql-general@postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: To: "Lu, Dan" X-Mailer: Apple Mail (2.3654.40.0.2.32) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Dan, > I am trying to find out if there is any step by step instruction to = reconcile old data dir and upgraded data dir after using =E2=80=9C=E2=80=94= link=E2=80=9D option to do an upgrade. > =20 > I ran this to do an upgrade from 11.5 to 12.1: pg_upgrade -d = /hostname/pg/dev115/data -D /hostname/pg/dev121upg/data --link -b = /pgdbadevbal800/pg/PostgreSQL-11.5/bin -B = /pgdbadevbal800/pg/PostgreSQL-12.1/bin -p 1432 -P 2432 =E2=80=93v > =20 > postgresdbad:dev115:pgdbadevbal800:> pwd > /hostname/pg > =20 > postgresdbad:dev115:pgdbadevbal800:> du -sh dev121upg > 2.3G dev121upg > =20 > postgresdbad:dev115:pgdbadevbal800:> du -sh dev115 > 22G dev115 > =20 > My goal is to be able to do an in place upgrade from 11.5 to 12.1 = using the same data dir =E2=80=9C/hostname/pg/dev115/data=E2=80=9D. = Without the =E2=80=9C=E2=80=94link=E2=80=9D option I need to double up = the space usage for the instance. What is the easiest way to accomplish = this task? > =20 > Thanks so much for your help. after a successful upgrade, you may delete the dev115 directory and move = the dev121upg directory in its place. That's how I usually do it. = Something like this example: (DB =3D cluster name) /data/pg/DB/db <=3D PGDATA old /data/pg/DB/dbnew <=3D PGDATA new, do the initdb here! initdb -k -D /data/pg/DB/dbnew ... pg_upgrade -d /data/pg/DB/db -D /data/pg/DB/dbnew ... pg_ctl -D /data/pg/DB/dbnew stop rm -rf /data/pg/DB/db mv /data/pg/DB/dbnew /data/pg/DB/db pg_ctl -D /data/pg/DB/db start Your milage may vary. Use at your own risk. ;-) If you shut down a PostgreSQL cluster properly, you can then easily move = PGDATA to virtually any place you want and start it there because = PostgreSQL doesn't keep references to absolute paths anywhere. Cheers, Paul=