n8n stores binary data (file attachments, images, API response bodies) on the filesystem by default, under the `/home/node/.n8n` volume.
n8n stores binary data (file attachments, images, API response bodies) on the filesystem by default, under the /home/node/.n8n volume. Workflows that process files -- such as email attachment handlers, PDF generators, or image pipelines -- can consume gigabytes of disk space per day. Without monitoring, the disk fills up, PostgreSQL crashes (it needs disk for WAL files), and n8n stops functioning.
Real-world example: You set up a disk space alert that fires when usage exceeds 80%, giving you time to clean up or expand storage before a crisis.
#!/usr/bin/env bash
set -euo pipefail
THRESHOLD=80
SLACK_WEBHOOK_URL="${SLACK_WEBHOOK_URL}"
HOSTNAME=$(hostname)
# Check disk usage for the n8n data volume mount point
USAGE=$(df /var/lib/docker/volumes | tail -1 | awk '{print $5}' | tr -d '%')
if [ "${USAGE}" -ge "${THRESHOLD}" ]; then
DISK_INFO=$(df -h /var/lib/docker/volumes | tail -1)
curl -s -X POST "${SLACK_WEBHOOK_URL}" \
-H 'Content-Type: application/json' \
-d "{
\"text\": \"DISK ALERT on ${HOSTNAME}: Docker volume storage is at ${USAGE}% capacity.\n\`\`\`${DISK_INFO}\`\`\`\nAction required: prune old executions or expand storage.\"
}"
fi
```text
```cron title="crontab -e"
# Check disk space every 15 minutes
*/15 * * * * /opt/scripts/disk-monitor.sh
```text
Configure n8n to automatically prune old execution data to slow disk growth:
```yaml title="docker-compose.yml (excerpt)"
services:
n8n:
environment:
# Prune execution data older than 7 days
EXECUTIONS_DATA_PRUNE: "true"
EXECUTIONS_DATA_MAX_AGE: 168 # hours
# Store binary data in the database instead of filesystem (optional)
# This consolidates storage but increases database size
# N8N_BINARY_DATA_MODE: default
```text
> **Tip: Binary Data in S3**
>
> For high-volume workflows, configure n8n to store binary data in S3 instead of the local filesystem. Set `N8N_BINARY_DATA_MODE=s3` along with the appropriate S3 credentials. This moves the storage growth problem to S3, which scales automatically.
Monitoring disk space with automated alerts prevents the single most common cause of unplanned n8n outages on self-hosted instances.
**Related:** [Set a Unique Encryption Key and Back It Up](../security-best-practices/01-set-a-unique-encryption-key-and-back-it-up.md) | [Configure Payload Size and Binary Data Mode for Large Files](../performance-and-large-files/01-configure-payload-size-and-binary-data-mode-for-large-files.md)
I build production n8n and Cloudflare automation for teams — the same engineering behind HarperFlow. Fixed-price, escrow-protected, US-based.