Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hM2uZ-0005zS-9X for pgsql-general@arkaria.postgresql.org; Thu, 02 May 2019 04:01:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hM2uY-0005Jy-3T for pgsql-general@arkaria.postgresql.org; Thu, 02 May 2019 04:01:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hM2uX-0005DT-MP for pgsql-general@lists.postgresql.org; Thu, 02 May 2019 04:01:29 +0000 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hM2uU-0001I7-R4 for pgsql-general@lists.postgresql.org; Thu, 02 May 2019 04:01:28 +0000 Received: by mail-ot1-x334.google.com with SMTP id a10so820345otl.12 for ; Wed, 01 May 2019 21:01:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=3EwAYphbWYYIn13lEpzv8Ac42N1u93dQbCTK194ZDrI=; b=uLShZrieajxgGLrtsi3byyEH6YFwGdd0ldbze/1/Q6FwBYb7BSrLXAZ5Dw8k/HHu7E Rvp3wrbGgeX29c6ZjAImpBHXGTtRvrrpzMqmcR01MnUyVhy0ZUxoefULqBziRXEOWPIE zsPSnDrDRWX6G2oe2RtnG8y2DMmw8Cop+Hyj1ZIJN9/8h31mff+ic9aHl+OfF7M5Ws7K t+YlMd8CpXX+hqEQhX4qC6GlzV/r6KEGuAyrWbJttpORrjqDOCx+cRRRRKQVo7/hrqQz tvcAfu6Epws3WqjN/wDodjApqWF1ZlA5ui66K88BIjhSOuEQahVLIA5G2DmCe93nxrJB 4q7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=3EwAYphbWYYIn13lEpzv8Ac42N1u93dQbCTK194ZDrI=; b=Ri2E3yah9mX0Wrq5CYECtmgEQoLWzUdnptnBBYymCDgBvCfL5mtW1fJLYdln+BVUh2 Dl1a4LX4xzOqvfVEAcqD93QGxqzeUy8Np7xPUzAXQ5i0p3f6Rwl8Ejz3bLso2JBDKRLZ tyo5sPiaTY1FmUtt7bXpMAqI/C0PDDmM3Kf1oNdnaU922MgGUC9d5usn+jtPNl1Y2TXs huOFKQdTfKwX9392CeimAmSOTVgkQVLKGJDuBQVV2N/HCCMXxC4IWGI413kKUOlICDjZ 7f/hQuXyxwWrHO1nGLzs9yu9eiWygMPBxqjv1BxKpHq8eRN1Ap9Tgnn5x++wgmoZoO8M C/Ig== X-Gm-Message-State: APjAAAVrIBHg3U0Qgl31YKn6CWu0J+YLVr9yJq6OEaFryR8FxNUHjqfm 3Mdfom8eGrrivIY9h3haCLwbCsAehyt5Iw== X-Google-Smtp-Source: APXvYqynMOa8dT1eurlgsde/MYOZxZCT/3hSngzuuuPjTRT8bwGijaVLZrXmiX3jr29/1wRu7SN83g== X-Received: by 2002:a9d:204c:: with SMTP id n70mr1108506ota.346.1556769684335; Wed, 01 May 2019 21:01:24 -0700 (PDT) Received: from [192.168.1.10] (ip70-171-116-89.no.no.cox.net. [70.171.116.89]) by smtp.googlemail.com with ESMTPSA id a25sm6778623otp.54.2019.05.01.21.01.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 May 2019 21:01:23 -0700 (PDT) Subject: Re: Starting Postgres when there is no disk space To: pgsql-general@lists.postgresql.org References: From: Ron Message-ID: <252b7664-c5b0-a898-f278-7a10f016a846@gmail.com> Date: Wed, 1 May 2019 23:01:22 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------CC3050FF72151B20CD57BDAD" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------CC3050FF72151B20CD57BDAD Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit To get the cluster up and running, you only need to move a GB or two. On 5/1/19 9:24 PM, Igal Sapir wrote: > Thank you both.  The symlink sounds like a very good idea. My other disk > is 100GB and the database is already 130GB so moving the whole thing will > require provisioning that will take more time.  I will try the symlinks > first.  Possibly moving some tables to a tablespace on the other partition > to make more room. > > I have a scheduled process that runs daily to delete old data and do full > vacuum.  Not sure why this happened (again). > > Thanks, > > Igal > > On Wed, May 1, 2019 at 6:02 PM Michael Loftis > wrote: > > Best option....Copy/move the entire  pgdata to a larger space. It may > also be enough to just move the WAL (leaving a symlink) freeing up the > 623M but I doubt it since VACUUM FULL occurs in the same table space > and can need an equal amount of space (130G) depending on how much it > can actually free up. > > You may also get away with just moving (and leaving a symlink) for the > base but I don't recall if that works or not. > > On Wed, May 1, 2019 at 18:07 Igal Sapir > wrote: > > I have Postgres running in a Docker container with PGDATA mounted > from the host. Postgres consume all of the disk space, 130GB [1], > and can not be started [2].  The database has a lot of bloat due > to much many deletions.  The problem is that now I can not start > Postgres at all. > > I mounted an additional partition with 100GB, hoping to fix the > bloat with a TABLESPACE in the new mount, but how can I do > anything if Postgres will not start in the first place? > > I expected there to be a tool that can defrag the database files, > e.g. a "vacuumdb" utility that can run without Postgres.  Or maybe > run Postgres and disable the WAL so that no new disk space will be > required. > > Surely, I'm not the first one to experience this issue.  How can I > fix this? > > Thank you, > > Igal > > [1] > root@ff818ff7550a:/# du -h --max-depth=1 /pgdata > 625M    /pgdata/pg_wal > 608K    /pgdata/global > 0       /pgdata/pg_commit_ts > 0       /pgdata/pg_dynshmem > 8.0K    /pgdata/pg_notify > 0       /pgdata/pg_serial > 0       /pgdata/pg_snapshots > 16K     /pgdata/pg_subtrans > 0       /pgdata/pg_twophase > 16K     /pgdata/pg_multixact > 130G    /pgdata/base > 0       /pgdata/pg_replslot > 0       /pgdata/pg_tblspc > 0       /pgdata/pg_stat > 0       /pgdata/pg_stat_tmp > 7.9M    /pgdata/pg_xact > 4.0K    /pgdata/pg_logical > 0       /pgdata/tmp > 130G    /pgdata > > [2] > postgres@1efd26b999ca:/$ /usr/lib/postgresql/11/bin/pg_ctl start > waiting for server to start....2019-05-01 20:43:59.301 UTC [34] > LOG:  listening on IPv4 address "0.0.0.0", port 5432 > 2019-05-01 20:43:59.301 UTC [34] LOG: listening on IPv6 address > "::", port 5432 > 2019-05-01 20:43:59.303 UTC [34] LOG: listening on Unix socket > "/var/run/postgresql/.s.PGSQL.5432" > 2019-05-01 20:43:59.322 UTC [35] LOG: database system shutdown was > interrupted; last known up at 2019-05-01 19:37:32 UTC > 2019-05-01 20:43:59.863 UTC [35] LOG: database system was not > properly shut down; automatic recovery in progress > 2019-05-01 20:43:59.865 UTC [35] LOG:  redo starts at 144/4EFFFC18 > ...2019-05-01 20:44:02.389 UTC [35] LOG: redo done at 144/74FFE060 > 2019-05-01 20:44:02.389 UTC [35] LOG:  last completed transaction > was at log time 2019-04-28 05:05:24.687581+00 > .2019-05-01 20:44:03.474 UTC [35] PANIC: could not write to file > "pg_logical/replorigin_checkpoint.tmp": No space left on device > 2019-05-01 20:44:03.480 UTC [34] LOG: startup process (PID 35) was > terminated by signal 6: Aborted > 2019-05-01 20:44:03.480 UTC [34] LOG: aborting startup due to > startup process failure > 2019-05-01 20:44:03.493 UTC [34] LOG: database system is shut down >  stopped waiting > pg_ctl: could not start server > Examine the log output. > > > > > > > > > > > > -- > > "Genius might be described as a supreme capacity for getting its > possessors > into trouble of all kinds." > -- Samuel Butler > -- Angular momentum makes the world go 'round. --------------CC3050FF72151B20CD57BDAD Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit To get the cluster up and running, you only need to move a GB or two.

