Re: Using cp to back up a database?

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Using cp to back up a database?
Date: 2017-10-10 13:08:48
Message-ID: 20171010130848.GU4628@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ron,

* Ron Johnson (ron(dot)l(dot)johnson(at)cox(dot)net) wrote:
> Maybe my original question wasn't clear, so I'll try again: is it
> safe to do a physical using cp (as opposed to rsync)?

Frankly, I'd say no. There's nothing to guarantee that the backup is
actually sync'd out to disk. Further, you're probably in the same boat
when it comes to WAL archiving (just using 'cp' there isn't good for the
same reason), though that's arguably worse because once you return true
from archive_command, that WAL file will be gone and you could end up
with a hole in your WAL stream.

Next, this backup method has been deprecated because of issues with the
backup_label file and what happens when the system crashes during a
backup.

So, no, you shouldn't be just using 'cp', or 'rsync', or any of those
similar, simple, tools for doing a proper PG backup. Use a tool which
has been developed specifically for PG such as pgBackRest, barman,
WAL-E, WAL-G, etc.

Thanks!

Stephen

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Frost 2017-10-10 13:12:17 Re: pg_start/stop_backup naming conventions
Previous Message Olivani Prisila 2017-10-10 11:25:15 [asking about how to upgrade docker postgresql without losing the data]