[TriLUG] Using gzip to backup postgres to tape

Andrew Perrin clists at perrin.socsci.unc.edu
Mon Nov 27 21:46:06 EST 2006


On Mon, 27 Nov 2006, Brian Henning wrote:

> o A gzipped tar isn't tar format; it's gzip format.  The tape drive doesn't 
> know what to do with gzip and chokes.

I agree with this empirically, but it doesn't make sense to me, since tar 
-zf /dev/nst0 works, and man tar says:

        -z, --gzip, --gunzip, --ungzip
               filter the archive through gzip

so it seems like there ought to be a way to make gzip spit out gzipped tar 
data that will write to the tape. But nevertheless...

> ... script the 
> following steps:
>
> 1) Dump from postgre through gzip into a file.  Don't worry about tar format; 
> dump it however postgre likes it when it's time to restore.
>
>  pg_dump --make-restore-easier mydatabase | gzip [-9] tempdump.gz
>
> (where --make-restore-easier is whatever set of flags and options makes 
> restoration easiest, and [-9] means optionally specify maximum gzip 
> compression)
>
> 2) Tar the gzipped file onto the tape drive
>
>  tar -cvf /dev/nst0 tempdump.gz
>
> 3) Delete the temporary file
>
>  rm tempdump.gz

This is a clever approach, and I'll try it tomorrow. Thanks - kludgy, but 
clever.

Andy


----------------------------------------------------------------------
Andrew J Perrin - andrew_perrin (at) unc.edu - http://perrin.socsci.unc.edu
Assistant Professor of Sociology; Book Review Editor, _Social Forces_
University of North Carolina - CB#3210, Chapel Hill, NC 27599-3210 USA
New Book: http://www.press.uchicago.edu/cgi-bin/hfs.cgi/00/178592.ctl







More information about the TriLUG mailing list