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 1now6Y-0000Vr-3r for pgsql-general@arkaria.postgresql.org; Wed, 11 May 2022 23:50:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1now6W-0007TV-UV for pgsql-general@arkaria.postgresql.org; Wed, 11 May 2022 23:50:52 +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 1now6W-0007Sk-GM for pgsql-general@lists.postgresql.org; Wed, 11 May 2022 23:50:52 +0000 Received: from mail-oa1-x2d.google.com ([2001:4860:4864:20::2d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1now6R-0000rk-Ji for pgsql-general@lists.postgresql.org; Wed, 11 May 2022 23:50:52 +0000 Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-ed9a75c453so4744724fac.11 for ; Wed, 11 May 2022 16:50:47 -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=Se3hLwzXQbZkiCji9TwdM8r7x4IkfPgat7qUxdOJyUQ=; b=Cb+9Ix9u+uhGDvghvC+2ybjwHX7AMTWTNWqg8LemKA67/b7WU1kn7yFNPR4fesSscJ mgV9k03Qpg1jBXCZUUeUWA5xqUmuttQ4BZ4SBbctE524lXNQOI95EBd3d+Vj1OFwZNkc H6tmC/KKxqjHtstLDsuqjXPfDF5t/aFUzFUSQRlbGmdOi3EYGyd93iGhaiqP5UmUH/9U Ws54+GWujjQmLb1JiD9ul8Qo7rMvyPa0tKsh8F0+tNOF7082CV/t6Wy1r32m3PMj6xIq CPvk5ikAjqGsMxZa4vESivu3hWLOdL4Ke5OgldcXB5WRweH0VrON4hfq4EQfcdoB2CHP NHYw== 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=Se3hLwzXQbZkiCji9TwdM8r7x4IkfPgat7qUxdOJyUQ=; b=TNqmE6so5y+/muxeaXB62X8lI0Z1ANYXasczG3iFD/MJvJPNaFIYv0cpNi4HR0mkAM p3u5c4iZhOIyYEceAFsncWZtnWHvAtHCoY2vwXTuG9df8KDSfd5vzSYSlGMxqfbxkisA AHKuSjXkjEXtN/a5WUstKu8BI9ygG1tnsse3wkNo/SU24faAQALncWh10sRTS5IXlUAG qXoy4oEPdfc6HiSN/kOCkg93tT2+K/M3sDh2pHMyv3t93lAX1y1eCBLvaNwhMT1b4bTz 9dd/LvWCZjklS6NFGbOJPtOI43dByKcW/qLI5yfAEAHIZ7Ap2UPfnDVtcBD55qGgNdt8 4Mmg== X-Gm-Message-State: AOAM533S0Y2AYpZ5xUPofvPUGClOy2X/O94+AbmzUzAvwLlSS7Z6NSlJ EYfeSOYcu6IxSMb9vCKyyQrO99uCXUk= X-Google-Smtp-Source: ABdhPJxhmMMleyTCQcdP7pQ0XtPfNwOb15i++iDyZPMMhElfqSC8VbKEtLuGmjRzRYnu2kQraaqf2A== X-Received: by 2002:a05:6870:80cb:b0:ed:aaeb:27e0 with SMTP id r11-20020a05687080cb00b000edaaeb27e0mr4464296oab.187.1652313045116; Wed, 11 May 2022 16:50:45 -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 z2-20020a056808028200b00325cda1ff8dsm1253563oic.12.2022.05.11.16.50.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 May 2022 16:50:44 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------8PWdYdYg2QMUr9IEpVBt377L" Message-ID: <1ba59e2c-b0ae-387f-1272-cdbeefe7bd67@gmail.com> Date: Wed, 11 May 2022 18:50:43 -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: consistent postgresql snapshot Content-Language: en-US To: pgsql-general@lists.postgresql.org References: <49bb084a06194e51a2d58421e5f074f6@zuerich.ch> From: Ron In-Reply-To: <49bb084a06194e51a2d58421e5f074f6@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. --------------8PWdYdYg2QMUr9IEpVBt377L Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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. --------------8PWdYdYg2QMUr9IEpVBt377L Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.
--------------8PWdYdYg2QMUr9IEpVBt377L--