Clone
Clone guide for pgcli
Create a new instance whose data is copied from an existing one, streamed directly — no temp file on disk.
What happens
- Pre-flight check — the source is verified before anything is created:
- Local instance: container must be running
--dsn: an authenticatedSELECT 1must succeed (catches wrong password, unreachable host)
- Create — a new instance entry is added to the config with a random password, its own container name, data directory and auto-assigned port
- Start — the new instance is started (same workflow as
pg start) - Stream — source data is piped to the target with live transfer progress shown once per second
Notes
- The source instance must be running (or the
--dsntarget reachable); a bad source fails immediately with no side effects - The new instance name must not already exist in config
--dsnand--instanceare mutually exclusive: with--dsnthe connection string determines host, port and database- The new instance gets a fresh random password — find it in the clone output or
pg status -i <name> - Logical copy only (schema + data); for large databases a physical approach may be faster