# pg_dumpall |gzip bsdtar Unrecognized archive format



## ProServ (Mar 1, 2015)

Hi,
Trying to run `pg_dumpall` and pipe to `gzip` and then mail the resulting gz file. However, the mail system uses `bsdtar` to open and it can't.

Tried the following:`/usr/local/bin/pg_dumpall | gzip -c > latest-pgdumpall.sql.gz`


```
bsdtar -tzvf latest-pgdumpall.sql.gz
bsdtar: Error opening archive: Unrecognized archive format
```

Please point out what I might be doing wrong.

Thanks.


----------



## chrbr (Mar 1, 2015)

Dear ProServ,
`gzip` is just for compression. You can check the resulting file type by `file latest-pgdumpall.sql.gz`. You might need the option to generate a tar archive as `/usr/local/bin/pg_dumpall -F t| gzip -c > latest-pgdumpall.sql.gz`. Please see http://www.postgresql.org/docs/current/static/app-pgdump.html I hope it helps. Then tgz would be a more common file extension for compressed tar archives instead of gz only.


----------

