Thread: Recommended method for creating file of zeros?

Recommended method for creating file of zeros?

From
"Jason L. Buberel"
Date:
I have a recover situation related to:

Oct 13 23:04:58 66-162-145-116 postgres[16955]: [1-1] LOG:  database system was shut down at 2007-10-13 23:04:54 PDT
Oct 13 23:04:58 66-162-145-116 postgres[16955]: [2-1] LOG:  checkpoint record is at F0/E200001C
Oct 13 23:04:58 66-162-145-116 postgres[16955]: [3-1] LOG:  redo record is at F0/E200001C; undo record is at F0/E200001C; shutdown TRUE
Oct 13 23:04:58 66-162-145-116 postgres[16955]: [4-1] LOG:  next transaction ID: 172668192; next OID: 88470513
Oct 13 23:04:58 66-162-145-116 postgres[16955]: [5-1] LOG:  next MultiXactId: 32334; next MultiXactOffset: 69955
Oct 13 23:04:58 66-162-145-116 postgres[16955]: [6-1] PANIC:  could not access status of transaction 172668192
Oct 13 23:04:58 66-162-145-116 postgres[16955]: [6-2] DETAIL:  could not open file "pg_clog/00A4": No such file or directory
Oct 13 23:04:58 66-162-145-116 postgres[16953]: [1-1] LOG:  startup process (PID 16955) was terminated by signal 6
Oct 13 23:04:58 66-162-145-116 postgres[16953]: [2-1] LOG:  aborting startup due to startup process failure
~

Based on what I've read on the mail archives, the recommended fix is to create file '00A4' and fill it with 256k zeros. Is there a quick and easy linux-way of creating such a beast?

-jason

Re: Recommended method for creating file of zeros?

From
Kevin Hunter
Date:
At 2:17a -0400 on 14 Oct 2007, Jason L. Buberel wrote:
> create file '00A4' and fill it with 256k zeros. Is there a quick and
> easy linux-way of creating such a beast?

The tool is 'dd' and /dev.  /dev/zero in this case.  The summary of what
you asked:

$ dd if=/dev/zero of=./zblah count=1 bs=256k
1+0 records in
1+0 records out
262144 bytes (262 kB) copied, 0.00130993 seconds, 200 MB/s

$ dd if=/dev/zero of=./zblah count=1 bs=256000
1+0 records in
1+0 records out
256000 bytes (256 kB) copied, 0.00136915 seconds, 187 MB/s

HTH,

Kevin

Re: Recommended method for creating file of zeros?

From
"Jason L. Buberel"
Date:
And thank you to Kevin - this did the trick perfectly. I've been able to recover everything successfully.

Regards,
Jason

Kevin Hunter wrote:
The tool is 'dd' and /dev.  /dev/zero in this case.  The summary of what
you asked:

$ dd if=/dev/zero of=./zblah count=1 bs=256k
1+0 records in
1+0 records out
262144 bytes (262 kB) copied, 0.00130993 seconds, 200 MB/s

$ dd if=/dev/zero of=./zblah count=1 bs=256000
1+0 records in
1+0 records out
256000 bytes (256 kB) copied, 0.00136915 seconds, 187 MB/s

HTH,

Kevin