# java.io.IOException: No space left on device while writing to log segment /var/lib/kafka/data/my_topic-0/00000000000000000000.log

- **ID:** `kafka/disk-full-log-segment`
- **Domain:** kafka
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

Kafka broker's data directory has run out of disk space, preventing log segment writes and causing broker to become unhealthy.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Kafka 3.5.0 | active | — | — |
| Kafka 3.6.1 | active | — | — |

## Workarounds

1. **Run `df -h /var/lib/kafka/data` to confirm disk usage, then add more disk space or move data to a larger partition. Use `log.dirs=/data/kafka` in server.properties to point to a new location.** (95% success)
   ```
   Run `df -h /var/lib/kafka/data` to confirm disk usage, then add more disk space or move data to a larger partition. Use `log.dirs=/data/kafka` in server.properties to point to a new location.
   ```
2. **Trigger log compaction or deletion by reducing `log.retention.hours=24` or `log.retention.bytes=10737418240` (10GB) and restart broker gracefully.** (85% success)
   ```
   Trigger log compaction or deletion by reducing `log.retention.hours=24` or `log.retention.bytes=10737418240` (10GB) and restart broker gracefully.
   ```
3. **Example: `kafka-configs.sh --bootstrap-server localhost:9092 --entity-type topics --entity-name my_topic --alter --add-config retention.ms=86400000` to reduce retention to 24 hours.** (90% success)
   ```
   Example: `kafka-configs.sh --bootstrap-server localhost:9092 --entity-type topics --entity-name my_topic --alter --add-config retention.ms=86400000` to reduce retention to 24 hours.
   ```

## Dead Ends

- **** — Kafka manages segments internally; manual deletion breaks consistency. (95% fail)
- **** — It may trigger aggressive cleanup but does not free space immediately if cleanup policy is not triggered. (60% fail)
