Post

Complete 5Tb Portable Media Server

Complete 5Tb Portable Media Server

Complete 5Tb Portable Media Server: A DevOps Engineer’s Homelab Guide

Introduction

The challenge of maintaining portable, high-capacity media access persists as a critical infrastructure problem for DevOps professionals and homelab enthusiasts. While cloud storage dominates enterprise solutions, there’s growing demand for self-hosted alternatives that provide:

  1. Complete data ownership
  2. Offline access capabilities
  3. Customizable streaming workflows
  4. Cost-effective long-term storage

This guide dissects a real-world 5TB portable media server built on Raspberry Pi 4 hardware—a solution that bridges enterprise-grade DevOps practices with homelab affordability. We’ll explore how to implement:

  • Dual-network WiFi architecture for isolated administration/streaming
  • Battery-backed portable operation
  • Enterprise-grade data synchronization
  • Containerized media services (Jellyfin/Kodi integration)

For system administrators managing remote teams or DevOps engineers building field-deployable solutions, this implementation demonstrates how open-source technologies can create robust portable infrastructure without commercial NAS constraints.

Understanding Portable Media Server Architectures

Core Components Breakdown

The referenced Reddit implementation combines several critical infrastructure elements:

Hardware Stack

1
2
3
4
5
Raspberry Pi 4 (2GB) → ARMv8 Cortex-A72 (quad-core 1.5GHz)
Geekworm NASPi-Lite case → Modified for 15mm 2.5" HDD
5TB Seagate BarraCuda HDD → 5400 RPM SATA III
20000mAh battery pack → ~10-hour runtime
Dual USB WiFi adapters → STA + AP mode isolation

Network Architecture

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
                   ┌─────────────┐
                   │ Guest WiFi  │← Internet Access
                   └─────────────┘
                         ↓
                    [eth0/wlan0] 
                         │
                  ┌──────┴──────┐
                  │ Raspberry Pi│
                  └──────┬──────┘
                         │
                   [wlan1 AP Mode]
                         ↓
                   ┌─────────────┐
                   │ Local Devices│← Streaming/Admin
                   └─────────────┘

Technical Tradeoffs Analysis

Advantages

  • Cost Efficiency: $150-$200 total vs $500+ commercial NAS
  • Energy Consumption: 5W active vs 30W+ x86 solutions
  • Physical Portability: 300g total weight
  • Service Isolation: Dedicated admin/streaming networks

Limitations

  • ARM Architecture: Limited to ARM-compatible containers
  • USB 3.0 Bandwidth: Theoretical 5Gbps (real-world ~250MB/s)
  • Single Drive Reliability: No hardware RAID protection

Enterprise vs Homelab Use Cases

Enterprise Field Ops

  • On-site media distribution for training teams
  • Offline documentation servers
  • Temporary CI/CD artifact caching

Homelab Applications

  • Family media library synchronization
  • Travel entertainment system
  • Local network backup target

Prerequisites

Hardware Requirements

ComponentSpecificationNotes
SBCRaspberry Pi 4 2GB+4GB recommended for containers
Storage2.5” 5TB HDD15mm height compatible
Power20000mAh PD batteryUSB-C Power Delivery 3.0
NetworkingDual USB 3.0 WiFiSTA + AP mode support
CoolingActive heatsinkGeekworm X825 case recommended

Software Requirements

  1. Base OS: Raspberry Pi OS Lite (64-bit)
    1
    2
    
    # Verify architecture
    uname -a # Should show aarch64
    
  2. Docker Engine: v24.0+ with Compose plugin
    1
    2
    3
    
    # Installation command
    curl -sSL https://get.docker.com | sh
    sudo usermod -aG docker $USER
    
  3. Storage Tools:
    • parted v3.4+
    • btrfs-progs v6.2+
    • smartmontools v7.3+
  4. Network Packages:
    1
    
    hostapd dnsmasq iptables-persistent
    

Security Preconfiguration

  1. SSH Hardening:
    1
    2
    3
    4
    
    # /etc/ssh/sshd_config
    PermitRootLogin no
    PasswordAuthentication no
    AllowUsers mediaadmin
    
  2. Firewall Baseline:
    1
    2
    
    sudo iptables -A INPUT -i wlan1 -p tcp --dport 22 -j DROP
    sudo netfilter-persistent save
    

Installation & Setup

Storage Configuration

1. HDD Partitioning

1
2
3
4
sudo parted /dev/sda --align optimal
(parted) mklabel gpt
(parted) mkpart primary btrfs 0% 100%
(parted) quit

2. BTRFS Filesystem

1
2
sudo mkfs.btrfs -L media-5tb /dev/sda1
sudo blkid /dev/sda1 # Copy UUID

3. Persistent Mount

1
2
# /etc/fstab entry
UUID=xxxx-xxxx-xxxx /media/5tb btrfs defaults,noatime,compress=zstd:3 0 2

