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 1meUt9-0007IP-JJ for pgsql-general@arkaria.postgresql.org; Sun, 24 Oct 2021 04:13:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1meUt7-0008Mw-4s for pgsql-general@arkaria.postgresql.org; Sun, 24 Oct 2021 04:13:37 +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 1meUt6-0008Mm-O7 for pgsql-general@lists.postgresql.org; Sun, 24 Oct 2021 04:13:36 +0000 Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1meUt3-00027z-7M for pgsql-general@lists.postgresql.org; Sun, 24 Oct 2021 04:13:36 +0000 Received: by mail-qk1-x736.google.com with SMTP id h65so8866274qke.0 for ; Sat, 23 Oct 2021 21:13:32 -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 :cc:references:from:in-reply-to; bh=nBxHs4WTRUUiwnZjL8kP3rgwdAka4/qHCqdOseDJi7c=; b=V2ra9T546BiOwfxIYqBCH6AKLNFtEXVJRcRd3tqUEoJZqqCXDXwdLA8SPUxlIBao2D t5Nh2fBT7fW+gzSDVUx5P3MPpB51Am+1C2GALDIWtCbAYKrkNWjX5jaQN7FANpDRZdTc u9wdPiAVyv7cCtG/x5i4jBZXFdWGvg4FL+Rf16SKhtM9AVVlnsSJjsnkyLxCId/9Iq9x pVf2lNyPk11X5EVUH7Fe8DSMd/DwNYbO6guOeIzG4/fKOGg0dvX9Mcu/28+vv2lgOAm1 mFK/ey6qIOXJ+0GQkyKtkCTDE/rrkE1Bax3k11QTKORxQy+IVMH1GJUaYMpR9Ovy3O2d O+iQ== 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:cc:references:from:in-reply-to; bh=nBxHs4WTRUUiwnZjL8kP3rgwdAka4/qHCqdOseDJi7c=; b=vQp1ARIjajynbl/tss4PBWQaUtfv+0PhFlJbvbMFe8e3IwNeKmcG8y+Nq+DUpt2dLd k3gCYyMmOsYrwWs1l78tXwJbBAHyRSRV0sa2t1Kk70cPI9FcOoKPJFkH9E1DhCZrFEdu yTFq5ZyZXpR14xi1NeGuhyOy+5q2cb8Gda56qC+ZZfAlZ01GK8dwdPPRrj+XWyzt0Jw4 Ns1+VdY0Y+DLyFIaOklAvDrOATy5GDdN3BUrQyQaxZlOm/g2Rc0Bbiu0fPC9W2puPHg7 XP3MsFbTTO7Vi9m18EEwoAzOXvd431IWotS72FkeSbp90J/OupnDxRl2L0eENZ76syI4 aT2A== X-Gm-Message-State: AOAM533Vokzo2p6WhbGaEQiWGBvxy9s6gC8vepoQF4RR3dNkyn1WRhE8 M1k8OfYZdQyyHLn41+HYRAo= X-Google-Smtp-Source: ABdhPJzoL7NRzm68HXxXZMrFgA8pVvuXZXmyDBZVt2fIlEBI6zWpUd91CaDAvdWVB5J6vM2WxyTIEA== X-Received: by 2002:a05:620a:400d:: with SMTP id h13mr7574325qko.238.1635048810928; Sat, 23 Oct 2021 21:13:30 -0700 (PDT) Received: from [192.168.2.100] (pool-72-79-19-93.nwrknj.east.verizon.net. [72.79.19.93]) by smtp.gmail.com with ESMTPSA id bm25sm7255188qkb.4.2021.10.23.21.13.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 23 Oct 2021 21:13:30 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------Dz0EalCZ0PIJyKObYpQ31Jau" Message-ID: <77b0fb54-64f5-833d-19ba-2c731af1f700@gmail.com> Date: Sun, 24 Oct 2021 00:13:29 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: ZFS filesystem - supported ? Content-Language: en-US To: Lucas Cc: pgsql-general@lists.postgresql.org References: <49ijds_99IK_4iDOHuZH8CJsKGZw7DEVtJPf0s_oPEvUKwFewHcDQFCUnutcA9GYIkOrRfFAKRsyj0ZFN9ECAbLm-NYPR8jMxTl-RU-U3hA=@protonmail.ch> <1e0db1d2-6a9e-f5f7-44af-e7a1997bafcf@gmail.com> <917520e4-0023-2842-db5f-2e1cbd72b004@gmail.com> <741d4f14b64a45d7a9670042ac8ecf66@sud0.nz> From: Mladen Gogala In-Reply-To: <741d4f14b64a45d7a9670042ac8ecf66@sud0.nz> 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. --------------Dz0EalCZ0PIJyKObYpQ31Jau Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 10/23/21 23:12, Lucas wrote: > I don't know where you have your database deployed, but in my case is > in AWS EC2 instances. The way I handle backups is at the block storage > level, performing EBS snapshots. Yes, Amazon uses SAN equipment that supports snapshots. > This has proven to work very well for me. I had to restore a few > backups already and it always worked. The bad part is that I need to > stop the database before performing the Snapshot, for data integrity, > so that means that I have a hot-standby server only for these snapshots. > Lucas Actually, you don't need to stop the database. You need to execute pg_start_backup() before taking a snapshot and then pg_stop_backup() when the snapshot is done. You will need to recover the database when you finish the restore but you will not lose any data. I know that pg_begin_backup() and pg_stop_backup() are deprecated but since PostgreSQL doesn't have any API for storage or file system snapshots, that's the only thing that can help you use storage snapshots as backups. To my knowledge,the only database that does have API for storage snapshots is DB2. The API is called "Advanced Copy Services" or ACS. It's documented here: https://www.ibm.com/docs/en/db2/11.1?topic=recovery-db2-advanced-copy-services-acs For Postgres, the old begin/stop backup functions should be sufficient. -- Mladen Gogala Database Consultant Tel: (347) 321-1217 https://dbwhisperer.wordpress.com --------------Dz0EalCZ0PIJyKObYpQ31Jau Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 10/23/21 23:12, Lucas wrote:
 
I don't know where you have your database deployed, but in my case is in AWS EC2 instances. The way I handle backups is at the block storage level, performing EBS snapshots.

Yes, Amazon uses SAN equipment that supports snapshots.


 
This has proven to work very well for me. I had to restore a few backups already and it always worked. The bad part is that I need to stop the database before performing the Snapshot, for data integrity, so that means that I have a hot-standby server only for these snapshots.
 
Lucas

Actually, you don't need to stop the database. You need to execute pg_start_backup() before taking a snapshot and then pg_stop_backup() when the snapshot is done. You will need to recover the database when you finish the restore but you will not lose any data. I know that pg_begin_backup() and pg_stop_backup() are deprecated but since PostgreSQL doesn't have any API for storage or file system snapshots, that's the only thing that can help you use storage snapshots as backups. To my knowledge,the only database that does have API for storage snapshots is DB2. The API is called "Advanced Copy Services" or ACS. It's documented here:

https://www.ibm.com/docs/en/db2/11.1?topic=recovery-db2-advanced-copy-services-acs

For Postgres, the old begin/stop backup functions should be sufficient.


-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com
--------------Dz0EalCZ0PIJyKObYpQ31Jau--