A server's disk goes away when you destroy the server. This tutorial shows how to get data onto a server, and how to get your results off it. You need a running server with an SSH key; see Connect with SSH. Open the server's Connect tab and note the Host, the Port and the user, root. In the commands below, replace HOST and PORT with them.
1. Check the disk first
Connect with SSH and look at the free space before a large copy:
df -h /workspaceThe Avail column shows what is left. The disk size is set when you deploy, so a dataset larger than the disk will not fit.
2. Copy a file with scp
From your own computer:
scp -P PORT ./notes.txt root@HOST:/workspace/
scp -P PORT root@HOST:/workspace/results.tar.gz ./The first line uploads, the second downloads. scp takes a capital -P for the port. Add -r to copy a folder. If your key is not in the default place, add -i ~/.ssh/your_key.
If you installed the command-line tool, the same copy needs no host and port. A path that starts with : is on the server:
apidly scp ins_ID ./notes.txt :/workspace/
apidly scp ins_ID :/workspace/out ./out -r3. Sync a folder with rsync
For a dataset or checkpoints, use rsync. If the connection breaks, run the same command again and it continues where it stopped:
rsync -avz -e "ssh -p PORT" ./data/ root@HOST:/workspace/data/
rsync -avz -e "ssh -p PORT" root@HOST:/workspace/checkpoints/ ./checkpoints/The trailing / on ./data/ matters: it copies the contents of the folder. Many small files are faster as one archive: tar -czf data.tar.gz ./data.
4. Check that it arrived
Compare a checksum on both sides. The two lines must match:
sha256sum /workspace/results.tar.gz
sha256sum ./results.tar.gzOn macOS use shasum -a 256 for your own computer. Run the first line on the server and the second on your computer.
5. Copy between two of your servers
Both servers must be running.
- Open Storage and select the Transfers tab.
- Select Copy between servers.
- Choose From server and the Folder on that server, then To server and its folder.
- Select Start copy.
Files with the same name at the destination are overwritten. Each server runs one transfer at a time. See Volumes and copies.
6. Back up to your own bucket
A helper script copies a folder to any S3-compatible storage that you own. On the server:
curl -fsSLO https://apidly.com/downloads/gpu-backup.sh
curl -fsSL https://apidly.com/downloads/SHA256SUMS | grep ' gpu-backup\.sh$' | sha256sum -c - && chmod +x gpu-backup.sh
./gpu-backup.sh setup
./gpu-backup.sh backup /workspace my-projectThe check prints gpu-backup.sh: OK. setup asks for your bucket's endpoint, region, bucket name, key and secret, and saves them only on the server. To see what it would copy first, add --dry-run to any command. On a new server, download the helper, run setup again and restore:
./gpu-backup.sh list
./gpu-backup.sh restore my-project /workspaceYour storage provider charges for the stored data and for downloads, under your own agreement. Use a key that can reach only this bucket. See Back up to your own storage.
Which method when
| Need | Use |
|---|---|
| One file | scp |
| A big folder, or a flaky connection | rsync |
| Server to server | Copy between servers |
| A copy that outlives the server | Your own bucket |
More detail is in Moving data.
When you are done: stop or delete
Copy first, then clean up. Stop keeps the disk and its files but still charges for the disk. Destroy ends every charge and deletes the disk, so run a backup or download before you do it. See Start, stop and restart.
Next
Ready to try it?
Create a free account and add credit when you want to start a server. The smallest top-up is $10.
Was this helpful?