claude-home/networking/examples/network-filesystem-limitations.md
Cal Corum 10c9e0d854 CLAUDE: Migrate to technology-first documentation architecture
Complete restructure from patterns/examples/reference to technology-focused directories:

• Created technology-specific directories with comprehensive documentation:
  - /tdarr/ - Transcoding automation with gaming-aware scheduling
  - /docker/ - Container management with GPU acceleration patterns
  - /vm-management/ - Virtual machine automation and cloud-init
  - /networking/ - SSH infrastructure, reverse proxy, and security
  - /monitoring/ - System health checks and Discord notifications
  - /databases/ - Database patterns and troubleshooting
  - /development/ - Programming language patterns (bash, nodejs, python, vuejs)

• Enhanced CLAUDE.md with intelligent context loading:
  - Technology-first loading rules for automatic context provision
  - Troubleshooting keyword triggers for emergency scenarios
  - Documentation maintenance protocols with automated reminders
  - Context window management for optimal documentation updates

• Preserved valuable content from .claude/tmp/:
  - SSH security improvements and server inventory
  - Tdarr CIFS troubleshooting and Docker iptables solutions
  - Operational scripts with proper technology classification

• Benefits achieved:
  - Self-contained technology directories with complete context
  - Automatic loading of relevant documentation based on keywords
  - Emergency-ready troubleshooting with comprehensive guides
  - Scalable structure for future technology additions
  - Eliminated context bloat through targeted loading

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-12 23:20:15 -05:00

2.2 KiB

Network Filesystem Limitations

SQLite on Network Filesystems

The Problem

SQLite's WAL (Write-Ahead Logging) mode requires proper file locking that many network filesystems don't support:

[ERROR] Tdarr_Server - Error: SQLITE_BUSY: database is locked
[ERROR] Tdarr_Server - {
  "func": "run", 
  "query": "PRAGMA journal_mode = WAL"
}

Affected Filesystems

  • NFS - Inconsistent locking behavior
  • SMB/CIFS - Limited locking support
  • sshfs - No proper locking
  • Local ext4/xfs/btrfs - Full locking support

Solutions

Hybrid Storage Pattern

volumes:
  # Database: Local storage
  - ./tdarr/server:/app/server
  
  # Backups: Network storage  
  - /mnt/nas/tdarr/backups:/app/server/Tdarr/Backups
  
  # Media: Network storage (read-mostly)
  - /mnt/nas/media:/media

Application-Specific Fixes

# Force SQLite to use different journal mode
environment:
  - SQLITE_JOURNAL_MODE=DELETE  # Less efficient but compatible

Performance Considerations

Local vs Network Storage

Operation Local SSD Gigabit NFS 10Gb NFS
Database writes <1ms 10-50ms 2-10ms
Config reads <1ms 5-15ms 1-5ms
Large file reads 500MB/s 100MB/s 800MB/s

When to Use Network Storage

  • Large static files (media, backups)
  • Shared access between multiple services
  • Centralized backups
  • Frequent small writes (databases, logs)
  • Applications requiring file locking

Troubleshooting

Symptoms of Network FS Issues

  • Database locked errors
  • Slow application startup
  • Intermittent connection failures
  • File corruption on network interruption

Diagnostic Commands

# Test file locking
flock /mnt/nas/test.lock -c "sleep 5" &
flock /mnt/nas/test.lock -c "echo success"

# Monitor network filesystem performance
iotop -ao
iostat -x 1

# Check mount options
mount | grep nfs
cat /proc/mounts | grep cifs

Mount Optimization

# NFS optimizations
mount -t nfs -o rw,hard,intr,rsize=8192,wsize=8192,timeo=14 \
  server:/path /mnt/point

# CIFS optimizations  
mount -t cifs //server/share /mnt/point \
  -o username=user,cache=loose,file_mode=0644,dir_mode=0755