From a81fb73faf8fd26c3268dd52fb6cf06fd21b0ddf Mon Sep 17 00:00:00 2001 From: Matthew Momjian <50788000+mmomjian@users.noreply.github.com> Date: Sun, 5 Jan 2025 13:03:53 -0500 Subject: [PATCH] feat(docs): additional corruption checks (#15102) corruption checks --- docs/docs/FAQ.mdx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/docs/FAQ.mdx b/docs/docs/FAQ.mdx index c0615fc79a..f7b1a20680 100644 --- a/docs/docs/FAQ.mdx +++ b/docs/docs/FAQ.mdx @@ -447,6 +447,24 @@ docker exec -it immich_postgres psql --dbname=immich --username= -- +You can also scan the Postgres database file structure for errors: + +
+Scan for file structure errors +```bash +docker exec -it immich_postgres pg_amcheck --username=postgres --heapallindexed --parent-check --rootdescend --progress --all --install-missing +``` + +A normal result will end something like this and return with an exit code of `0`: + +```bash +7470/8832 relations (84%), 730829/734735 pages (99%) +8425/8832 relations (95%), 734367/734735 pages (99%) +8832/8832 relations (100%), 734735/734735 pages (100%) +``` + +
+ 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.