Transfer data to an OVH S3 bucket with rclone¶
This guide shows how to copy data from a Linux server, a Mac or a Windows PC to an OVHcloud Object Storage bucket (S3) with rclone, and how to check that everything arrived intact. You always start with an exercise: you transfer dummy data, generated for the occasion, with exactly the same commands as for your real data. On a Mac or a PC, you can also try a graphical client, Cyberduck, on the same data.
Moving the data to cold archive afterwards is optional and covered separately at the end of the page (Part 2).
Your values¶
First choose where you will type the commands, then fill in the fields: every command on this page updates as you type, and you only have to copy it. Fields highlighted in yellow still hold an example value. Your values are kept in this browser for your next visit; nothing is sent anywhere.
Never type your access keys here
Keys are typed only in the terminal, at step 2 (and in Cyberduck's own login window if you try it).
Preview: the real transfer command, with your values (step 5).
Preview: the real transfer command, with your values (step 5).
Choose Linux server, Mac or Windows above: the steps below then show the commands for your system only.
Before you start¶
- Three pieces of information from whoever manages your OVHcloud Public Cloud project: the bucket name (my-bucket), an access key and a secret key.
- An account on the Linux server that holds the data, with Internet access, and at least 110 GB of free space on a data disk of the server for the exercise, not on the system disk.The Terminal app (Applications, then Utilities) and at least 2 GB of free space for the exercise.Windows PowerShell (Start menu, type PowerShell) and at least 2 GB of free space for the exercise.
- Administrator rights on your machine to install rclone (
sudoon Linux and Mac). On a shared server where you do not have them, use the variant without administrator rights given at step 1. - About one hour for the 100 GB exercise. Measured on a lab server: 6 minutes to generate the data and 35 minutes to upload them, plus the time to check, clean up and read the commands.Keep the computer plugged in and awake during transfers.
Part 1 — Transfer the data¶
Step 1 — Install rclone¶
With rclone's official installation script, which asks for your password (sudo) and
installs the latest version:
The last command must print a version number.
Without administrator rights (shared server)
This installs rclone in your own ~/bin folder; it works on a standard x86-64
server (uname -m prints x86_64).
mkdir -p ~/bin && cd /tmp
curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip
unzip -o rclone-current-linux-amd64.zip
cp rclone-*-linux-amd64/rclone ~/bin/
cd -
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc
hash -r && which rclone && rclone version
The output must show a path in your home directory ending in /bin/rclone, then a
version number.
With winget, which is part of recent Windows versions:
Then close PowerShell, open a new PowerShell window, and check:
Step 2 — Configure access to the bucket¶
Paste this block. It asks for the access key, then for the secret key, which is not displayed while you type. If a configuration with the same name already exists, the block stops without changing anything: choose another name in "Your values" and copy the block again. Other rclone configurations are left untouched.
if rclone listremotes | grep -qx "{{remote}}:"; then
echo "A configuration named {{remote}} already exists: choose another name in Your values."
rclone listremotes
else
printf "Paste the access key, then Enter: "; read -r AK
printf "Paste the secret key (nothing is displayed, this is normal), then Enter: "
stty -echo; read -r SK; stty echo; echo
rclone config create {{remote}} s3 provider=Other env_auth=false \
access_key_id="$AK" secret_access_key="$SK" \
region={{region}} endpoint=https://{{endpointhost}} \
acl=private no_check_bucket=true > /dev/null
unset AK SK
chmod 600 "$(rclone config file | tail -1)"
rclone listremotes
fi
& {
if ((rclone listremotes) -contains "{{remote}}:") {
Write-Host "A configuration named {{remote}} already exists: choose another name in Your values."
} else {
$AK = Read-Host "Paste the access key, then Enter"
$SS = Read-Host "Paste the secret key (nothing is displayed, this is normal), then Enter" -AsSecureString
$SK = [Runtime.InteropServices.Marshal]::PtrToStringBSTR([Runtime.InteropServices.Marshal]::SecureStringToBSTR($SS))
rclone config create {{remote}} s3 provider=Other env_auth=false access_key_id=$AK secret_access_key=$SK region={{region}} endpoint=https://{{endpointhost}} acl=private no_check_bucket=true | Out-Null
}
rclone listremotes
}
The last command must print ovh: (and
your other rclone configurations, if any). The secret key is now stored in rclone's
configuration file, readable by you only: do not copy it anywhere else.
Step 3 — Check access¶
echo "test" | rclone rcat {{remote}}:{{bucket}}/access_test.txt
rclone lsf {{remote}}:{{bucket}}
rclone deletefile {{remote}}:{{bucket}}/access_test.txt
The second command must print access_test.txt. If a command prints
AccessDenied, check the keys (step 2), then contact whoever gave them to you.
Step 4 — Practise with dummy data (mandatory)¶
This step is not optional. It checks that your machine, the network and the bucket work together, and it tells you how long the real transfer will take, without any risk for your real data.
a) Create the generation script. Paste this block: it creates the file
generate_test_data.sh in the current folder and makes it executable.
Show the block that creates the script (60 lines)
cat > generate_test_data.sh <<'EOF'
#!/usr/bin/env bash
# Generates a tree of dummy data (random, incompressible) that mimics
# raw sequencing data, to test an rclone transfer. Runs on Linux and macOS.
# Usage: ./generate_test_data.sh TARGET_DIR [VOLUME_IN_GB]
# VOLUME_IN_GB < 10 -> "quick test" set (~1 GB)
# VOLUME_IN_GB >= 10 -> ~VOLUME_IN_GB GB (70 % as 1 GiB files, 30 % as 10 GiB files)
set -euo pipefail
DEST="${1:?Usage: $0 TARGET_DIR [VOLUME_IN_GB]}"
VOL="${2:-1}"
MIB=1048576
if [ -e "$DEST" ] && [ -n "$(ls -A "$DEST" 2>/dev/null)" ]; then
echo "Error: $DEST exists and is not empty." >&2
exit 1
fi
# Check free space before starting (requested volume + 10 %)
mkdir -p "$DEST"
NEEDED_GB=$(( (VOL < 10 ? 2 : VOL) * 11 / 10 ))
FREE_GB=$(( $(df -Pk "$DEST" | awk 'NR==2 {print $4}') / 1024 / 1024 ))
if [ "$FREE_GB" -lt "$NEEDED_GB" ]; then
echo "Error: $NEEDED_GB GB of free space needed, only $FREE_GB GB available on this disk." >&2
rmdir "$DEST" 2>/dev/null
exit 1
fi
if [ "$VOL" -lt 10 ]; then
N_MEDIUM=3; S_MEDIUM=$(( 100 * MIB )) # 3 x 100 MiB
N_LARGE=1; S_LARGE=$(( 600 * MIB )) # 1 x 600 MiB: uploaded in several parts
else
N_MEDIUM=$(( VOL * 70 / 100 )); S_MEDIUM=$(( 1024 * MIB ))
N_LARGE=$(( VOL * 30 / 1000 )); S_LARGE=$(( 10240 * MIB ))
fi
mkdir -p "$DEST/run_01/small" "$DEST/run_01/medium" "$DEST/run_02/large" \
"$DEST/folder with spaces/données accentuées"
# 2000 small files of 100 KiB (many objects, little volume)
for i in $(seq -w 1 2000); do
head -c 102400 /dev/urandom > "$DEST/run_01/small/read_$i.bin"
done
for i in $(seq -w 1 "$N_MEDIUM"); do
head -c "$S_MEDIUM" /dev/urandom > "$DEST/run_01/medium/sample_$i.fastq.gz"
done
for i in $(seq -w 1 "$N_LARGE"); do
head -c "$S_LARGE" /dev/urandom > "$DEST/run_02/large/alignment_$i.bam"
done
# Tricky names: spaces, accents, parentheses
echo "witness file" > "$DEST/folder with spaces/données accentuées/échantillon (copie) n°1.txt"
echo "Done:"
du -sh "$DEST"
find "$DEST" -type f | wc -l | xargs echo "files:"
EOF
chmod +x generate_test_data.sh
You can also download the script and read it first.
b) Generate the data. They go to /data_disk/rclone-exercise. Never use your home directory on a server, which is often on the system disk: filling it up can freeze the server. If you get "Permission denied", ask the server's administrator for a directory in your name on a data disk. The script refuses to start if the folder is not empty or if there is not enough space.
a) Nothing to create on Windows: generation is a single block, pasted at step b).
b) Generate the data. They go to rclone-exercise. The block refuses to start if the folder is not empty or if there is not enough space.
Show the generation block (33 lines)
& {
$Dest = "{{exo}}"; $Vol = {{vol}}
New-Item -ItemType Directory -Force -Path "{{logs}}" | Out-Null
if ((Test-Path -LiteralPath $Dest) -and (Get-ChildItem -LiteralPath $Dest -Force | Select-Object -First 1)) {
Write-Host "Error: $Dest exists and is not empty."; return
}
New-Item -ItemType Directory -Force -Path $Dest | Out-Null
$Base = if ($Vol -lt 10) { 2 } else { $Vol }
$Need = [math]::Floor($Base * 11 / 10)
$Free = [math]::Floor((Get-Item -LiteralPath $Dest).PSDrive.Free / 1GB)
if ($Free -lt $Need) {
Write-Host "Error: $Need GB of free space needed, only $Free GB available on this disk."
Remove-Item -LiteralPath $Dest; return
}
if ($Vol -lt 10) { $NM = 3; $SM = 100MB; $NL = 1; $SL = 600MB }
else { $NM = [math]::Floor($Vol * 70 / 100); $SM = 1GB; $NL = [math]::Floor($Vol * 30 / 1000); $SL = 10GB }
$rng = [Security.Cryptography.RandomNumberGenerator]::Create()
function Write-Random([string]$Path, [long]$Bytes) {
$buf = New-Object byte[] ([math]::Min($Bytes, 1MB))
$fs = [IO.File]::Create($Path)
try { $left = $Bytes; while ($left -gt 0) { $n = [int][math]::Min($left, $buf.Length); $rng.GetBytes($buf); $fs.Write($buf, 0, $n); $left -= $n } }
finally { $fs.Dispose() }
}
foreach ($d in "run_01/small", "run_01/medium", "run_02/large", "folder with spaces/données accentuées") {
New-Item -ItemType Directory -Force -Path (Join-Path $Dest $d) | Out-Null
}
for ($i = 1; $i -le 2000; $i++) { Write-Random (Join-Path $Dest ("run_01/small/read_{0:D4}.bin" -f $i)) 100KB }
for ($i = 1; $i -le $NM; $i++) { Write-Random (Join-Path $Dest ("run_01/medium/sample_{0:D3}.fastq.gz" -f $i)) $SM }
for ($i = 1; $i -le $NL; $i++) { Write-Random (Join-Path $Dest ("run_02/large/alignment_{0:D3}.bam" -f $i)) $SL }
Set-Content -LiteralPath (Join-Path $Dest "folder with spaces/données accentuées/échantillon (copie) n°1.txt") -Value "witness file"
$f = Get-ChildItem -LiteralPath $Dest -Recurse -File
"Done: {0:N2} GB in {1} files" -f (($f | Measure-Object Length -Sum).Sum / 1GB), $f.Count
}
Generation takes about 6 minutes for 100 GB on a typical lab server. For a more thorough exercise, set "Exercise volume" to 500.
1 GB by default: about 2000 small files, three medium ones and one large one, plus a file with spaces and accents in its name.
c) Upload the data. First open a screen session, which keeps running even if you
log out:
Then, inside this session:
BW="{{bw}}"
rclone copy "{{exo}}" {{remote}}:{{bucket}}/EXERCISE \
--fast-list --transfers 4 \
--bwlimit "$BW" -P \
--log-file "{{logs}}/exercise_copy.log" --log-level INFO
To leave screen without stopping the transfer: Ctrl+A then D. To come back:
screen -r transfer.
c) Upload the data. caffeinate -i keeps the Mac awake while rclone runs; keep the
lid open.
c) Upload the data. Keep the PowerShell window open until the end.
- Progress is displayed live (option
-P); the detailed log is$HOME/rclone-logs/exercise_copy.log. - The
BWline limits the bandwidth to 50MiB/s on weekdays from 8 am to 8 pm, and to 80MiB/s at night and at weekends, so as not to saturate the site network. Times are those of the machine.
d) Check the copy, once the transfer is over:
The exercise succeeded if the check ends with 0 differences found and if the last
two commands print the same number of objects and the same total size.
--exclude .DS_Store leaves out the small files that Finder
creates in every folder you open: they are useless in the bucket.
e) Clean up.
rclone purge permanently deletes everything under the given path, without confirmation and without a trash
Without the final /EXERCISE, the whole bucket disappears, with all the data it
holds. Read the path three times before pressing Enter. If in doubt, first run the
same command followed by --dry-run: it shows what would be deleted without
deleting anything.
If you want to try Cyberduck (f, below), keep the local folder rclone-exercise for now. Otherwise delete it:
Then send the files of the
$HOME/rclone-logs directory to whoever
supports you.
f) Optional: the same exercise with Cyberduck. Cyberduck is a free graphical client for Mac and Windows. This tests it on the same data, then checks with rclone that what it sent is intact.
- Install Cyberduck from cyberduck.io/download.
- Click "Open Connection" and choose the protocol S3 (HTTPS) in the list at the top
(if it is not there, enable it in the preferences, under Profiles). Server:
s3.eu-west-par.io.cloud.ovh.net, port 443, then the Access Key ID and the Secret Access Key, typed in this window only. - Open the bucket, create a folder named
CYBERDUCK-EXERCISE(Action menu, then New Folder) and open it. Select everything inside rclone-exercise in your file manager and drag it into the Cyberduck window. Note how long the transfer takes. - Check with rclone. The
--downloadoption makes rclone compare the content byte by byte: for large files, which Cyberduck sends in several parts, the bucket keeps no checksum that rclone can compare.
The check must end with 0 differences found, and the last two commands must print the
same number of objects and the same total size.
Clean up. In Cyberduck, select the folder CYBERDUCK-EXERCISE at the root of the
bucket, choose Delete ("Effacer" if Cyberduck is in French) and confirm: Cyberduck
removes the folder and everything in it. Do it in Cyberduck rather than with
rclone purge, which would leave the empty folder behind. Then delete the local
folder:
Step 5 — Transfer the real data¶
The same commands, with the directory of the real data (/path/to/data) and the destination directory in the bucket (my-dataset). First look for symbolic links, which rclone ignores by default: if the following command prints anything, ask for advice before going further.
Open a screen session, then start the transfer inside it:
Once the transfer is over, check:
If the transfer is interrupted, run exactly the same command again: rclone only sends what is missing.
Always rclone copy, never rclone sync
sync deletes from the bucket whatever no longer exists on your machine.
Troubleshooting¶
AccessDenied: the keys were mistyped at step 2. Delete the configuration withrclone config delete ovh, then paste the step 2 block again.rcloneis not found after installation: open a new terminal window and try again.-
The site network or the machine slows down: stop rclone (Ctrl+C), lower both bandwidths in "Your values", copy the command again and restart it. Once all transfers are over, this command deletes interrupted uploads older than 24 hours, which would otherwise still be billed in the bucket:
-
The check finds differences: run the
rclone copycommand again with--checksumadded, then check again.
Part 2 — Cold archive (optional)¶
This part only concerns data that have already been transferred and checked, and that you decide to keep for a long time without reading them. The decision belongs to the people responsible for the data.
OVHcloud offers its cheapest storage class, Cold Archive, only in the Paris 3-AZ region
(eu-west-par): the bucket must have been created there. Three constraints to know
before deciding:
- 180 days minimum: a file archived, then deleted or replaced before 180 days is billed until the end of that period.
- Delayed reading: an archived file must be restored before it can be read; the restoration is billed and can take up to 48 hours.
- File-by-file restoration: it is better to bundle small files into tar archives (for instance one per sequencing run) before the transfer.
Two ways to do it:
- Lifecycle rule (recommended): in the OVHcloud Control Panel, Lifecycle tab of the bucket, create a rule that transitions objects to Cold Archive after N days. Files move automatically; the transition itself is free.
- Direct upload to the archive: add
--s3-storage-class DEEP_ARCHIVEto therclone copycommand. Simpler, but leaves no room for mistakes.
To restore an archived directory and keep it readable for 7 days: the restoration does not touch the archived version, which stays in Cold Archive. It is not a swap. It creates a temporary readable copy alongside, billed for its lifetime, which disappears by itself after the 7 days.
See OVHcloud's Cold Archive FAQ for current conditions and prices.
Appendix — The generation script (Linux and Mac)¶
The same script as in step 4 a), without the command that creates the file.
Show the script
#!/usr/bin/env bash
# Generates a tree of dummy data (random, incompressible) that mimics
# raw sequencing data, to test an rclone transfer. Runs on Linux and macOS.
# Usage: ./generate_test_data.sh TARGET_DIR [VOLUME_IN_GB]
# VOLUME_IN_GB < 10 -> "quick test" set (~1 GB)
# VOLUME_IN_GB >= 10 -> ~VOLUME_IN_GB GB (70 % as 1 GiB files, 30 % as 10 GiB files)
set -euo pipefail
DEST="${1:?Usage: $0 TARGET_DIR [VOLUME_IN_GB]}"
VOL="${2:-1}"
MIB=1048576
if [ -e "$DEST" ] && [ -n "$(ls -A "$DEST" 2>/dev/null)" ]; then
echo "Error: $DEST exists and is not empty." >&2
exit 1
fi
# Check free space before starting (requested volume + 10 %)
mkdir -p "$DEST"
NEEDED_GB=$(( (VOL < 10 ? 2 : VOL) * 11 / 10 ))
FREE_GB=$(( $(df -Pk "$DEST" | awk 'NR==2 {print $4}') / 1024 / 1024 ))
if [ "$FREE_GB" -lt "$NEEDED_GB" ]; then
echo "Error: $NEEDED_GB GB of free space needed, only $FREE_GB GB available on this disk." >&2
rmdir "$DEST" 2>/dev/null
exit 1
fi
if [ "$VOL" -lt 10 ]; then
N_MEDIUM=3; S_MEDIUM=$(( 100 * MIB )) # 3 x 100 MiB
N_LARGE=1; S_LARGE=$(( 600 * MIB )) # 1 x 600 MiB: uploaded in several parts
else
N_MEDIUM=$(( VOL * 70 / 100 )); S_MEDIUM=$(( 1024 * MIB ))
N_LARGE=$(( VOL * 30 / 1000 )); S_LARGE=$(( 10240 * MIB ))
fi
mkdir -p "$DEST/run_01/small" "$DEST/run_01/medium" "$DEST/run_02/large" \
"$DEST/folder with spaces/données accentuées"
# 2000 small files of 100 KiB (many objects, little volume)
for i in $(seq -w 1 2000); do
head -c 102400 /dev/urandom > "$DEST/run_01/small/read_$i.bin"
done
for i in $(seq -w 1 "$N_MEDIUM"); do
head -c "$S_MEDIUM" /dev/urandom > "$DEST/run_01/medium/sample_$i.fastq.gz"
done
for i in $(seq -w 1 "$N_LARGE"); do
head -c "$S_LARGE" /dev/urandom > "$DEST/run_02/large/alignment_$i.bam"
done
# Tricky names: spaces, accents, parentheses
echo "witness file" > "$DEST/folder with spaces/données accentuées/échantillon (copie) n°1.txt"
echo "Done:"
du -sh "$DEST"
find "$DEST" -type f | wc -l | xargs echo "files:"