I wonder if there is a way to verify data integrity of data folders from a data-recovered hard disk, both MySQL and PostgreSQL?

  • If you have enabled data-checksums in Postgres it will automatically verify that and you can use pg_verify_checksums manually before starting the instance – a_horse_with_no_name Jul 10 '19 at 5:47
  • @a_horse_with_no_name Unfortunately I have never used -data-checksums that apparently must only be set at the point of cluster creation. Thank you. – sandthorn Jul 10 '19 at 6:20
  • 2
    If you use a tool like pgbackrest it will automatically verify your backups. – a_horse_with_no_name Jul 10 '19 at 6:21
  • 1
    Check Percona Toolkit for checksumming MySQL. But you need checksums before the dump, too. – Rick James Jul 11 '19 at 14:21

As far as I know, the only way in PostgreSQL is to run something like

pg_dumpall >/dev/null

which will scream if it encounters table corruption.

However, that won't test index integrity. For that, PostgreSQL v11 has the amcheck extension.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.