Re: [GENERAL] Using cp to back up a database? - Mailing list pgsql-general

From Stephen Frost
Subject Re: [GENERAL] Using cp to back up a database?
Date
Msg-id 20171010130848.GU4628@tamriel.snowman.net
Whole thread Raw
In response to Re: [GENERAL] Using cp to back up a database?  (Ron Johnson <ron.l.johnson@cox.net>)
List pgsql-general
Ron,

* Ron Johnson (ron.l.johnson@cox.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

pgsql-general by date:

Previous
From: Olivani Prisila
Date:
Subject: [GENERAL] [asking about how to upgrade docker postgresql without losing the data]
Next
From: Stephen Frost
Date:
Subject: Re: [GENERAL] pg_start/stop_backup naming conventions