# Storage Architecture **Strategy:** SD card for boot/root, USB for data --- ## Design Principles 1. **Simplicity:** SD card boots out of the box, no U-Boot complexity 2. **Reliability:** Endurance-rated SD cards last longer 3. **Flexibility:** USB storage can be swapped/upgraded easily 4. **Cost:** Minimal investment, repurpose existing drives --- ## Layer 1: Boot/Root (MicroSD) ### Card Selection | Attribute | Recommendation | |-----------|----------------| | Capacity | 64GB minimum, 128 GB preferred | | Type | Endurance-rated or Industrial | | Brands | SanDisk Endurance, Samsung PRO Endurance | **Why endurance cards:** Consumer SD cards are rated for bursts of writes (camera use). OS usage is constant logging, updates, cache writes. Endurance cards are rated for: - 5000+ hours of continuous recording - 1000+ write cycles per sector - 5-10× longer lifespan than consumer cards **Cost:**$10-15 for 64GB ### Boot Configuration Default Orange Pi 5 boots from SD: ``` /dev/mmcblk0 (SD card) ├── /dev/mmcblk0p1 → /boot (fat32, ~200MB) ├── /dev/mmcblk0p2 → / (ext4, ~60GB) └── /dev/mmcblk0p3 → /home (ext4, remaining) ``` Or single partition with separate mount points: ``` /dev/mmcblk0p2 → / (ext4, all space) /home → bind mount or subdirectory ``` ### Root-on-USB (Optional) For faster I/O, copy root to USB SSD: 1. Boot from SD, insert USB SSD 2. `sudo rsync -ax / /mnt/usb/` 3. Edit `/boot/extlinux/extlinux.conf`: ``` append root=/dev/sda1 ``` 4. Boot from USB, SD only handles bootloader **Tradeoff:** More complexity, faster app loading. --- ## Layer 2: Data Storage (USB) ### Options | Option | Speed | Cost | Notes | |--------|-------|------|-------| | USB flash drive | 100-150 MB/s | $12-20 | Cheap, limited endurance | | USB 3.0 SATA enclosure | ~400 MB/s | $10-15 + drive | Reuse 2.5" drives | | USB 3.0 NVMe enclosure | ~400 MB/s | $8-15 + drive | Compact, fast | | USD 3.0 flash drive (fast) | 200-400 MB/s | $20-40 | Kingston DataTraveler, Samsung BAR | ### Recommendation **USB 3.0 SATA enclosure with salvaged 2.5" SSD.** If you have a spare 2.5" SATA SSD from another build/upgrade: - Enclosure cost: $10-15 - Speed: ~400 MB/s (SATAIII limit over USB 3.0) - Capacity: whatever the drive is If no spare drive: - USB 3.0 flash drive (128GB): $15-25 - Or NVMe enclosure ($10) + budget NVMe drive ($20-30) ### Mount Strategy ```bash # /etc/fstab UUID=/mnt/data ext4 defaults,noatime 0 2 /mnt/data/projects /home/jez/projects none bind 0 0 /mnt/data/media /home/jez/media none bind 0 0 ``` Mount on-demand or at boot, depending on use case. --- ## Storage Layout ``` ┌─────────────────────────────────────┐ │ MicroSD Card (/dev/mmcblk0) │ │ SanDisk Endurance 64GB │ │ ├── /boot (fat32, 200MB) │ │ ├── / (ext4, 25GB) │ │ └── /home (ext4, 38GB) │ │ Basic config, small files │ └─────────────────────────────────────┘ ┌─────────────────────────────────────┐ │ USB SSD (/dev/sda) │ │ SATA or NVMe in USB 3.0 enclosure │ │ ├── /mnt/data/projects │ │ ├── /mnt/data/media │ │ └── /mnt/data/backup │ │ Mounted on-demand │ └─────────────────────────────────────┘ ``` --- ## Backup Strategy ### SD Card Imaging ```bash # Backup sudo dd if=/dev/mmcblk0 of=cyberdeck-sd-backup.img bs=4M status=progress # Restore sudo dd if=cyberdeck-sd-backup.img of=/dev/mmcblk0 bs=4M status=progress ``` Or use **Pi Imager** / **BalenaEtcher** for GUI imaging. ### Data Backup - Timeshift for system snapshots - rsync to external drive - Cloud sync for critical files --- ## Performance Expectations | Operation | SD Card | USB SSD | |-----------|---------|---------| | Boot time | 8-12s | 5-8s (root-on-USB) | | App launch | 1-3s | 0.5-1s | | File read (1GB) | 40-90s | 3-5s | | File write (1GB) | 60-120s | 3-5s | | Random I/O | Slow | Fast | **SD card is fine forOS and light use. USB SSD for anything I/O intensive.** --- ## Cost Summary | Item | Low | High | |------|-----|------| | MicroSD 64GB Endurance | $10 | $15 | | USB 3.0 SATA enclosure | $10 | $15 | | (Assume spare SSD) | $0 | $0 | | **Total** | **$20** | **$30** | If no spare SSD: | Item | Low | High | |------|-----|------| | MicroSD 64GB Endurance | $10 | $15 | | USB 3.0 flash drive 128GB | $15 | $25 | | **Total** | **$25** | **$40** |