On 5/1/19 9:24 PM, Igal Sapir wrote:
Thank you both.  The symlink sounds like a very good idea.  My other disk is 100GB and the database is already 130GB so moving the whole thing will require provisioning that will take more time.  I will try the symlinks first.  Possibly moving some tables to a tablespace on the other partition to make more room.

I have a scheduled process that runs daily to delete old data and do full vacuum.  Not sure why this happened (again).

Thanks,

Igal

On Wed, May 1, 2019 at 6:02 PM Michael Loftis <mloftis@wgops.com> wrote:
Best option....Copy/move the entire  pgdata to a larger space. It may also be enough to just move the WAL (leaving a symlink) freeing up the 623M but I doubt it since VACUUM FULL occurs in the same table space and can need an equal amount of space (130G) depending on how much it can actually free up.

You may also get away with just moving (and leaving a symlink) for the base but I don't recall if that works or not.

On Wed, May 1, 2019 at 18:07 Igal Sapir <igal@lucee.org> wrote:
I have Postgres running in a Docker container with PGDATA mounted from the host.  Postgres consume all of the disk space, 130GB [1], and can not be started [2].  The database has a lot of bloat due to much many deletions.  The problem is that now I can not start Postgres at all.

I mounted an additional partition with 100GB, hoping to fix the bloat with a TABLESPACE in the new mount, but how can I do anything if Postgres will not start in the first place?

