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.92) (envelope-from ) id 1jGRIS-0003Bx-JG for pgsql-general@arkaria.postgresql.org; Mon, 23 Mar 2020 17:55:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jGRIR-0002GC-F9 for pgsql-general@arkaria.postgresql.org; Mon, 23 Mar 2020 17:55:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jGRIR-0002Dz-2J for pgsql-general@lists.postgresql.org; Mon, 23 Mar 2020 17:55:31 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jGRIN-0003IY-QN for pgsql-general@lists.postgresql.org; Mon, 23 Mar 2020 17:55:29 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 1E3535F799; Mon, 23 Mar 2020 13:55:30 -0400 (EDT) Date: Mon, 23 Mar 2020 13:55:30 -0400 From: Stephen Frost To: Dennis Jacobfeuerborn Cc: pgsql-general@lists.postgresql.org Subject: Re: How does pg_basebackup manage to create a snapshot of the filesystem? Message-ID: <20200323175529.GK13712@tamriel.snowman.net> References: <0cff1bac-7ed2-df11-2d28-9bdd7b102dea@conversis.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fUjYDmxMtFc8vtOf" Content-Disposition: inline In-Reply-To: <0cff1bac-7ed2-df11-2d28-9bdd7b102dea@conversis.de> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --fUjYDmxMtFc8vtOf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Greetings, * Dennis Jacobfeuerborn (dennisml@conversis.de) wrote: > I'm currently trying to understand how backups work. In the > documentation in section "25.2. File System Level Backup" it says that > filesystem level backups can only be made when the database if offline > yet pg_basebackup seems to do just that but works while the database is > online. Am I misunderstanding something here or does pg_basebackup use > some particular features of Postgres to accomplish this? A simple tar-based backup as discussed in 25.2 can only be done with the database off-line, but if you're wondering what pg_basebackup is doing under the covers then you should be reading through 25.3, which talks about the PostgreSQL WAL, how a backup can be taken in an online manner provided you retain the WAL that was created during the backup, how to restore a backup taken in that manner, etc. All that said, I don't recommend rolling your own backup solution for PG. There's a number of good ones out there, starting with pg_basebackup if you really just need something simple. Thanks, Stephen --fUjYDmxMtFc8vtOf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJeePgRAAoJEO1sijiDR2RV4U8QAI/TPk5BGZOeeVyhqhXssGL/ DuEvcjUiGwriYMsE/R20ccIoC4AvXjy4Y9eBrWtYidrpW3+fE9YpCO1kB5wjwf0m /AwDEtVOcnk53Vo0LqdDL652uqX7rlLqDaVy7TF6/SohfYA4MpGh5aJggPLH5Ing Pe47kYitauqOftO+jJP87gxtE7FfOmDTStIiKpz1RfzLvjuzTyjIEwUwNbeOaybM CvZkFpfKqDyDnYkU9EiPvXez+yc/5KI+Ib/JIQQf0Tk6ZNjvrxIQrMerBfoG8DTs GZmhXe1Dl6prUtiXxvFB6+4VP0e6hoCUfoDPmC63+ZR6KFiBU8EAhwRuVQjF/SuG rI6kmA+dHVNWyqvoL/B/ezFJWSpI+xAOvYgzf1+kUTPn6N+IKgA6A5UoLw6UhTx1 h6iyaYjam3LiTdVTRsEN7/MRnS74kB/SyZQJTlGWl73yGNFXT5aZ6JWRzBNVbN3F AIF+bG/EOF53anwxiRsG/8w2QhwBWZRV8UwPkOE8pav/QxPk5B9wpRt+93ma5kQg mcS/oy3YYcIGmKVohEZCRy2gawyCyIlBnM+v7WvP62c313Z3UTT4qm2clhxnlwuX 1WW0DsA8SKqhqb1CiJZyNXnnJ4fhkjAi4Dkvje6P/IiAYFcaRH4cjP7vc7KEA9eL 6JXk+bYCsZbdAHhISVUI =LKaK -----END PGP SIGNATURE----- --fUjYDmxMtFc8vtOf--