On 9/17/18 11:38 PM, Alessandro Baggi wrote:
Il 17/09/2018 22:12, Gordon Messmer ha scritto:
That doesn't look right. It should look more like 1) stop or freeze all of the services (httpd and database), 2) make the snapshot, 3) start or thaw all of the services, 4) mount the snapshot, 5) back up the data, 6) remove the snapshot.
About database setup I perform backups via pg_dump so how the snapshot affects pgsql database? What your suggestion I must perform database backup copying only filesystem file and not pgsql.sql database dump?
If you want a plain-text dump of the DB, you can do that before the LVM snapshot sequence: 1) pg_dump, 2) stop or freeze all of the services (httpd and database), 3) make the snapshot, 4) start or thaw all of the services, 5) mount the snapshot, 6) back up the data, 7) remove the snapshot.
Typically, the reason you want to use snapshots for the backup is that you don't need to do pg_dump to get a consistent DB backup, though. pg_dump style backups are extremely slow to restore. If you freeze the DB, make a snapshot, and thaw, you can make a safe, consistent backup of the DB files directly, and restore in minimal time.
Are you using bacula's built-in snapshot support, or are you rolling your own?
No I'm using pre/post job script where I have lvm commands to create and destroy snapshot volume.
I really recommend using a ready-made process rather than rolling your own. Bacula has snapshot support. Alternately, my project can manage snapshots and handle freezing / thawing PostgreSQL services. I think it's a better option than Bacula's, but either is better than reinventing this wheel.