docs: translate README and documentation to English

Also document the snapshot cleanup: older round snapshots are removed
during sync, and `cephmig cleanup` removes the rest after the cutover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-12-03 19:55:45 +01:00
1 parent 907d400765
commit b7d2a0687e
6 files changed
+655 -628

No files matched your search

+112 -105
View File
@@ -1,99 +1,106 @@
# CephMig: CephFS-Subvolumes zwischen Ceph-Clustern migrieren
# CephMig: migrate CephFS subvolumes between Ceph clusters
Ein Go-Werkzeug, das ein CephFS-Subvolume samt Snapshots, POSIX-ACLs, xattrs,
Quotas und Zeitstempeln von einem Ceph-Cluster in einen anderen kopiert,
während die Anwendung weiterläuft.
A Go tool that copies a CephFS subvolume, including its snapshots, POSIX ACLs,
xattrs, quotas and timestamps, from one Ceph cluster to another while the
application keeps running.
## Beschreibung
## Description
**Warum?** Ein Subvolume soll mit kurzem Schreibstopp in einen neuen Cluster
umziehen. Die Zielgröße liegt bei bis zu 200 TB und mehr als 200 Millionen
Dateien. Ein einfaches Kopieren reicht dafür nicht: Snapshots, Hardlinks und
Ceph-Metadaten müssen erhalten bleiben, und ein abgebrochener Lauf muss sich
fortsetzen lassen.
**Why?** A subvolume has to move to a new cluster with only a short write
stop. The target size is up to 200 TB and more than 200 million files. A
plain copy is not enough: snapshots, hardlinks and Ceph metadata must be
preserved, and an interrupted run must be resumable.
**Wie?** CephMig arbeitet in Runden. Jede Runde überträgt einen konsistenten
Quellsnapshot, prüft das Ziel und legt dort einen gleichnamigen Snapshot an.
Ein Journal auf lokalem Datenträger hält jeden Schritt fest. Für den letzten
Abgleich werden alle Schreiber kurz angehalten.
**How?** CephMig works in rounds. Each round transfers a consistent source
snapshot, verifies the target and creates a snapshot of the same name there.
A journal on local disk records every step. For the last round, all writers
are stopped briefly.
Es gibt zwei Backends:
There are two backends:
- **native** (empfohlen): Der Kopierer spricht direkt über libcephfs mit
beiden Clustern. Er braucht weder rsync noch einen Kernel- oder FUSE-Mount.
Nach der Erstübertragung nutzt er Snapdiff und, wo möglich, Blockdiff.
- **rsync**: Er kopiert zwischen zwei gemounteten CephFS-Dateisystemen.
- **native** (recommended): the copier talks to both clusters directly
through libcephfs. It needs neither rsync nor a kernel or FUSE mount.
After the initial transfer it uses snapdiff and, where possible, blockdiff.
- **rsync**: copies between two mounted CephFS file systems.
**Status:** Prototyp. Die Funktionen sind im lokalen Labor geprüft.
Lastnachweise für die Zielgröße und die produktive Umschaltung fehlen noch.
**Status:** prototype. The features are verified in the local lab. Load
tests at the target size and a production cutover are still missing.
> **Dokumentierte Abweichungen:** Native Snapshot-IDs und Snapshot-Erstellungszeiten
> werden am Ziel neu vergeben. mtime, atime, ctime und Erstellungszeit (btime)
> der Dateien übernimmt das native Backend von der Quelle; die ctime nie
> kleiner als die mtime. Die ursprünglichen Snapshot-Erstellungszeiten stehen
> im Journal.
> **Documented deviations:** native snapshot IDs and snapshot creation times
> are assigned anew at the target. The native backend takes mtime, atime,
> ctime and birth time (btime) of every file from the source; the ctime is
> never lower than the mtime. The original snapshot creation times are kept
> in the journal.
> Details: [docs/migration.md](docs/migration.md).
## Installation
Voraussetzungen:
Requirements:
- Linux, Go ab 1.25 und GNU Make
- für das native Backend und die Laborumgebung: Docker Engine mit Docker
Compose sowie `/dev/fuse` auf dem Docker-Host
- für die Laborumgebung: bis zu 12 GiB RAM für Container und etwa 8 GiB
Speicherplatz für die zwei OSDs, dazu Platz für die Images
- Linux, Go 1.25 or later and GNU Make
- for the native backend and the lab: Docker Engine with Docker Compose and
`/dev/fuse` on the Docker host
- for the lab: up to 12 GiB RAM for the containers and about 8 GiB of disk
space for the two OSDs, plus space for the images
Quellcode holen und bauen:
Get the source and build it:
```sh
git clone ssh://git@git.zb-server.de:30022/Sebi/CephfsMig.git
cd CephfsMig
make doctor # prüft Go, Docker und Docker Compose
make build # erzeugt bin/cephmig (nur rsync-Backend)
make check # go vet, Go-Tests und Syntaxprüfung der Testskripte
make doctor # checks Go, Docker and Docker Compose
make build # builds bin/cephmig (rsync backend only)
make check # go vet, Go tests and a syntax check of the test scripts
```
Das native Backend braucht CGO und die libcephfs-Header. Es wird deshalb in
einem Container gebaut. Dabei laufen auch die Go-Tests mit Race Detector:
The native backend needs CGO and the libcephfs headers, so it is built in a
container. The build also runs the Go tests with the race detector:
```sh
make dev-native-build # erzeugt das Image cephmig-native:dev
make dev-native-build # builds the image cephmig-native:dev
```
## Verwendung
## Usage
```text
cephmig doctor
cephmig inspect --config FILE
cephmig sync --config FILE --state FILE
cephmig finalize --config FILE --state FILE --writers-stopped
cephmig cleanup --config FILE --state FILE
cephmig status --state FILE
```
| Kommando | Wirkung |
|------------|-------------------------------------------------------------------------|
| `inspect` | prüft Quelle und Ziel, ohne etwas zu ändern |
| `sync` | überträgt den aktuellen Stand; beliebig oft wiederholbar |
| `finalize` | letzter Abgleich nach dem Schreibstopp, danach bereit zur Umschaltung |
| `status` | gibt das Journal aus |
| Command | Effect |
|------------|----------------------------------------------------------------------|
| `inspect` | checks source and target without changing anything |
| `sync` | transfers the current state; can be repeated any number of times |
| `finalize` | last round after the write stop, then ready for cutover |
| `cleanup` | deletes the snapshots cephmig created, at source and target |
| `status` | prints the journal |
Alle Ergebnisse erscheinen als JSON auf der Standardausgabe. Die State-Datei
muss außerhalb der CephFS-Mounts liegen.
All results are written to standard output as JSON. The state file must be
outside the CephFS mounts.
Ablauf einer Migration:
Steps of a migration:
1. Mit `inspect` Quelle, Ziel, Berechtigungen und Kapazität prüfen.
2. Mit `sync` bei laufender Anwendung initial kopieren.
3. `sync` wiederholen, um Änderungen nachzuziehen.
4. Alle schreibenden Anwendungen anhalten, dann `finalize --writers-stopped`.
5. Clients auf das Ziel umstellen und Anwendungen freigeben.
1. Check source, target, permissions and capacity with `inspect`.
2. Make the initial copy with `sync` while the application keeps running.
3. Repeat `sync` to catch up with changes.
4. Stop all writing applications, then run `finalize --writers-stopped`.
5. Switch the clients to the target and release the applications.
6. Once the cutover is checked, remove the migration snapshots with `cleanup`.
Ein Dateisystemsnapshot macht eine Datenbank nicht anwendungskonsistent.
Der Schreibstopp muss alle Clients umfassen.
A file system snapshot does not make a database application-consistent. The
write stop must cover all clients.
Die Konfiguration ist eine JSON-Datei, hier
[dev/migration.example.json](dev/migration.example.json) aus dem Labor:
Each round creates a snapshot `cephmig-<job>-<round>` at source and target;
`sync` deletes the older ones as soon as a newer round is complete. Users of
the subvolume therefore see at most one such snapshot during the migration,
and none after `cleanup`. Application snapshots are never deleted.
The configuration is a JSON file, here
[dev/migration.example.json](dev/migration.example.json) from the lab:
```json
{
@@ -118,75 +125,75 @@ Die Konfiguration ist eine JSON-Datei, hier
}
```
Optional sind außerdem `user` (Ceph-Client-Identität, z. B. `client.migration`)
und `workers` (0 bis 64; 0 wählt den Standard). `mount` ist nur für das
rsync-Backend nötig: dort der Mount des Dateisystem-Wurzelverzeichnisses.
Optional fields are `user` (Ceph client identity, e.g. `client.migration`)
and `workers` (0 to 64; 0 selects the default). `mount` is only needed for
the rsync backend: the mount of the file system root.
## Beispiele
## Examples
Die Laborumgebung startet zwei unabhängige Ceph-Cluster (Ceph 21.2.0) in
Docker und führt die Migration darin aus:
The lab starts two independent Ceph clusters (Ceph 21.2.0) in Docker and runs
the migration between them:
```sh
make dev-up # Cluster starten
make dev-status # Zustand beider Cluster
make dev-smoke # Smoke-Test: Snapshot, ACLs, xattrs, Hardlinks, Quotas
make dev-native-test # nativer Funktionstest
make dev-up # start the clusters
make dev-status # state of both clusters
make dev-smoke # smoke test: snapshot, ACLs, xattrs, hardlinks, quotas
make dev-native-test # native functional test
docker compose -f dev/compose.yaml exec native cephmig-native inspect \
--config /lab/migration.example.json
make dev-down # stoppen; die Daten bleiben erhalten
make dev-down # stop; the data is kept
```
Weitere Tests:
More tests:
| Ziel | Inhalt |
|----------------------------|--------------------------------------------------------------|
| `make dev-migration-test` | Migration mit dem rsync-Backend |
| `make dev-smallfiles-test` | 10.000 kleine Dateien (`FILES=2000` begrenzt die Anzahl) |
| `make dev-million-start` | eine Million Dateien mit vier Snapshot-Ständen |
| `make dev-restart-check` | Neustart des Labors; FSIDs und Daten bleiben erhalten |
| Target | Content |
|----------------------------|-----------------------------------------------------------|
| `make dev-migration-test` | migration with the rsync backend |
| `make dev-smallfiles-test` | 10,000 small files (`FILES=2000` limits the number) |
| `make dev-million-start` | one million files with four snapshot states |
| `make dev-restart-check` | restart of the lab; FSIDs and data are preserved |
Ergebnisse dokumentierter Läufe: [docs/smallfiles-local.md](docs/smallfiles-local.md)
und [docs/million-local.md](docs/million-local.md).
Results of documented runs: [docs/smallfiles-local.md](docs/smallfiles-local.md)
and [docs/million-local.md](docs/million-local.md).
## Projektstruktur
## Project structure
```text
.
├── cmd/
│ ├── cephmig/ Kommandozeilenprogramm
│ └── nativeprobe/ Diagnosewerkzeug für die libcephfs-Anbindung
│ ├── cephmig/ command-line program
│ └── nativeprobe/ diagnostic tool for the libcephfs binding
├── internal/
│ ├── migration/ Migrationsablauf, Journal, rsync- und native Übertragung
│ ├── storage/ Dateisystem-Schnittstelle des nativen Kopierers
│ └── cephfsnative/ CGO-Anbindung an libcephfs (Build-Tag ceph)
├── dev/ Laborumgebung: Compose-Dateien, Dockerfiles, Testskripte
├── docs/ Ausführliche Dokumentation und Messergebnisse
└── Makefile Build-, Prüf- und Laborziele
│ ├── migration/ migration workflow, journal, rsync and native transfer
│ ├── storage/ file system interface of the native copier
│ └── cephfsnative/ CGO binding to libcephfs (build tag ceph)
├── dev/ lab: Compose files, Dockerfiles, test scripts
├── docs/ detailed documentation and measurements
└── Makefile build, check and lab targets
```
## Dokumentation
## Documentation
- [docs/migration.md](docs/migration.md): Kommandos, Grenzen und Nachweise
- [docs/lab.md](docs/lab.md): Laborumgebung im Detail, Ceph-Version, bekannte Warnungen
- [docs/raw-transfer.md](docs/raw-transfer.md): direkter RADOS-Import und Grenzen der nativen Implementierung
- API-Dokumentation der Go-Pakete: `go doc -all ./internal/migration`
- [docs/migration.md](docs/migration.md): commands, limits and evidence
- [docs/lab.md](docs/lab.md): the lab in detail, Ceph version, known warnings
- [docs/raw-transfer.md](docs/raw-transfer.md): direct RADOS import and limits of the native implementation
- API documentation of the Go packages: `go doc -all ./internal/migration`
## Mitwirken
## Contributing
- Go-Code folgt [Effective Go](https://go.dev/doc/effective_go) und ist mit
`gofmt` formatiert. Exportierte Bezeichner haben Doc-Kommentare.
- Vor jedem Commit `make check` ausführen.
- Commit-Nachrichten folgen [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/),
zum Beispiel `feat(migration): add bandwidth limit` oder
`fix(native): retry on EEXIST`. Inkompatible Änderungen werden mit `!`
und einem `BREAKING CHANGE:`-Footer gekennzeichnet.
- Go code follows [Effective Go](https://go.dev/doc/effective_go) and is
formatted with `gofmt`. Exported identifiers have doc comments.
- Run `make check` before every commit.
- Commit messages follow [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/),
for example `feat(migration): add bandwidth limit` or
`fix(native): retry on EEXIST`. Breaking changes are marked with `!` and a
`BREAKING CHANGE:` footer.
## Lizenz
## License
Bisher ist keine Lizenz festgelegt. Ohne Lizenz gilt: alle Rechte vorbehalten.
No license has been chosen yet. Without a license, all rights are reserved.
## Kontakt
## Contact
Sebastian Unterschütz. Fragen und Fehlermeldungen bitte als Issue im
Repository [Sebi/CephfsMig](https://git.zb-server.de/Sebi/CephfsMig).
Sebastian Unterschütz. Please report questions and bugs as issues in the
repository [Sebi/CephfsMig](https://git.zb-server.de/Sebi/CephfsMig).