Skip to main content

lium cp

Copy files from one pod to another directly over SSH. The data goes pod to pod and never through your machine.

lium cp SRC_POD:PATH DST_POD:PATH [OPTIONS]

Arguments​

  • SRC_POD:PATH — The source pod and the path on it. A trailing / on a directory copies its contents, as in rsync.
  • DST_POD:PATH — The destination pod and the path on it.

POD is a name, huid, id or index from lium ps, and must match exactly one pod. Both pods must be RUNNING with an SSH connection. For copies between your machine and a pod use lium scp or lium rsync.

Options​

FlagEffect
--bwlimit KIB_PER_SCap the transfer rate (rsync --bwlimit)
--exclude PATTERNSkip matching paths; repeatable (rsync --exclude)
--deleteRemove files at the destination that are not in the source
--jsonPrint machine-readable JSON

How it works​

The CLI creates a one-off SSH key on your machine, places its private half on the source pod and authorizes its public half on the destination for the duration of the copy, runs rsync from the source to the destination, then removes both halves. If that cleanup fails, the CLI warns and names the command that revokes the key.

Both pods need rsync (apt-get install -y rsync). The destination also needs flock (util-linux, present on every Ubuntu and Debian image), which keeps two copies into the same pod from running at once.

Examples​

lium cp dev-pod:/workspace/src train-pod:/workspace/
lium cp 1:/workspace/ckpt/ 2:/workspace/ckpt/ --exclude '*.tmp' --bwlimit 50000
lium cp 1:/data/ 2:/data/ --delete --json

--json prints {"ok": true, "source": {"pod", "path"}, "destination": {"pod", "path"}, "exit_code"}.

Errors​

CodeExitWhen
invalid_arguments2A side has no POD: part, or a pod reference matches more than one pod
pod_not_found5No pod matches
ssh_unavailable4A pod is not RUNNING or has no SSH connection yet
ssh_host_key_unknown4The destination's host key is not pinned yet: connect once with lium ssh <pod>, or set LIUM_SSH_INSECURE=1
copy_failed1rsync or the key grant failed on a pod; the message carries rsync's own error

See also​

  • lium scp — copy between your machine and pods
  • lium rsync — sync directories between your machine and pods