Browse docs
Docs / Guides / Migrating Existing Data
View as Markdown

Migrating Existing Data

On this page

swarmfile-migrate is a standalone CLI for bulk-importing data you already have into a Swarmfile repository - a NAS share, a flat list of file paths, or an S3-compatible bucket. Use it the first time you bring an existing archive onto Swarmfile, rather than dragging everything through your mounted drive by hand: it talks to the hub directly rather than through a mount, uploads files concurrently, and resumes from a local state database if the run is interrupted.

Bringing a git repository rather than a file tree? Use swarmfile git import instead - it carries the commit history, branches and tags. swarmfile-migrate moves files, not version-control history.

Looking for something narrower? swarmfile-seed places a single file at a repository path, and swarmfile-mirror copies a whole repository from one hub to another - both run the same pipeline with no engine.

No Desktop App on the machine - a build server, a container, a machine you don't administer? The migrator is also published as a standalone open-source build (API-key auth, no OIDC) at swarmfile-migrate, installed with curl -fsSL https://get.swarmfile.com/migrate | sh. It runs the same upload pipeline and verification, but it is a separate tool with its own flags, so the examples on this page are written for the desktop build:

Desktop build (installed with the app)Standalone build
Target--hub-url and --repository-id (falling back to SWARMFILE_HUB_URL / SWARMFILE_REPOSITORY_ID), --org-id--hub-url, --org-id, --repository-id, all required
CredentialSWARMFILE_API_KEY from the environment, or the --oidc-* flags--token (defaults to SWARMFILE_API_KEY)
Resume state--state-db, default <source>/.swarmfile-migration/migrate.db--state-path, default ./.swarmfile-migrate-<repository-id>.sqlite
Only in this build--dry-run, --report-json, --exclude-from--ec (erasure coding; the desktop build turns it on with SWARMFILE_EC_ENABLED=on instead)

Both builds share --source, --source-list, the S3 source flags, --exclude, --retry, --verify, --force and --start-at. The state file format is the same, so to resume a run in the other build, pass the state file explicitly (--state-db on one side, --state-path on the other).

This page is a practical walkthrough. swarmfile-migrate is installed on PATH with the desktop app on every platform. For the complete flag reference, see swarmfile-migrate.

A realistic example#

Importing a local repository directory, skipping cache and scratch files:

swarmfile-migrate --source /Volumes/nas/RepositoryArchive \
  --hub-url https://hub.swarmfile.com \
  --org-id acme-films --repository-id feature-01 \
  --exclude "*.cache" --exclude "**/tmp/**"

This walks the source directory, applies the gitignore-style exclude patterns to skip anything you don't want copied, and uploads the rest into the target repository.

What to expect while it runs#

Migrate reports progress as it goes and retries failed transfers automatically, with backoff, up to 3 attempts by default (--retry) - a dropped connection partway through a large file doesn't fail the whole run, it retries that transfer. If the process itself is interrupted (you kill it, the machine sleeps, the network drops entirely), it's safe to just run the same command again - a file that had exhausted its retries in the earlier run is still eligible on the next invocation.

Resume#

Migrate keeps a local state database tracking what's already been uploaded. On a second run with the same source and target, it picks up where it left off instead of re-uploading everything from scratch. You don't need a separate --resume step or flag - re-running the same invocation is the resume mechanism.

Verification#

After each file uploads, migrate checks its content against the source - a CID/hash comparison - so a successful run means the data landed intact, not just that bytes were sent. This is on by default; pass --verify=false to skip it if you trust the transport and want to roughly halve I/O on a very large migration. Migrate can also produce a JSON report of the run, which is the artifact to keep if you need to audit exactly what was migrated, skipped, or retried.

Something wrong or missing? Report a docs issue.