Skip to main content
Copy directories between instances and/or local

Usage

vastai copy SRC DST

Arguments

src
string
required
Source location for copy operation (supports multiple formats)
dst
string
required
Target location for copy operation (supports multiple formats)

Options

-i
string
Location of ssh private key (alias: --identity)

Description

Copies a directory from a source location to a target location. Each of source and destination directories can be either local or remote, subject to appropriate read and write permissions required to carry out the action. Supported location formats:
  • [instance_id:]path (legacy format, still supported)
  • C.instance_id:path (container copy format)
  • cloud_service:path (cloud service format)
  • cloud_service.cloud_service_id:path (cloud service with ID)
  • local:path (explicit local path)
  • V.volume_id:path (volume copy, see restrictions)
You should not copy to /root or / as a destination directory, as this can mess up the permissions on your instance ssh folder, breaking future copy operations (as they use ssh authentication) You can see more information about constraints here: https://vast.ai/docs/gpu-instances/data-movement#constraints Volume copy is currently only supported for copying to other volumes or instances, not cloud services or local.

Examples

vast copy 6003036:/workspace/ 6003038:/workspace/
 vast copy C.11824:/data/test local:data/test
 vast copy local:data/test C.11824:/data/test
 vast copy drive:/folder/file.txt C.6003036:/workspace/
 vast copy s3.101:/data/ C.6003036:/workspace/
 vast copy V.1234:/file C.5678:/workspace/

The first example copy syncs all files from the absolute directory '/workspace' on instance 6003036 to the directory '/workspace' on instance 6003038.
The second example copy syncs files from container 11824 to the local machine using structured syntax.
The third example copy syncs files from local to container 11824 using structured syntax.
The fourth example copy syncs files from Google Drive to an instance.
The fifth example copy syncs files from S3 bucket with id 101 to an instance.

Global Options

The following options are available for all commands:
OptionDescription
--url URLServer REST API URL
--retry NRetry limit
--rawOutput machine-readable JSON
--explainVerbose explanation of API calls
--api-key KEYAPI key (defaults to ~/.config/vastai/vast_api_key)