Back up Apache Kafka to a filesystem
Write compressed topic data, consumer group offsets, and topic configuration to a local or mounted path. Restore into any reachable Kafka cluster at a precise moment in time.
Kafka backup to filesystem storage
Kafka backup to filesystem storage is the shortest path from a Kafka cluster to a recovery copy. Set a writable path, select your topics, and run the same backup and restore commands used with cloud storage.
The path can sit on local disk or a mounted volume. Its recovery value depends on that mount. A directory on the Kafka broker's own disk shares the broker's failure boundary. A separate volume, file server, or removable transfer stage can isolate the copy, subject to that system's durability and access controls.
OSO Kafka Backup compresses topic records with Zstd or LZ4. It also preserves consumer group offsets and topic configuration. The storage format reference describes the files written under the configured path.
Filesystem backup and restore configuration
Set storage.backend to filesystem and provide storage.path. An optional prefix keeps
clusters or environments in separate subdirectories.
- Back up
- Restore
- Run it
mode: backup
backup_id: "filesystem-daily"
source:
bootstrap_servers:
- kafka-1.internal:9092
- kafka-2.internal:9092
topics:
include:
- "*"
exclude:
- "__consumer_offsets"
storage:
backend: filesystem
path: /mnt/kafka-backups
prefix: production
backup:
compression: zstd
compression_level: 5
include_offset_headers: true
mode: restore
backup_id: "filesystem-daily"
target:
bootstrap_servers:
- kafka-dr-1.internal:9092
storage:
backend: filesystem
path: /mnt/kafka-backups
prefix: production
restore:
# Restore through the moment before the incident (Unix ms)
time_window_end: 1784160000000
consumer_group_strategy: header-based
reset_consumer_offsets: true
kafka-backup backup --config backup.yaml
kafka-backup restore --config restore.yaml
Choose the right filesystem boundary
| Filesystem location | Good fit | Recovery consideration |
|---|---|---|
| Developer workstation | Local tests and restore practice | The copy disappears with the workstation unless moved elsewhere. |
| Dedicated mounted volume | Fast backups inside one site | Verify snapshots, permissions, capacity, and host remount behavior. |
| Network filesystem | Shared access from scheduled jobs | Test throughput, locking behavior, outages, and restore performance. |
| Removable or transferred copy | Controlled offline handoff | Define encryption, custody, and a tested return path. |
Start with the first backup guide for a local test. For a recovery design, keep the backup path away from broker data and test a full restore on a schedule.
Frequently asked questions
How do I back up Kafka to a filesystem?
Set storage.backend to filesystem, provide a writable storage.path, select the source topics, and run kafka-backup backup with the configuration file.
Can the filesystem path be a mounted network volume?
Yes. OSO Kafka Backup writes through the filesystem path exposed to the process. Validate the mount permissions, throughput, outage behavior, and restore performance before using it for recovery.
Is local filesystem storage safe for Kafka disaster recovery?
Only when the path survives the incident you are planning for. A directory on a broker or the same host is useful for testing but does not protect against loss of that machine.
Can I restore a filesystem backup into another Kafka cluster?
Yes. Make the backup path available to the restore process and point the target configuration at any reachable Kafka cluster. Restore can stop at a millisecond timestamp and preserve consumer offsets.
Ready to protect your Kafka data?
Take your first backup in minutes with the open source CLI, or talk to us about Enterprise features like encryption, RBAC, and audit logging.