Learning objectives
After reading this article you will be able to:
- Set up two S3-compatible providers as rclone remotes
- Copy, verify and repeat the migration without deleting anything by mistake
- Plan the final cutover and switch your application to the new storage
On this page
- How does a migration with rclone work?
- What should you prepare before copying?
- How do you set up the source and the destination in rclone?
- How do you rehearse and run the first copy?
- How do you verify that everything arrived?
- How do you run the final cutover without losing files?
- Which errors show up during a migration?
- How to do this on Square Cloud
- FAQs
Switching object storage providers looks simple when both speak S3: the API is the same, so any client can read from one and write to the other. The risk is in the details. A sync with source and destination swapped deletes the good files, objects uploaded during the copy get left behind, metadata like Cache-Control goes missing and the old provider's bill grows with the data going out.
rclone suits the job because it compares source and destination, repeats only what is missing and verifies the result. This guide breaks the migration into stages, from the inventory to the final cutover. If you are still picking a tool, the comparison is in the best S3 client tool.
How does a migration with rclone work?#
A migration between S3 providers is a copy of objects from a source bucket to a destination, repeated until both sides match, followed by switching the application to the new storage. rclone lists both sides, compares each object (by size and modification time, or by size and hash) and transfers only the ones that are missing or changed.
Between different providers, the bytes flow through the machine running the command: rclone downloads from the source and uploads to the destination at the same time. Its documentation is clear that server-side copies only happen when source and destination are the same remote. That's why the machine's bandwidth sets the speed, and a VM close to one of the providers usually runs much faster than a laptop at home.
The plan has five stages:
- Inventory and a map from source to destination.
- Setting up the two remotes.
- Copy rounds with
rclone copy, while the application keeps using the source. - Verification with
rclone check. - Cutover: pause writes, run one
rclone sync, verify again and switch the application's variables.
What should you prepare before copying?#
- Keys. On the source, permission to list and read. On the destination, to write, including multipart uploads. A read-only key on the source rules out the worst mistake: deleting data there.
- Inventory. How many objects and how many GB, per bucket.
rclone sizeanswers that in the next section. - Map. Where each bucket goes. Not every destination has the same buckets: a source bucket may become a prefix at the destination, like
photos/inside another bucket. Keep public and private apart, because visibility is usually set at the destination (on the bucket or the folder) and doesn't travel with the copied object. The difference is in what is a storage bucket. - Destination limits. Maximum object size, the size above which uploads must be multipart and the request rate limit.
- Egress cost. Many providers charge per GB going out, plus read and list requests. In a hypothetical example at US$0.10 per GB, migrating 500 GB would cost US$50 in egress alone. Check the real price on your provider's pricing page and see what egress fees are.
How do you set up the source and the destination in rclone?#
Each provider becomes a remote. To keep keys out of a file, define both with environment variables: the part between RCLONE_CONFIG_ and the option is the remote's name, written in uppercase in the variable and used in lowercase in the command.
# source: the current provider (on AWS, use PROVIDER=AWS and omit ENDPOINT)
export RCLONE_CONFIG_SOURCE_TYPE=s3
export RCLONE_CONFIG_SOURCE_PROVIDER=Other
export RCLONE_CONFIG_SOURCE_ENDPOINT=https://s3.source.example.com
export RCLONE_CONFIG_SOURCE_REGION=us-east-1
export RCLONE_CONFIG_SOURCE_ACCESS_KEY_ID=source-key
export RCLONE_CONFIG_SOURCE_SECRET_ACCESS_KEY=source-secret
# destination: the new provider
export RCLONE_CONFIG_DEST_TYPE=s3
export RCLONE_CONFIG_DEST_PROVIDER=Other
export RCLONE_CONFIG_DEST_ENDPOINT=https://s3.dest.example.com
export RCLONE_CONFIG_DEST_REGION=us-east-1
export RCLONE_CONFIG_DEST_ACCESS_KEY_ID=dest-key
export RCLONE_CONFIG_DEST_SECRET_ACCESS_KEY=dest-secretTest both sides and take the inventory:
rclone lsd source: # lists the source buckets
rclone size source:photos # number of objects and total size
rclone lsf dest:files # confirms the destination answersIf the destination key can't create buckets, add --s3-no-check-bucket to the copy commands: according to the documentation, with it rclone doesn't try to check that the bucket exists or to create it.
How do you rehearse and run the first copy?#
Start with --dry-run, which shows what would be transferred without writing anything:
rclone copy source:photos dest:files/photos --dry-run -vcopy sends the contents of source:photos to dest:files/photos, not the photos folder with its contents inside. If the list looks right, run it for real:
rclone copy source:photos dest:files/photos \
--checksum \
--transfers 16 --checkers 16 \
--progress \
--log-file migration.log --log-level INFO| Flag | What it does | Default |
|---|---|---|
--checksum |
Compares size and hash instead of size and time; falls back to size only when there's no hash | off |
--transfers |
Files transferred in parallel | 4 |
--checkers |
Comparisons in parallel | 8 |
-M, --metadata |
Copies metadata such as Cache-Control and Content-Disposition |
time and MIME type only |
--s3-upload-cutoff |
Size above which the upload goes multipart | 200 MiB |
--s3-chunk-size |
Size of each part | 5 MiB |
--tpslimit |
Cap on requests per second | unlimited |
The S3 backend documentation calls --checksum the most accurate way to detect changes and recommends it when both sides are S3. It also avoids reading the modification time, which on S3 costs one HEAD per object because it doesn't come back in listings.
In memory, multipart takes --transfers × --s3-upload-concurrency (default 4) × --s3-chunk-size: with 16 transfers and 5 MiB parts, about 320 MiB. If the destination requires multipart below 200 MiB, lower --s3-upload-cutoff. Part sizing is covered in uploading large files.
If the copy drops, run the same command again: anything that already arrived intact is skipped.
How do you verify that everything arrived?#
rclone check compares sizes and hashes on both sides and changes nothing:
rclone check source:photos dest:files/photos --one-way --combined report.txt
grep -v '^=' report.txt # only what didn't matchWith --one-way, it only checks that everything on the source exists, identical, on the destination. In the --combined report, each line starts with a symbol: = identical, + only on the source (not copied yet), - only on the destination, * different and ! read error. Also compare the rclone size totals on both sides.
Objects uploaded as multipart by another tool may have no comparable hash. For critical data, rclone check --download downloads both sides and compares the content byte by byte, at the cost of reading everything from the source again.
How do you run the final cutover without losing files?#
The copy rounds bring the destination close to the source, but the application keeps writing. The cutover closes that gap:
Pause writes to the source: maintenance mode on the part of the app that uploads, or a queue that holds uploads for a few minutes.
Rehearse the final sync, which also deletes from the destination what was removed from the source during the migration:
bashrclone sync source:photos dest:files/photos --checksum --dry-run rclone sync source:photos dest:files/photos --checksumCheck the argument order:
synconly modifies the second one. Swapped, it would delete the source to match an incomplete destination.Verify with
rclone checkwithout--one-way, to catch leftovers on either side.Switch the application to the new storage: endpoint, region, keys and bucket name, which belong in environment variables. If your database stores full URLs instead of keys, update them, or they keep pointing at the old provider.
Keep the source read-only for a few days before deleting it. If something is missing, you can still copy it.
The same playbook, with dump and restore instead of rclone, works for migrating a database.
Which errors show up during a migration?#
| Symptom | Likely cause | Fix |
|---|---|---|
AccessDenied when listing the source |
Key without list permission | Grant list and read; see S3 AccessDenied |
AccessDenied before the first copy to the destination |
rclone tries to check or create the bucket | --s3-no-check-bucket |
SignatureDoesNotMatch |
Wrong region, endpoint or secret, or a clock that's off | Review the remote's variables and sync the clock |
SlowDown, 503 or 429 |
The provider's request limit | Fewer --transfers and --checkers, or --tpslimit 10 |
| Large file rejected at the destination | Single upload above what the destination accepts | Lower --s3-upload-cutoff |
Cache-Control missing at the destination |
Copy without --metadata |
Run again with -M |
How to do this on Square Cloud#
To migrate to Square Cloud's Blob Storage, the destination remote uses RCLONE_CONFIG_DEST_ENDPOINT=https://s3-blob.squarecloud.app, RCLONE_CONFIG_DEST_REGION=auto and the S3 keys you derive from an API key in the "S3 access" tab of the dashboard. You don't create buckets: you write to two fixed buckets, public and private, so map each source bucket to a prefix, like dest:public/photos for what was open and dest:private/contracts for what should only open with a link. If rclone fails while checking or creating the bucket, add --s3-no-check-bucket.
Each file can be up to 10 GB, and multipart is required above 100 MB. rclone's default cutoff (200 MiB) is higher than that limit: if a file above 100 MB is rejected, lower --s3-upload-cutoff below 100 MB, for example --s3-upload-cutoff 64Mi. Objects over 10 GB at the source don't fit in Blob. S3 requests are rate-limited per plan: if rate-limit errors show up, lower --transfers and --checkers.
Blob charges no ingress fee, so the copy adds no transfer charge on the destination side: the migration's egress fee, if any, is the source provider's. After the switch, downloads pay no egress either. Every plan includes a storage quota: compare the source's rclone size with your plan's quota on Pricing. From Standard up, overage is optional, turned on in the dashboard's Usage page with the cap you choose; with it off, uploads above the quota are rejected. Explore Blob Storage.
Blob Storage
S3-compatible object storage with no egress fees
FAQs
What is the difference between rclone copy and rclone sync in a migration?
copy sends what is missing or changed and never deletes anything on the destination. sync makes the destination identical to the source and deletes whatever is left over there. Use copy for the copy rounds and sync only at the final cutover, always after a --dry-run.
Does rclone copy directly from one provider to the other?
No. rclone's documentation says server-side copies only happen when source and destination are the same remote. Between different providers, the data flows through the machine running the command, so its bandwidth sets the speed.
Does rclone keep Content-Type and Cache-Control?
By default, rclone only preserves the modification time and the MIME type, where possible. To copy other metadata, such as Cache-Control and Content-Disposition, add the -M (--metadata) flag.
Can I stop the migration and resume it later?
Yes. Running the same rclone copy again compares source and destination and sends only what is missing or changed. Files that already arrived intact are skipped.
More in Storage
See all 24 articles- What is a presigned (signed) URL?A presigned URL is a temporary link to a private file that works without login or credentials. See how it works, its limits and when to use it.
- What is object storage?Object storage keeps files as objects with a key and metadata, accessed over an HTTP API. See how it works, what it is for and where its limits are.
- What does 'S3-compatible' storage mean?S3 is Amazon's object storage and its API became the industry standard. Learn what S3-compatible means, what differs between providers, and how to connect.
- Uploading large files: multipart and resumable uploadsMultipart upload splits a large file into parts that are sent in parallel and retried on their own. See the Python walkthrough, how to resume, and common mistakes.