Re: Data corruption zero a file - help!! - Mailing list pgsql-general

From Noel Faux
Subject Re: Data corruption zero a file - help!!
Date
Msg-id 440F84ED.4080308@med.monash.edu.au
Whole thread Raw
In response to Re: Data corruption zero a file - help!!  (Michael Fuhr <mike@fuhr.org>)
Responses Re: Data corruption zero a file - help!!  (Michael Fuhr <mike@fuhr.org>)
List pgsql-general
Thanks for all your help Michael, we wish to do a vacuum and dump before the upgrade to 8.02.  Do you believe this data corruption is a postgres issue of an OS / hardware issue?

Cheers
Noel

Michael Fuhr wrote:
On Thu, Mar 09, 2006 at 11:13:40AM +1100, Noel Faux wrote: 
Ok it worked but we ran into another bad block :(
/vacuumdb: vacuuming of database "monashprotein" failed: ERROR:  invalid
page header in block 9022937 of relation "gap"
/
So the command we used was:
dd bs=8k seek=110025 conv=notrunc count=1 if=/dev/zero
of=/usr/local/postgresql/postgresql-7.4.8/data/base/37958/111685332.68

I'm tried to work out the formula for finding the file (i.e. the 
111685332.*) to fix and the value to seek to, but as a complete novice 
I'm lost, any pointers would be a great help.  We checked the block size 
and it's 8192.   
The database files are 1G, or 131072 8k blocks.  The bad block you
zeroed was 9022921; here's how you could have determined the file
and block number within that file:

test=> SELECT 9022921 / 131072 AS filenum, 9022921 % 131072 AS blocknum;filenum | blocknum 
---------+----------     68 |   110025
(1 row)

The new bad block is 9022937 so the query would be:

test=> SELECT 9022937 / 131072 AS filenum, 9022937 % 131072 AS blocknum;filenum | blocknum 
---------+----------     68 |   110041
(1 row)

If you're running 7.4.8 then consider upgrading to 7.4.12.  Offhand
I don't know if any bugs have been fixed that might cause the problem
you're seeing, but there have been other bug fixes.
 

Attachment

pgsql-general by date:

Previous
From: Steve Atkins
Date:
Subject: Re: Fixing up a corrupted toast table
Next
From: "xia_pw"
Date:
Subject: questions?