## Name

gfdump.postgresql — dump/restore Gfarm metadata

## Synopsis

`gfdump.postgresql` -d [`options`]

`gfdump.postgresql` -r [`options`]

## DESCRIPTION

gfdump.postgresql dumps/restores metadata of Gfarm, managed by PostgreSQL running as a backend database. You need to execute this command on the host that the backend database of PostgreSQL is running. The command reads `gfmd.conf`, the configuration file of gfmd to get access information about the backend database. If gfmd is configured in the non-private mode, the root privilege is required to read the file.

When gfdump.postgresql is executed with `-d` option, it dumps the database to the file `db.out` at the current directory.

When it is executed with `-r` option, it restores the database from the dump file, `db.out` at the current directory. More specifically, it does the followings.

1. Stop gfmd if running.

2. Remove the current database.

3. Create a database again.

4. Restore a database from the dump file.

5. Delete the current journal file of gfmd, if exists.

6. Start gfmd again.

## OPTIONS

`--prefix` `path`

  If this option is given, gfdump.postgresql reads `PREFIX/etc/gfmd.conf` as the configuration file of gfmd. By default, it reads `%%SYSCONFDIR%%/etc/gfmd.conf`.

`-P` `prefix`

  Specify an installation prefix of the backend database (e.g. /usr/local). When gfdump.postgresql executes a PostgreSQL command such as pg_dump, it assumes the command is installed under the given prefix. If this option is omitted, gfdump.postgresql searches directories listed in the environment variable `PATH` for the commands.

`-l`

  Specify a path to the directory where the backend database puts files to store metadata of Gfarm.

  If the backend database is PostgreSQL, the directory is commonly called PGDATA directory. The default is `PREFIX/var/gfarm-pgsql` where PREFIX is a prefix given by `--prefix` option.

`-f` `file`

  Specify the name of dump file. The default is `db.out` at the current directory.

`--help`

  Show usage, then exit.

`-t`

  Show values of configurable parameters in human readable format, then exit immediately.

`-d`

  Dump mode.

`-n`

  Do not start/stop gfmd.

`-r`

  Restore mode.

## FILES

`%%SYSCONFDIR%%/gfmd.conf`

  configuration file for gfmd

## SEE ALSO

pg_dump(1), dropdb(1), createdb(1), psql(1), gfmd(8)