There is a Postgres database on BTRFS. I need to make a backup of the database while it is running. Should I do btrfs filesystem sync before the snapshot or btrfs subvolume snapshot does it for me automatically?
Asked
Active
Viewed 201 times
0
Jonas
- 347
- 2
- 10
-
what speaks against a mysql dump? – djdomi Mar 17 '23 at 19:53
-
@djdomi It being postgresql? – vidarlo Mar 17 '23 at 20:54
-
The database identifies itself as PostgreSQL, there is little I can do. – Jonas Mar 18 '23 at 05:20
-
Don't forget to properly prepare the database before creating a snapshot: https://dba.stackexchange.com/questions/319538/postgresql-backup-with-zfs-snapshots-is-pg-start-backup-pg-stop-backup-nece – Ingo Blechschmidt Jan 23 '24 at 14:50
1 Answers
2
From the btrfs-subvolume man page:
Subvolume creation needs to flush dirty data that belong to the subvolume
So yes, btrfs subvolume snapshot will take care of it for you if we stick to your question.
Given that you're attempting to backup a PostgreSQL database, depending on the scenario you might also be interested in the pg_dump utility instead or PostgreSQL WAL-shipping if you need point-in-time recovery.
Ginnungagap
- 2,694
-
I am moving away from pg_dump as it takes too long to restore a large database. – Jonas Mar 18 '23 at 08:12