[CentOS] LVM and Backups

Tue Sep 18 06:38:59 UTC 2018
Alessandro Baggi <alessandro.baggi at gmail.com>

Il 17/09/2018 22:12, Gordon Messmer ha scritto:
> On 9/17/18 7:50 AM, Alessandro Baggi wrote:
>> Running a backup I follow this steps:
>> 1) Stop httpd
>> 2) Create lvm snapshot on the dataset
>> 3) Backup database
>> 4) restart httpd (to avoid more downtime)
>> 5) mount the snapshot and execute backup
>> 6) umount and remove the snapshot
>> I think that this could be fine (if not please correct me)
> 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?

> Your sequence makes changes (step 3) after the snapshot is taken.  In 
> that case, the backup that you made will not be a part of the snapshot. 
> It also prolongs the time that httpd is down unnecessarily.
>> Now when bacula performs the backup what happen if bacula are copying 
>> a specifed file and this specified file is modified?
> If bacula is backing up the content of the snapshot, then changes made 
> in the running services won't affect it.  That's the purpose of the 
> snapshot: it's static.
> 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.