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 1npMec-00015Z-2q for pgsql-general@arkaria.postgresql.org; Fri, 13 May 2022 04:11:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1npMea-0006ov-UZ for pgsql-general@arkaria.postgresql.org; Fri, 13 May 2022 04:11:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1npMea-0006ol-Hy for pgsql-general@lists.postgresql.org; Fri, 13 May 2022 04:11:48 +0000 Received: from mail-oa1-x2c.google.com ([2001:4860:4864:20::2c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1npMeU-0003Dd-EW for pgsql-general@lists.postgresql.org; Fri, 13 May 2022 04:11:48 +0000 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-deb9295679so9160568fac.6 for ; Thu, 12 May 2022 21:11:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to; bh=iehSfHQ2naKZZtvUnhd+gO5d375CacJ1Lt1kXxBQUU8=; b=mX9nw/jfrZQlpgj1t1V7yYHGZjf+ZFqotZJnq1RvxdBROO7maudt54UN2H7hydsKBp nOYfOf8PhdKGTTlQGXsC6EUMLBls8cmy7HvpWjuaCZSibTfdVF34waaQjQVTQYD1lteU G9Dan5MsSsppAmhyXuNr6wrp5Cspd07MKZfQ2/1PyjuUaQGcQEkBcfYdcTBNp9Lq0GFn 74lfk/D842XA9JhOtPkodT/u//vq3rAMC+WH5gNMIE9XaIO4Ba90w8o8H20702jbVF+V i0nxk3QEGhX7+1edA/8dCHLWK3XjsHrisvZemCYj8egBzrqbRLRYYIGzQfSdhTafIMvC z27g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to; bh=iehSfHQ2naKZZtvUnhd+gO5d375CacJ1Lt1kXxBQUU8=; b=Y/o4TlQUHCXzBXQTgljTtxnIOJAIHuaZvXL1dDXDLEBv35D8+s8hG4VjEQ7A9CEVEK 5zQlz7IWc8OMNYODB353CgmPDarMxkJaoZj3OY4uIe8xuPDmxPhJb03mxXh+1B1NtMzP fVwLo65zPIbRZtcAFOcK09K1BU5UtrE86UPSwBNvQVaZ73TBVNoaZvmiwCPA/sLshAlR 24hX5V3o5ayjtfsv235595r9hKcPLjbWNU1llN0Om+y7tSXIRHxhQhgcoGQcUH9IU7pp mHeHz7lSv3lsq4QFB/GRQ2y2Nh4VtqyyU2eYxHhH7Y4r12SNCqpkXjqnTOyDU2Dw7hK1 QkVg== X-Gm-Message-State: AOAM532VUe/BONt6aJ3oKB5A/OVehLxQ5s6bsYlEwEyxSGsuGzYEbrAS xu82afFLUPr0swhriLbqNbSPdQ+8tY8= X-Google-Smtp-Source: ABdhPJyfcDiGxN4TaKqlwVzln0prixhJpJ4ZnGExhW6LtlmK56z7m3ZDcO+Xx3iw06PjpOiyUNIn+Q== X-Received: by 2002:a05:6870:a10f:b0:ee:3cf3:63e8 with SMTP id m15-20020a056870a10f00b000ee3cf363e8mr1634032oae.293.1652415099957; Thu, 12 May 2022 21:11:39 -0700 (PDT) Received: from [192.168.88.10] (ip68-11-68-85.no.no.cox.net. [68.11.68.85]) by smtp.googlemail.com with ESMTPSA id b3-20020a056808010300b003264a325ecdsm633396oie.5.2022.05.12.21.11.39 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 May 2022 21:11:39 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------NHOkslZ0vb4Q2amVQ1IVvNvO" Message-ID: <90314421-3f3e-a40c-b2c1-1fe307ece86b@gmail.com> Date: Thu, 12 May 2022 23:11:38 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: AW: [Extern] Re: consistent postgresql snapshot Content-Language: en-US To: "pgsql-general@lists.postgresql.org" References: <49bb084a06194e51a2d58421e5f074f6@zuerich.ch> <1ba59e2c-b0ae-387f-1272-cdbeefe7bd67@gmail.com> <0c12435782ab4e3e8cc0366a44e35c84@zuerich.ch> From: Ron In-Reply-To: <0c12435782ab4e3e8cc0366a44e35c84@zuerich.ch> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------NHOkslZ0vb4Q2amVQ1IVvNvO Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Whether or not you want to use the "normal backup algorithm" is irrelevant, since if you try and start that snapshot Postgresql /*will*/ see the instance as /*needing*/ to be recovered. Having said that... our storage team does SAN snapshots of the *single LUN* where */all/**of the Postgres* files (regardless of mountpoint) reside on "my" Postgresql server.  When needed, the Linux guys restored the relevant snapshot to a new server, changed the host name and IP address and Postgres started right up, recovering just as if there had been a system crash. On 5/12/22 04:10, Zwettler Markus (OIZ) wrote: > Email Signature > > I don't want to do use the normal backup algorithm where pg_start_backup + > pg_stop_backup will fix any fractured block and I am required to have all > archived logfiles, therefore. > > I want to produce an atomic consistent disk snapshot. > > I am not sure if freeze/unfreeze will be enough with default values (8k db > blocksize vs. 4k fs blocksize). > > I am quite sure it should be safe when I also change the fs blocksize to > 8k because 1 IO = 1 db block = 1 fs block than. > > Any thoughts? > > *Von:*Ron > *Gesendet:* Donnerstag, 12. Mai 2022 01:51 > *An:* pgsql-general@lists.postgresql.org > *Betreff:* [Extern] Re: consistent postgresql snapshot > > On 5/11/22 10:41, Zwettler Markus (OIZ) wrote: > > PostgreSQL12 running on CentOS7 + ext4. > > Would it be save to do a "fsfreeze –freeze" + disk snapshot + > "fsfreeze –unfreeze" of the PGDATA filesystem to get a consistent > snapshot? > > I am wondering as PostgreSQL default blocksize = 8k while ext4 default > blocksize = 4k, resulting in 2 fs blocks per db block. > > > If data/base and pg_xlog are on the same filesystem, then it might work. > > Be sure to select pg_start_backup('something informative');beforehand, and > select pg_stop_backup();afterwards. > > For example: > psql -c "select pg_start_backup('something informative');" > fsfreeze –freeze > /disk snapshot/ > fsfreeze –unfreeze > psql -c "select pg_stop_backup();" > > -- > Angular momentum makes the world go 'round. > > > Achtung: Diese E-Mail wurde von einer externen Adresse verschickt. Klicken > Sie auf keine Links und öffnen Sie keine angehängten Dateien, wenn Sie den > Absender bzw. die Absenderin nicht kennen. Sind Sie sich unsicher, > kontaktieren Sie den Service Desk der Stadt Zürich. > -- Angular momentum makes the world go 'round. --------------NHOkslZ0vb4Q2amVQ1IVvNvO Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit Whether or not you want to use the "normal backup algorithm" is irrelevant, since if you try and start that snapshot Postgresql will see the instance as needing to be recovered.

Having said that... our storage team does SAN snapshots of the single LUN where all of the Postgres files (regardless of mountpoint) reside on "my" Postgresql server.  When needed, the Linux guys restored the relevant snapshot to a new server, changed the host name and IP address and Postgres started right up, recovering just as if there had been a system crash.


On 5/12/22 04:10, Zwettler Markus (OIZ) wrote:
Email Signature

I don't want to do use the normal backup algorithm where pg_start_backup + pg_stop_backup will fix any fractured block and I am required to have all archived logfiles, therefore.

 

I want to produce an atomic consistent disk snapshot.

 

I am not sure if freeze/unfreeze will be enough with default values (8k db blocksize vs. 4k fs blocksize).

 

I am quite sure it should be safe when I also change the fs blocksize to 8k because 1 IO = 1 db block = 1 fs block than.

 

Any thoughts?

 

 

 

Von: Ron <ronljohnsonjr@gmail.com>
Gesendet: Donnerstag, 12. Mai 2022 01:51
An: pgsql-general@lists.postgresql.org
Betreff: [Extern] Re: consistent postgresql snapshot

 

On 5/11/22 10:41, Zwettler Markus (OIZ) wrote:

PostgreSQL12 running on CentOS7 + ext4.

 

Would it be save to do a "fsfreeze –freeze" + disk snapshot + "fsfreeze –unfreeze" of the PGDATA filesystem to get a consistent snapshot?

 

I am wondering as PostgreSQL default blocksize = 8k while ext4 default blocksize = 4k, resulting in 2 fs blocks per db block.


If data/base and pg_xlog are on the same filesystem, then it might work.

Be sure to
select pg_start_backup('something informative'); beforehand, and select pg_stop_backup(); afterwards.

For example:
psql -c "select pg_start_backup('something informative');"
fsfreeze –freeze
disk snapshot
fsfreeze –unfreeze
psql -c "select pg_stop_backup();"

--
Angular momentum makes the world go 'round.


Achtung: Diese E-Mail wurde von einer externen Adresse verschickt. Klicken Sie auf keine Links und öffnen Sie keine angehängten Dateien, wenn Sie den Absender bzw. die Absenderin nicht kennen. Sind Sie sich unsicher, kontaktieren Sie den Service Desk der Stadt Zürich.


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