PostgreSQL Won't Start? Don't Experiment — Bring It In for an Initial Evaluation

PostgreSQL is the open-source database of choice for enterprise systems, SaaS and larger applications, famous for reliability. But reliable doesn't mean unbreakable: power cuts, full disks and failed upgrades can still stop it starting. PostgreSQL is very different from MySQL — don't force MySQL habits onto it, especially pg_wal and pg_control, where one wrong move can write off the whole database. Many people search for quick fixes online and make things worse with every attempt; stopping, backing up and bringing it in for inspection is actually the cheapest approach. Below, from a repair technician's perspective, step by step.

1. What Is PostgreSQL? Who Uses It?

  • PostgreSQL is an enterprise-grade open-source database known for strictness and reliability — Hong Kong SaaS companies, fintech and larger systems widely use it.
  • It enforces ACID and is obsessive about data integrity — which is exactly why, when it breaks, it refuses to start rather than silently corrupting your data. It's protecting you, don't be mad at it.
  • Physically it's a data directory of files and folders: base holds data, pg_wal holds the write-ahead log, pg_control records checkpoint state — every piece matters.
  • Unlike MySQL, PostgreSQL has no REPAIR TABLE equivalent — recovery relies on backup restores, dumps, or file-level work. The mindset is completely different.
  • Typical scenario: a system running on a Linux server; after a power cut or upgrade, PostgreSQL won't start and the log complains about checkpoint mismatch.
  • How it was installed matters: apt/yum installs, Docker containers and cloud hosting all keep the data directory in different places with different handling — we'll ask which one you have first.
  • PostgreSQL data files are named by numeric IDs, unlike MySQL where names reveal tables — never move or rename files inside by hand; one wrong move breaks the mapping.

2. Common Failure Modes and Symptoms (Read the Log)

  • "FATAL: the database system is starting up" — seen at startup, usually crash recovery in progress; wait it out. Only an endless loop means real trouble.
  • "could not read block" — page-level corruption; the log names the file and block, a key clue for locating the damage — copy it down and don't forget it.
  • "could not open file pg_control" or checkpoint errors — pg_control damage; the server will refuse to start.
  • "could not extend file" / "No space left on device" — disk full, PostgreSQL can't write. Same idea as MySQL's error 28.
  • Files missing from pg_wal (deleted by hand or by a backup tool gone wrong) — can stall crash recovery and kill point-in-time recovery chances.
  • Major-version upgrade (pg_upgrade) failure — old data directory doesn't match new binaries, common with manual upgrades done without reading the steps or skipping --check first.
  • Underlying bad disk sectors or filesystem damage — PostgreSQL is just the victim; the log will show I/O errors.

3. First 10 Minutes After Failure: Do and Don't

  • Seeing 'starting up'? Don't kill it immediately: crash recovery on a large database can take a long while; killing it just restarts the process and may make things worse.
  • Immediately copy the entire data directory elsewhere. Don't touch anything until that's done — the same iron rule as MySQL.
  • Never delete anything inside pg_wal, and don't think of them as junk logs. They're the lifeline of recovery — wrongly deleted, there's no way back. We've seen this mistake more than once.
  • Don't run pg_resetwal (formerly pg_resetxlog) yourself. It's a last resort that loses data — don't touch it if you don't fully understand it.
  • Don't initdb a fresh cluster over the old data directory — once overwritten, the old data is truly gone.
  • Copy the full log segment; note the last healthy time, any power cuts, any upgrades — critical for diagnosis.
  • For Docker or cloud environments, don't rush to delete containers or rebuild: deleting a container wipes any data not mounted outside it.

4. How We Inspect It at the Shop (Step by Step)

  • First, a full backup: block-level image or complete copy of the data directory; all attempts happen on the copy, the original is sealed.
  • We read pg_control state with pg_controldata: clean shutdown or crash, and where the checkpoint stands — the starting point of the whole inspection.
  • We read the PostgreSQL log timeline line by line: when the first error hit, which file, which block — mapping the damage.
  • We check disk space, filesystem and SMART to rule out underlying issues — PostgreSQL is often just taking the blame.
  • On the copy, we attempt startup and watch whether crash recovery completes; if it does, we pg_dump immediately, database by database — don't rush it all at once.
  • If it won't start, we isolate database directories one by one to find which one kills the cluster, then decide the case's viability — never a blanket 'hopeless'.
  • We assess WAL completeness and base-backup availability to see if point-in-time recovery is possible.

5. Cases We Can Handle at the Shop

  • Disk-full startup failure: free space, handle WAL, and the service usually returns — data typically untouched.
  • Crash recovery completes: once up, we pg_dump immediately — what dumps out is saved — then rebuild a clean cluster and restore.
  • Single database or table damaged: dump everything else healthy, containing loss to the affected area.
  • Wrong config or permissions: correct them and it's fixed without touching data.
  • With base backup plus WAL: point-in-time recovery back to before the failure — the cleanest approach.
  • Failed upgrade with old data directory intact: start it back with the old binaries, then replan the upgrade properly.
  • Pure ownership mistake (e.g. files owned by root after migration): chown them back to the postgres user and it starts — the cheapest kind of fix.

