Made A Companion Cube Nasserver
Made A Companion Cube Nasserver: The DevOps Guide to Creative Homelab Storage
Introduction
In the world of homelab enthusiasts and DevOps professionals, storage solutions often prioritize function over form - until now. The recent viral Reddit post showcasing a Companion Cube-themed NAS server demonstrates how creative engineering can merge aesthetic appeal with serious storage infrastructure. This 3D-printed Portal-inspired build represents more than just a fun project - it encapsulates the growing trend of customized self-hosted storage solutions that balance technical requirements with personal expression.
For DevOps engineers and sysadmins, this project raises important questions:
- How do you implement enterprise-grade storage practices in unconventional hardware?
- What are the tradeoffs between creative enclosures and thermal/performance requirements?
- Can hobbyist projects teach us lessons applicable to production environments?
In this comprehensive guide, we’ll analyze this unique NAS build through a professional DevOps lens, covering:
- Enterprise storage principles applied to homelab environments
- Performance optimization in constrained spaces
- Secure NAS configuration best practices
- Creative solutions for thermal management
- Cost-effective hardware selection strategies
Whether you’re building a Portal-themed showpiece or optimizing enterprise storage arrays, these principles form the foundation of reliable data management.
Understanding NAS Fundamentals
What is Network Attached Storage?
A NAS (Network Attached Storage) device is a dedicated file storage system that provides shared storage to network clients through standard protocols like NFS, SMB, or iSCSI. Unlike general-purpose servers, NAS devices are optimized for:
- High availability storage
- Data redundancy through RAID configurations
- Efficient network throughput
- Centralized access control
Evolution of NAS Technology
From early file servers to modern hyperconverged systems, NAS technology has evolved through several key phases:
Era | Characteristics | Typical Use Cases |
---|---|---|
1990s | Proprietary hardware, limited protocols | Enterprise file sharing |
2000s | Standardized protocols (CIFS/NFS), RAID adoption | SMB storage, media servers |
2010s | ZFS/BTRFS integration, SSD caching | Virtualization storage, backups |
2020s | NVMe adoption, hyperconvergence, S3-compatible | AI/ML workloads, container storage |
Key NAS Components Analysis
The Companion Cube build demonstrates thoughtful component selection balancing performance and space constraints:
| Component | Selection | Rationale | |—————–|—————–|————————————-| | CPU | AMD Ryzen 5 8500G | 6-core Zen4 with RDNA3 graphics | | Storage | (Not specified) | Likely 2.5” SSDs for space savings | | Networking | 2.5GbE | Balance between speed and cost | | OS | Likely Linux | Common for DIY NAS builds | | Enclosure | 3D-printed | Custom design for aesthetic/space |
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
29
30
31
32
33
34
35
36
37
38
**Why This Matters for DevOps:**
- Space-constrained builds require careful thermal planning
- Consumer-grade components can deliver enterprise-like capabilities
- Custom enclosures demand unconventional cooling solutions
## Prerequisites for DIY NAS Builds
### Hardware Requirements
For a stable NAS implementation, consider these minimum specifications:
**Base Requirements:**
- Quad-core CPU (Intel i3+/Ryzen 3+)
- 8GB ECC RAM (16GB recommended for ZFS)
- Dual Gigabit Ethernet (2.5GbE ideal)
- RAID controller (HW or SW)
- UPS with USB monitoring
**Companion Cube Considerations:**
- Small form factor components
- Low-profile cooling solutions
- Power-efficient components
- Vibration-dampened mounts
### Software Requirements
- **OS:** TrueNAS Scale, OpenMediaVault, or Ubuntu Server LTS
- **Filesystem:** ZFS (recommended) or BTRFS
- **Management:** Cockpit, Webmin, or CLI tools
- **Backup:** Borgmatic, Restic, or Duplicati
### Network Considerations
```bash
# Recommended network configuration for NAS:
auto enp3s0
iface enp3s0 inet static
address 192.168.1.10/24
gateway 192.168.1.1
mtu 9000 # Jumbo frames if supported
Security Fundamentals:
- Separate storage VLAN
- VPN access only for remote administration
- Certificate-based authentication
- Regular vulnerability scans
Installation & Configuration Walkthrough
Base OS Installation
For this example, we’ll use Ubuntu Server 22.04 LTS:
1
2
3
4
5
6
7
8
9
10
# Download Ubuntu Server
wget https://releases.ubuntu.com/22.04.4/ubuntu-22.04.4-live-server-amd64.iso
# Create bootable USB (Linux)
sudo dd if=ubuntu-22.04.4-live-server-amd64.iso of=/dev/sdX bs=4M status=progress
# Installation choices:
# - Filesystem: ZFS (RAIDZ if multiple disks)
# - Packages: OpenSSH server, standard system utilities
# - User: Disable root login, SSH key authentication only
ZFS Pool Configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
# Identify disks
lsblk -o NAME,SIZE,MODEL,TRAN
# Create RAIDZ pool (4 disks example)
sudo zpool create -o ashift=12 tank raidz \
/dev/disk/by-id/ata-Crucial_CT1000MX500SSD1_XXXX \
/dev/disk/by-id/ata-Crucial_CT1000MX500SSD1_XXXX \
/dev/disk/by-id/ata-Crucial_CT1000MX500SSD1_XXXX \
/dev/disk/by-id/ata-Crucial_CT1000MX500SSD1_XXXX
# Enable compression and set mountpoint
sudo zfs set compression=lz4 tank
sudo zfs set mountpoint=/srv/nas tank
SMB Share Configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Install Samba
sudo apt install samba samba-common-bin
# Configure smb.conf
cat << EOF | sudo tee -a /etc/samba/smb.conf
[companion-storage]
path = /srv/nas
browsable = yes
writable = yes
valid users = @nasusers
force create mode = 0660
force directory mode = 2770
EOF
# Create user group
sudo groupadd nasusers
sudo usermod -aG nasusers $USER
# Set Samba password
sudo smbpasswd -a $USER
# Restart services
sudo systemctl restart smbd nmbd
Thermal Management in Constrained Spaces
The Companion Cube’s 3D-printed enclosure requires special thermal considerations:
Optimization Strategies:
- Positive Pressure Design: Intake fans exceed exhaust capacity
- Channeled Airflow: Guide air directly over hot components
- Thermal Monitoring: Implement temperature-triggered alerts
1
2
3
4
5
6
7
8
9
# Install lm-sensors
sudo apt install lm-sensors
# Configure monitoring
sudo sensors-detect
sudo service kmod start
# Create temperature alert
sudo nano /usr/local/bin/temp-alert.sh
1
2
3
4
5
6
7
#!/bin/bash
CRIT_TEMP=70
CURRENT_TEMP=$(sensors | grep 'Package id' | awk '{print $4}' | cut -c2-3)
if [ $CURRENT_TEMP -ge $CRIT_TEMP ]; then
echo "CRITICAL: CPU temperature $CURRENT_TEMP°C" | mail -s "NAS Overheat Alert" admin@example.com
fi
1
2
# Add cron job
(crontab -l ; echo "*/5 * * * * /usr/local/bin/temp-alert.sh") | crontab -
Advanced Configuration & Optimization
Performance Tuning
ZFS-Specific Optimizations:
1
2
3
4
5
6
7
8
9
10
# Adjust ARC size (60% of RAM)
sudo nano /etc/modprobe.d/zfs.conf
options zfs zfs_arc_max=12884901888 # 12GB for 16GB system
# Enable prefetch
sudo zfs set prefetch=on tank
# SSD optimization
sudo zfs set primarycache=all tank
sudo zfs set secondarycache=all tank
Network Tuning:
1
2
3
4
5
6
7
8
9
10
11
# Increase SMB protocol version
sudo nano /etc/samba/smb.conf
server max protocol = SMB3_11
server multi channel support = yes
# Optimize TCP stack
sudo nano /etc/sysctl.conf
net.core.rmem_max=16777216
net.core.wmem_max=16777216
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216
Security Hardening
Essential Security Measures:
- RBAC Implementation:
1 2 3
sudo apt install libpam-ssh-agent-auth sudo nano /etc/security/access.conf - : ALL EXCEPT root (admin) nasusers : ALL
- Encrypted Datasets:
1 2 3
sudo zfs create -o encryption=aes-256-gcm \ -o keyformat=passphrase \ tank/secure-data
- Automated Updates:
1 2
sudo apt install unattended-upgrades sudo dpkg-reconfigure -plow unattended-upgrades
Containerized Services
For application hosting while maintaining storage isolation:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Create podman-compose.yml
version: '3'
services:
nextcloud:
image: docker.io/nextcloud:latest
container_name: nextcloud
volumes:
- /srv/nas/nextcloud:/var/www/html
networks:
- nas-net
environment:
- POSTGRES_HOST=db
- POSTGRES_DB=nextcloud
- POSTGRES_USER=nextcloud
- POSTGRES_PASSWORD_FILE=/run/secrets/postgres-pwd
networks:
nas-net:
driver: bridge
Container Management Best Practices:
- Use volume mounts instead of bind mounts
- Implement resource constraints
- Use rootless containers where possible
- Regularly update container images
Monitoring & Maintenance
Essential Monitoring Stack
Prometheus/Grafana Configuration:
1
2
3
4
5
6
7
8
# prometheus.yml
scrape_configs:
- job_name: 'node_exporter'
static_configs:
- targets: ['localhost:9100']
- job_name: 'zfs_exporter'
static_configs:
- targets: ['localhost:9134']
Critical Metrics to Monitor:
- ZFS pool health status
- ARC hit ratio
- Disk latency (await)
- Network throughput
- Temperature sensors
Automated Scrubs and SMART Tests
1
2
3
4
5
6
7
8
9
10
# Weekly scrub schedule
sudo zpool scrub tank
# SMART monitoring
sudo apt install smartmontools
sudo smartctl -t long /dev/sdX
# Configure monthly long tests
sudo nano /etc/smartd.conf
/dev/sda -a -o on -S on -s (S/../.././02|L/../../6/03) -m admin@example.com
Backup Strategy Implementation
3-2-1 Backup Methodology:
- Local: ZFS snapshots
1 2 3
# Daily snapshot retention sudo zfs set com.sun:auto-snapshot=true tank sudo zfs set com.sun:auto-snapshot:monthly=false tank
- Offsite: Rclone to cloud storage
1 2 3 4
rclone sync /srv/nas encrypted-gdrive:nas-backup \ --bwlimit "08:00,250k 23:00,off" \ --exclude "*.tmp/**" \ --checksum
- Immutable: Borgmatic repositories
1 2 3 4 5 6 7 8 9 10 11 12
# borgmatic/config.yaml location: source_directories: - /srv/nas repositories: - path: ssh://user@backup-server./path/to/repo storage: encryption_passphrase: "YOUR_SECURE_PASSPHRASE" retention: keep_daily: 7 keep_weekly: 4 keep_monthly: 6
Troubleshooting Guide
Common Issues and Solutions
Problem: Slow file transfers
1
2
3
4
5
6
7
8
9
10
11
12
13
# Check disk I/O
sudo iostat -x 1
# Identify ZFS bottlenecks
zpool iostat -v 1
# Check network throughput
iftop -i enp3s0
# Potential fixes:
# - Enable SMB multichannel
# - Increase ZFS ARC size
# - Add L2ARC/ZIL device
Problem: Pool in degraded state
1
2
3
4
5
6
7
8
9
10
# Check pool status
zpool status -v
# Locate faulty disk
smartctl -a /dev/sdX
# Replacement procedure:
zpool offline tank /dev/sdX
# Physically replace disk
zpool replace tank old-disk-id new-disk-id
Problem: Container storage conflicts
1
2
3
4
5
6
7
8
9
# Check for mount conflicts
findmnt /srv/nas
# Verify SELinux/AppArmor
sudo aa-status
sudo ausearch -m avc -ts recent
# Check for open files
lsof /srv/nas
Conclusion
The Companion Cube NAS project exemplifies how technical expertise and creative engineering can combine to produce functional art. Beyond its aesthetic appeal, this build demonstrates several crucial DevOps principles:
- Adaptability: Enterprise storage concepts applied to unconventional hardware
- Efficiency: Space-constrained optimization techniques
- Resilience: Proper RAID implementation in compact form factors
- Monitoring: Essential telemetry for DIY solutions
For professionals looking to expand their storage expertise, consider these next steps:
- Experiment with Ceph in micro-cluster configurations
- Implement NVMe-oF for high-performance networks
- Explore ZFS replication for disaster recovery
- Benchmark different filesystems under various workloads
Recommended Resources:
Whether building a Portal-themed storage cube or deploying petabyte-scale clusters, the fundamentals remain constant: understand your requirements, implement proper redundancy, and never underestimate thermal dynamics. The true triumph comes not just in creating a functional system, but in crafting a solution that balances performance, reliability, and personal expression.