Wiki2
OpenNAS

OpenNAS

Features

  • DHCP/mDNS to locate server on configuration OR show IP on LCD.

    • Bubba3 has solved this. Just enter “b3” in a browser
  • SMB Network Access

  • Sync between local USB disks

  • Sync between remote USB disks

  • MiniDLNA

  • Auto mount of USB disks

Future features

  • Basic firewall
  • Act as Media Renderer which output directly to amp
  • Automatic photo transfer (over USB) with automatic duplicate rejection.

Phases

  1. Single LAN NAS only
  2. Add firewall / pass through

Hardware

  • ALIX 2D13 System Board OR Mini-ITX
  • 3 LAN, 2-4 USB
  • 3 LED
  • Single Push button
  • I2C to LCD display
  • CF card
  • USB disks

Example hardware.

Views

  • Network setup
    • Pass through (2 LAN & firewall) / Local (1 LAN & no firewall)
    • External ethernet setup
    • Internal ethernet setup
    • DHCPD setup
  • Remote SSH account setup
    • Local user setup
    • Remote login setup
  • Firewall setup (later)

Cloud Storage Price Comparison

Amazon EC2

  • $0.10 per GB-month of provisioned storage
  • $0.120 per GB transfer

(server instance cost is not included)

tarsnap backup service

  • Storage: $0.30 / GB-month
  • Bandwidth: $0.30 / GB

cyphertite

  • Storage: $10 / unlimited for personal use
  • Bandwidth: free

rsync.net

$ 1800 / year for 1 TB

Cost example:

1 TB or storage and 100 GB transfer / month

Service: Cost / month
EC2$ 112
tarsnap$ 330
cyphertite$ 10 (personal use)
rsync.net$ 150

Use Case Analysis

Disk categories

  • Disk Type: Primary / Backup
  • Ownership: Yours / Partners
  • Location: Local / Remote (0+)

Common functions & Rules

  • Setup Local settings. How to access internet etc. not related to disk.
  • Setup a link to a Remote location.
    • A link (referring to myself) is sent through mail which is copied to the local UI.
    • A bi-directional link is setup which involves device to device connection service.
  • You can only have a single Primary disk but zero or more Secondary disks associated with the Primary
  • Create a local Yours & Local disk. It may be Primary or Backup
  • Create a local Partners & Remote & Backup disk
  • File Access to Local & Primary & Yours` disk through Samba, AFS and NFS
  • Sync from Local & Primary & Yours -> Yours & Secondary
  • Recovery from Yours & Secondary -> Local & Primary & Yours

Options

  • Sync may be Incremental or Non-incremental
  • Sync may be Manual or Periodic
  • File Access users to Primary` disk
  • Secondary may be Encrypted or Non-encrypted
  • Recovery may specify a specific increment to recover from
  • Recovery may specify a subset of files to recover
  • Sync through company firewall in reverse?

Status Information

  • Backup disks must present latest sync actions.
  • Sync Actions should present time of sync, data transferred and time to sync.
  • All disks must present disk free (and disk used)

EHCI bug in OpenBSD

I still have problems when mounting a USB disk for a long time on OpenBSD. This is currently the only showstopper for this project.

The following script (test.sh) is used to test it.

#!/bin/sh

echo "FORMAT:"
/root/format_usbdisk.sh sd0

echo "MOUNT directly after format: "+`date`
mount_ffs /dev/sd0a /mnt/matteus
time ls -l /mnt/matteus
sleep 3600
echo "MOUNT after 1 hour: "+`date`
time ls -l /mnt/matteus
sleep 7200
echo "MOUNT after 3 hour: "+`date`
time ls -l /mnt/matteus
sleep 14400
echo "MOUNT after 7 seconds: "+`date`
time ls -l /mnt/matteus

I also make use of format_usbdisk.sh.

#!/bin/sh

# Automates the following process so BE CAREFUL !!!

# fdisk -iy sd0            
# Writing MBR at offset 0.
# disklabel -E sd0
# Label editor (enter '?' for help at any prompt)
# > z
# > a
# partition: [a] 
# offset: [64] 
# size: [15165296] 
# FS type: [4.2BSD] 
# Rounding size to bsize (32 sectors): 15165280
# > w
# > q
# No label changes.
# newfs sd0a

# TODO: Check that the disk is removable

DISK=$1
LOGFILE="/tmp/format_usbdisk.log"

if [ $# -ne 1 -o -z "$1" ]; then
  echo "Usage: ./format_usbdisk.sh <dev>"; exit
fi

echo "Disk on $DISK will be formatted to FFS2. Wait until all blocks are written ..."
echo
fdisk -iy $DISK 2>&1 > $LOGFILE
disklabel -E $DISK 2>&1 >> $LOGFILE << __EOT__
z
a




w
q
__EOT__
newfs "${DISK}a"
echo

Views

Disk view

  • Each disk is listed by location.
  • Sync status and sync setup is accessed through the corresponding backup disk.
  • Unconfigured disks show up as such.
  • A location setup cover access between local and remote devices.

Open items

  • Compare functionality with Hammer. Is this a better option?

Scripts

Hardware with internal HDD

If we should build a OpenNAS system with a internal HDD I think the following components could be suitable.

The system may also work as a very capable firewall.

Total: 175 euro

An internal 3.5 SATA HDD (e.g. 1-2 TB) is needed to complete the system.

Investigation Tasks

  • Setup OpenMDNSD to allow configuration view to show up under http://opennas.local.
  • Naming convention of disks (Location, Primary/Backup, Local/Remote). Disk metadata storage (file). Unique identifier for Location and disks
  • How to enable disk encryption
  • How to recover a specific version of a file system / set of files
  • Automatic detection of USB disks
  • Design configuration / execution process. Single configuration file generate changes in target files. New configuration is deployed through with or without reboot
  • How to handle SSH connection through firewall. Should we assume that device work as bridge towards internet
  • Define minimal firewall configuration setup

References