6. Cases That Need a Lab or the Vendor

  • Severely damaged pg_control plus WAL gaps with no backup — checkpoints can't reconcile; needs file-level specialist work.
  • Physical disk damage: clicking, unrecognized drive, spreading bad sectors — the disk must be rescued first, our sister lab Recoverydata King's territory.
  • Suspected ransomware encrypted the data directory: virus analysis first — don't treat it as ordinary corruption. Encrypted files and corrupted files are two different things.
  • All reasonable steps exhausted with no startup and no dump: we'll tell you honestly instead of charging endlessly for luck-based attempts — that's our principle.
  • Enterprises with vendor support or managed services: sometimes going back to the provider is faster — we'll help weigh the best route.
  • Suspected filesystem-level damage: fix the filesystem first, the database second — reversed order wastes the effort.
  • PITR needs long downtime the business can't afford: we'll plan in stages — rescue the core database to restore operations first, the rest after.

7. Prevention and Backup Advice (So You Never Come Back for This)

  • The 3-2-1 rule: at least three backup copies, two media types, one offsite. Databases are no exception.
  • Regular logical backups with pg_dump: the concept is simple — export the whole database as a SQL text file; for small systems daily is plenty, and restore is just one command.
  • For larger systems add pg_basebackup plus WAL archiving: physical backup with log archiving enables true point-in-time recovery — the enterprise approach.
  • Always test restores: an untested backup is no backup. Periodically restore on a separate machine to verify it really works — don't discover failure when you need it.
  • Don't keep backups on the same machine: when it dies, the backup dies with it — we've seen it too many times.
  • Do homework before upgrades: read the official upgrade docs, complete backups first, and for major versions rehearse on a test environment — never experiment directly on production.
  • Monitor disk space and WAL growth: WAL can eat a whole disk overnight — set alerts instead of relying on humans noticing. Don't skimp on this.

8. Fees and Time (How It's Calculated)

  • Initial evaluation: we read the logs and pg_control, determine the damage type, and tell you viability and approach — no charge at this stage.
  • Formal quotes are per case: based on data volume, damage extent, and PITR needs. Itemized written quote before we touch anything.
  • No recovery, no recovery fee: if assessment says no, or we try and truly fail, you don't pay for recovery work.
  • Time depends on data volume: a few GB versus terabytes is a world apart, and crash recovery alone can take a long time — realistic expectations at inspection.
  • We never quote over the phone: quoting without seeing logs and data condition is irresponsible — we don't do that.
  • Urgent cases negotiable: if business is halted, we'll prioritize the core database so you can resume operations first.
  • The inspection report documents damage location and recommendations: even if you don't proceed with us, the report is yours to keep.

Disclaimer: there is no 100% guarantee in database repair. Damage location, WAL integrity and backup availability directly affect recoverability. After our initial evaluation we'll tell you honestly — no exaggeration, no reckless commands. All fees confirmed in writing beforehand.

Frequently Asked Questions

It's been showing 'the database system is starting up' for ages. Is it hung?

Not necessarily. It's likely running crash recovery, which can take a long time on large databases — the log will show progress. Never kill it out of impatience; that just restarts the process. Only a true infinite loop or a completely stalled log means trouble — bring it in and we'll judge from the log.

I deleted files inside pg_wal by hand. What happens?

Very serious. pg_wal is the lifeline of crash recovery and point-in-time restore — wrongly deleted, recovery may never complete and PITR may be impossible forever. Stop immediately, no more writes, and bring the whole data directory. Salvageability needs real assessment — the sooner you bring it in, the better the chance.

The internet told me to run pg_resetwal. What is it? Should I?

pg_resetwal (formerly pg_resetxlog) is a last-resort tool for resetting WAL state — it can lose data, and wrong parameters can write off the whole cluster. Don't touch it if unsure, and definitely don't follow random internet tutorials. Bring it in and let us judge whether it's truly needed or there's another way.

A major PostgreSQL upgrade failed and it won't start. What now?

First: don't initdb over the old data. If the old-version data directory is intact, there's still a way — start the service back with the old binaries to stay operational, then replan the upgrade. If the old directory was already disturbed, bring it in for assessment and stop trying other home remedies yourself.

No backup at all. Can PostgreSQL still be saved?

Depends on where the damage is. Config or single-file issues may be fixable; widespread page damage with incomplete WAL is very hard. PostgreSQL has no MyISAM-style repair tool, so no backup means much harder — which is why we keep nagging about backups. It's not about making money off you; it's genuine advice.

What's the biggest difference between PostgreSQL and MySQL? Why not the same recovery approach?

Completely different architectures: MySQL has MyISAM with REPAIR TABLE; PostgreSQL doesn't. PostgreSQL relies on MVCC and WAL — recovery means restore and rebuild, not 'repair table'. Forcing MySQL methods onto PostgreSQL easily makes things worse; we've seen this mistake many times.

How often to back up? pg_dump or basebackup?

Small systems: daily pg_dump is plenty — simple concept, easy restore. Large or always-on systems: pg_basebackup plus WAL archiving for point-in-time recovery. Whichever you use, remember to test restores — untested equals nonexistent.

How does PostgreSQL backup differ from MySQL?

Same concepts, different tools: MySQL uses mysqldump plus binary log, PostgreSQL uses pg_dump plus WAL. PostgreSQL's WAL is a continuous log that pairs with base backups for PITR; MySQL's binlog is conceptually similar but the commands and workflow differ — don't mix the two.

WhatsApp 2115 9219