Saturday, November 15, 2014

Killing some time with python

I was bored again tonight, so I wrote a quick, very simple, Average Calculator in python.

#Modules to import
import sys

#Little Welcome message
print ("Welcome to avgcalc!\n")

#Get input from the user
user_input = input("Enter a list of numbers separated by a <space>: ")

#Separate those entered numbers by space
numbersent = map(int, user_input.split())

#Generate a list of the numbers
final_list = list(numbersent)

#Count how many numbers entered
num_of_nums = 0
for i in final_list:
    num_of_nums += 1

#Add up all the numbers
total_of_nums = 0
for y in final_list:
    total_of_nums = y + total_of_nums

#Divide the total sum of the numbers by the number of numbers entered to find the average
avg = total_of_nums / num_of_nums

#Print the final result
print ("The average of", final_list, "is", avg)

Friday, November 7, 2014

Quick Benchmarks of Raspi NFS + External Raid Enclosure

Here are some results of some quick and dirty benchmarks, I feel they give enough of an idea of the performance you can expect from a Raspi B -> USB 2.0 HDD Raid1.

1.1GB File

268MB File

As you can see the transfer rates are rather consistent at an average of about  7.6 MB/S.

Raspi NFS Server + External Raid1 2 Bay HDD Enclosure

I decided I wanted to replace my x86 server with something a little more "arm" powered. Below is just a small post with the steps taken to setup my raspi nfs server. I used the raspi for now as a POC since it kind of lacks due to only having fast eth and no esata/usb 3.0.

 Shopping List:   
  1. 2 X Western Digital Caviar Black 1.0TB HDD's 
  2. 1 X RaspberryPi Model B with ArchArm
  3. Startech External 2Bay Raid Enclosure

Since I am using the PI I utilized the USB 3.0's backwards compatibility and plugged it into the Pi via USB.

The Pi should see the raid as 1 device

I didn't bother to partition, you can if you like. I formatted the entire drive(s) using xfs.

Next I setup fstab for my new mount point

Next setup NFS export

Finally start the services

Once all of the above was complete I was able to mount the share on my desktop. I will post some transfer speed stats soon. Since this POC has worked I decided to grab a slightly beefier ARM machine to serve NFS. CuBox-i4Pro will replace my second Pi, it has gigE and E-SATA support which should boost performance drastically over the Pi.

Home Infra Overhaul (Switch to ARM)

As usual it has been a while since my last post, but i finally have something worth writing about.

Recently I overhauled my small home infrastructure replacing my i3 beefy power sucking tower with 2 Model B Raspberry Pi's and an external 2bay hard disk enclosure with hardware raid 1.

What's on the shelves?

Top Shelf: Buffalo DDWRT Router
Second Shelf: TP-LINK Unmanaged Gigabit Switch, Raspi #1, Cable Modem
Third Shelf: StarTech 2Bay Raid Enclosure, Raspi #2
Fourth Shelf: APC UPS

Raspi #1- Arch Arm - Model B - (DNS,DHCP)
Raspi #2 - Arch Arm - Model B - (NFS)

This should save me a bit on electricity rather than running a beefy tower with 3 Disks in a software raid + a bunch of fans which also adds noise.

The external raid enclosure uses around 12V DC at 3 Amps @ Max and the raspi's use 5V @ 1.2A @ Max. Given I will be running them 24/7, even at max power they will only consume about 420.48Kwh Per annum, which given my flex rate of billing by my hydro company should work out to about $50.45 per annum in power consumption, give or take a couple bucks.

I am aware I did not include the price of the rest of my components as it is obvious they are not major power hogs. In this case I was more concerned with replacing my old tower which definitely ate more given what it was powering.