From 596412cb8fea98f8414ffae3a2bfa5fadd798c12 Mon Sep 17 00:00:00 2001
From: Matthew Momjian <50788000+mmomjian@users.noreply.github.com>
Date: Fri, 14 Jun 2024 08:59:33 -0400
Subject: [PATCH] docs: brief instructions to recover from corruption (#10319)

* brief instructions for corruption

* Update FAQ.mdx
---
 docs/docs/FAQ.mdx | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/docs/docs/FAQ.mdx b/docs/docs/FAQ.mdx
index d5d241753c..61e17b70d3 100644
--- a/docs/docs/FAQ.mdx
+++ b/docs/docs/FAQ.mdx
@@ -408,4 +408,11 @@ docker exec -it immich_postgres psql --dbname=immich --username=<DB_USERNAME> --
 
 </details>
 
+If corruption is detected, you should immediately make a backup before performing any other work in the database.
+To do so, you may need to set the `zero_damaged_pages=on` flag for the database server to allow `pg_dumpall` to succeed.
+After taking a backup, the recommended next step is to restore the database from a healthy backup before corruption was detected.
+The damaged database dump can be used to manually recover any changes made since the last backup, if needed.
+
+The causes of possible corruption are many, but can include unexpected poweroffs or unmounts, use of a network share for Postgres data, or a poor storage medium such an SD card or failing HDD/SSD.
+
 [huggingface]: https://huggingface.co/immich-app