# Upgrade Postgres with REALLY limited space

**URL:** <https://meta.discourse.org/t/upgrade-postgres-with-really-limited-space/201937>\
**Category:** Self-hosting\
**Tags:** server-resources\
**Created:** [August 27, 2021, 5:42pm UTC](https://meta.discourse.org/t/upgrade-postgres-with-really-limited-space/201937 "2021-08-27T17:42:10Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Wingtip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wingtip/32/102039_2.png) [@Wingtip](https://meta.discourse.org/u/Wingtip)\
**Post date:** [August 27, 2021, 5:42pm UTC](https://meta.discourse.org/t/upgrade-postgres-with-really-limited-space/201937/1 "2021-08-27T17:42:11Z")

</div>

The [documented procedure on the forums](https://meta.discourse.org/t/postgresql-13-update/172563) lists two methods of upgrading Postgres.

1. Just let Discourse handle it. This requires _3 times_ the disk space. So if your DB is 100GB, you would need an additional 200GB _free_ to do the upgrade. Obviously a huge problem for people with large installs.
2. Follow their “manual update” procedure. This requires _2 times_ the disk space, so if your DB is 100GB you would need an additional 100GB free. This is also a big problem for some.

In [this post](https://meta.discourse.org/t/discourse-on-postgres-12-breaks-upgrades/201814/15), @Falco suggested using the `--link` option to do the upgrade in-place using hard links. The [docker container](https://github.com/tianon/docker-postgres-upgrade) they suggest using supports that argument, but Discourse devs don’t suggest using it in the post.

So my question is this, should option 3 be:

1. Run the command below, which will require a _very small_ amount of additional disk space. So if your DB is 100GB, it might require, say, an additional 10GB? And if so, is this a recommended procedure by the Discourse devs, and has anyone actually done it before and lived to tell the tale?

**New** command to upgrade in-place:

```plaintext
docker run --rm \
	-v DIR:/var/discourse/shared/standalone/postgres_data:/var/lib/postgresql \
	tianon/postgres-upgrade:12-to-13 \
	--link

```

&nbsp;

Compared to the **old** command to upgrade into a new directory (requiring double the space):

```plaintext
docker run --rm \
	-v /var/discourse/shared/standalone/postgres_data:/var/lib/postgresql/12/data \
	-v /var/discourse/shared/standalone/postgres_data_new:/var/lib/postgresql/13/data \
	tianon/postgres-upgrade:12-to-13

```

P.S.: I would have just replied to that PG13 upgrade thread, but it deletes posts after 7 days. Why do you have it configured that way? I know there was a lot of discussion when this first came up that would have been useful for reference.

---

_[View the full topic](https://meta.discourse.org/t/upgrade-postgres-with-really-limited-space/201937)._
