Re: Data corruption zero a file - help!!

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Noel Faux <noel(dot)faux(at)med(dot)monash(dot)edu(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Data corruption zero a file - help!!
Date: 2006-03-09 00:42:15
Message-ID: 20060309004215.GA58720@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

--
Michael Fuhr

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Enrique Snchez 2006-03-09 00:44:48 null timestamp
Previous Message Noel Faux 2006-03-09 00:13:40 Re: Data corruption zero a file - help!!