A real transfer, a same-version rehearsal
Both --old-bindir and --new-bindir point to /usr/local/pgsql/bin. This lab transfers a cluster with the installed version, but it does not demonstrate cross-major compatibility. Record the actual version before and after instead of trusting the version number in the data-directory pathname.
--check inspects compatibility and can create diagnostic files or start temporary servers; it does not transfer data. For a real upgrade, install supported old/new binaries and compatible extension libraries, test the application, and verify authentication/configuration separately.
Copy mode copies relation contents; link mode creates filenames for the same underlying contents and requires the same filesystem. Metadata work still scales with the object inventory. Once the new linked cluster starts writing, the old files cannot serve as an independent rollback copy.
Compare the saved data and sorted role inventory after starting /tmp/new_data. Counts and role names prove only that inventory, not every permission, query or application behaviour. Refresh and inspect statistics as a separate step; version-specific pg_upgrade output decides what additional statistics work is needed.
Did you know? You can run preflight against an old server that is still running when its ports are chosen correctly. This lab uses stopped servers to keep the procedure focused. pg_upgrade documentation.
Key concepts
pg_upgrade --link (-k)
--link creates names pointing at the same relation-file contents instead of copying them. It needs one filesystem and still performs catalog work. Once the new linked cluster is started, the old files cannot provide an independent rollback copy.
Verify post-transfer statistics
Statistics handling depends on source and target versions. Follow the actual upgrade report, run the required analysis commands, and inspect pg_stats and analysis state. This same-version rehearsal explicitly runs vacuumdb --all --analyze-only.