I expected there to be a tool that can defrag the database files, e.g. a "vacuumdb" utility that can run without Postgres.  Or maybe run Postgres and disable the WAL so that no new disk space will be required.

Surely, I'm not the first one to experience this issue.  How can I fix this?

Thank you,

Igal

[1]
root@ff818ff7550a:/# du -h --max-depth=1 /pgdata
625M    /pgdata/pg_wal
608K    /pgdata/global
0       /pgdata/pg_commit_ts
0       /pgdata/pg_dynshmem
8.0K    /pgdata/pg_notify
0       /pgdata/pg_serial
0       /pgdata/pg_snapshots
16K     /pgdata/pg_subtrans
0       /pgdata/pg_twophase
16K     /pgdata/pg_multixact
130G    /pgdata/base
0       /pgdata/pg_replslot
0       /pgdata/pg_tblspc
0       /pgdata/pg_stat
0       /pgdata/pg_stat_tmp
7.9M    /pgdata/pg_xact
4.0K    /pgdata/pg_logical
0       /pgdata/tmp
130G    /pgdata

[2]
postgres@1efd26b999ca:/$ /usr/lib/postgresql/11/bin/pg_ctl start
waiting for server to start....2019-05-01 20:43:59.301 UTC [34] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-05-01 20:43:59.301 UTC [34] LOG:  listening on IPv6 address "::", port 5432
2019-05-01 20:43:59.303 UTC [34] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2019-05-01 20:43:59.322 UTC [35] LOG:  database system shutdown was interrupted; last known up at 2019-05-01 19:37:32 UTC
2019-05-01 20:43:59.863 UTC [35] LOG:  database system was not properly shut down; automatic recovery in progress
2019-05-01 20:43:59.865 UTC [35] LOG:  redo starts at 144/4EFFFC18
...2019-05-01 20:44:02.389 UTC [35] LOG:  redo done at 144/74FFE060
2019-05-01 20:44:02.389 UTC [35] LOG:  last completed transaction was at log time 2019-04-28 05:05:24.687581+00
.2019-05-01 20:44:03.474 UTC [35] PANIC:  could not write to file "pg_logical/replorigin_checkpoint.tmp": No space left on device
2019-05-01 20:44:03.480 UTC [34] LOG:  startup process (PID 35) was terminated by signal 6: Aborted
2019-05-01 20:44:03.480 UTC [34] LOG:  aborting startup due to startup process failure
2019-05-01 20:44:03.493 UTC [34] LOG:  database system is shut down
 stopped waiting
pg_ctl: could not start server
Examine the log output.












--

"Genius might be described as a supreme capacity for getting its possessors
into trouble of all kinds."
-- Samuel Butler

--
Angular momentum makes the world go 'round.
--------------CC3050FF72151B20CD57BDAD--