Dual WiFi Configuration

wlan0 (Client Mode)

1
2
3
4
5
6
# /etc/wpa_supplicant/wpa_supplicant.conf
network={
    ssid="GuestNetwork"
    key_mgmt=WPA-PSK
    psk="password"
}

wlan1 (AP Mode)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# /etc/hostapd/hostapd.conf
interface=wlan1
driver=nl80211
ssid=MediaServer-AP
hw_mode=g
channel=6
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=StrongPassword
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Docker Media Stack

docker-compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
version: '3.8'

services:
  jellyfin:
    image: jellyfin/jellyfin:10.8.13
    container_name: jellyfin
    user: "1000:1000"
    volumes:
      - /media/5tb/jellyfin/config:/config
      - /media/5tb/media:/media
    ports:
      - 8096:8096
    devices:
      - /dev/vchiq:/dev/vchiq # Raspberry Pi GPU
    restart: unless-stopped
    environment:
      - JELLYFIN_PublishedServerUrl=http://192.168.50.1:8096

  syncthing:
    image: syncthing/syncthing:1.27.3
    container_name: syncthing
    volumes:
      - /media/5tb/syncthing:/var/syncthing
    ports:
      - 8384:8384
      - 22000:22000/tcp
      - 22000:22000/udp
    restart: unless-stopped

GPU Acceleration

1
2
# Verify hardware decode support
vcgencmd codec_enabled H264

Configuration & Optimization

Network Performance Tuning

1. WiFi Regulatory Domain

1
2
# /etc/default/crda
REGDOMAIN=US

2. TCP Buffer Sizes

1
2
3
# /etc/sysctl.conf
net.core.rmem_max=4194304
net.core.wmem_max=4194304

Storage Optimization

BTRFS Compression

1
2
# Remount with advanced compression
sudo mount -o remount,compress=zstd:15 /media/5tb

Disk Scheduler

1
2
# /etc/udev/rules.d/60-iosched.rules
ACTION=="add|change", KERNEL=="sda", ATTR{queue/scheduler}="bfq"

Security Hardening

Container Isolation

1
2
docker update --restart=on-failure:3 $CONTAINER_ID
docker run --security-opt no-new-privileges jellyfin

VPN Integration (WireGuard)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# docker-compose addition
  wireguard:
    image: linuxserver/wireguard:1.0.0
    cap_add:
      - NET_ADMIN
    environment:
      - PUID=1000
      - PGID=1000
    volumes:
      - /media/5tb/wireguard:/config
    ports:
      - 51820:51820/udp
    sysctls:
      - net.ipv4.conf.all.src_valid_mark=1

Usage & Operations

Media Synchronization Workflow

Syncthing CLI Management

1
2
3
4
5
# Add remote device
syncthing cli config devices add --device-id ABA8NML-7Z... --name primary-server

# Folder sharing
syncthing cli config folders add --id media --path /media/5tb/media --device AB8NML-7Z...

Streaming Performance Metrics

Real-time Monitoring

1
2
# Jellyfin hardware stats
docker exec jellyfin jellyfin --datadir /config --ffmpeg /usr/lib/jellyfin-ffmpeg/ffmpeg

Battery Management

Runtime Estimation

1
2
3
4
5
6
# Calculate power draw
vcgencmd measure_volts
vcgencmd measure_clock arm

# Runtime calculation
echo "scale=2; 20000 / ( (5 * 0.8) + 0.5 )" | bc # ≈9.5 hours

Troubleshooting

Common Issues Matrix

SymptomDiagnostic CommandSolution
WiFi AP not startingjournalctl -u hostapdCheck regulatory domain
HDD not mountingsudo btrfs check /dev/sda1Repair filesystem
Jellyfin HW decode failurevainfoEnable GPU in /boot/config.txt
Sync conflictssyncthing cli config rescanForce resync

Performance Diagnostics

I/O Bottleneck Identification

1
2
iotop -oP
btrfs filesystem usage /media/5tb

Network Throughput Test

1
iperf3 -c 192.168.50.1 -p 5201 -R

Conclusion

This 5TB portable media server implementation demonstrates how DevOps principles apply to homelab scenarios:

  1. Infrastructure as Code: Docker Compose for service management
  2. Automated Recovery: Systemd service hardening
  3. Security Isolation: Dual-network architecture
  4. Monitoring: Embedded performance metrics

For advanced implementations, consider:

Key maintenance practices:

  • Monthly BTRFS scrubs: sudo btrfs scrub start /media/5tb
  • Quarterly SMART tests: sudo smartctl -t long /dev/sda
  • Biannual OS updates: sudo apt full-upgrade

This solution proves that enterprise-grade media infrastructure can be portable, cost-effective, and entirely self-hosted—a perfect case study in practical DevOps application.

This post is licensed under CC BY 4.0 by the author.