Tiernan's Comms Closet

Geek, Programmer, Photographer, network egineer…

ZFS iSCSI NFS SFTP Hyper-V and more

As part of my new task to make my files safer and backups faster, and, well, cheap, I am looking into ZFS for my storage needs. My needs are as follows:

  • Allow me to store lots of different types of data (Photos, Videos, Music, VMs) in different formats (RAW and JPG photos, MP4, AVI and DivX Videos, with DVD and BluRay rips also a posibility, MP3 music and VHD files from HyperV, inclduing ISOs and Snapshots). I also need to store different file systems using iSCSI (Mac and Windows clients will be mounting the storage).
  • must be safe. DO NOT LOSE DATA!
  • must be somewhat fast. I have VHDs weighing in at 100Gb… my photo collection is 600Gb. If i need to move or copy files to the storage system, it must be fast.

So, ZFS offers all these features. I can export a file share as iSCSI, NFS, SMB, etc. All works well. But the replication stuff is the interesting part…

The plan, which i am working on, is as follows:

  • have 2 machines setup: one in house and one in a datacenter (I have a dedicated box in the Hetzner data center). both could be VMs (the one in the datacenter will more than likley be a VM).
  • use the storage on the local system for whatever i need backed up.
  • have a script which will take a snapshot of a given pool every 4 hours or so…
  • that script should also dump the snapshot to a temporary location on the machine using ZFS send.
  • that file should be checked, compressed, broken up into little bits and checked again… checking is important!
  • take those little bits and send them to the datacenter, which will do lots more checking and import the files into the ZFS pool over there…
  • there may even be a two way system to send from the datacenter back to the house…
  • finally, the remote pool should be dumped to an SFTP backup system that Hetzner give me… Currently set at 100Gb, but can be increesed as needed…

Thats the “plan”… Lets see how it actually works out…

Anyway, parts of the process i need to tweak:

  • uploading and using as much of my upload bandwidth as possible (2x10mb upload connections…) if i am backing up 800Gb, which should be my first backup, i would like to use both pipes to the fullest… on a single connection, at 50% capacity, it would take 15.1 days to upload. if i can get both connections to work at 80% capacity, giving me 16Mbits/s, it would be down to 4.7 days. With compression and Deduplication, i can probably bring that down a bit more…
  • backing up to SFTP… Reading different things is telling me this might not be such a good idea…

Some links which you might find useful:

More Jekyll Stuff

Couple of bits and pieces on Jekyll stuff today… I am tweaking the outline of the site, so i am surfing around finding stuff… here is what i have found

  • Host a static site on Amazon S3: Interesting idea, and something i would look into eventually… And with the help of CloudFront you could host your whole blog on a CDN!
  • Rake tasks for Jekyll: Rake is the Ruby version of make… and a RakeFile can have tasks, which are in Ruby… They can do, from what i can gather, pretty much anything… So, some examples of what you can do with them are linked here… I especially like the New Post generator… very handy!
  • Jekyll Plugins: Various different plugins for Jekyll… I am interested in a few of these, mainly the Generate_projects one, which generates a page for your projects based on your GitHub projects… very cool stuff…
  • Strictly speaking, this is not just a Jekyll how to, but Migrating from WordPress to Jekyll is a handy read. my main blog, my podcast and photography blog both run WordPress. migrating them to Jekyll would mean i could move them directly to a CDN and make things a lot faster… Maybe something i plan doing soon…

If you have any tips or tricks, why not leave a comment and i can add them to the post.

Handbrake Cluster

[UPDATED] someone asked in the comments if there was an binary build for this file. there is now! http://handbrakecluster.codeplex.com now hosts the code and binaries, and will soon have help files and documentation.

A few days back, i wrote a post titled Powershell + Handbrake + AppleTV + iTunes = Automatic TV… ish. In it i included a block of Powershell code to bulk convert TV shows from whatever format you had them in to a M4V format for the AppleTV. Well, as they say “If necessity is the mother of all invension, lazyness must be the father”. I have a lot of shows i wanted converted to the AppleTV, so i built something… Its called HandBrake Cluster and is written in .NET 4.5, uses MSMQ and Handbrake to do the processing… The workflow is as follows:

  • setup the system as described on the HandBrake Cluster site.
  • run the adder program with the paramaters required (location of files you want converted, type of files to find, where you want the files to be placed, output file type)
  • run the cluster EXE on as many machines as you want. each machine will need to point to the correct MSMQ on the head node, have their own copy of Handbrake, and must have access to the fileshare that you are reading and writing to…
  • each node will take a message of the queue, process the file and then mark it as completed. There is code to see if the message has failed, so, in theory, if something goes into the queue, it should always be processed…

I have run this at home on a couple of different machines, and so far so good… my room gets a bit warmer when i kick this off, and between the 3 machines i ran it on, my FPS count went from just 80-120 on the Godbox, to a total of about 160 – 240 FPS (Godbox = 80-120, Server 1 and 2 are about 40-60FPS).

The next thing i managed to do was tweak my import process for iTunes. I am using a program called iHomeServer for iTunes which is running on the GodBox. It monitors a folder, which is where HandBrake Cluster is writing to, and adds them to iTunes. I can then tweak the metadata using the tool, so i can add art work, tell it which shows are related, and it sets up Art work, title info, etc. It is very handy, and something i am very happy with.

Enabling True Bridging modem on a Cisco ECP3925 Cable Modem (UPC Ireland)

I am a UPC Ireland customer, and have 2 cable modems into the house, both Cisco EPC3925s. These are not exactly great modems for power users, but are grand for normal use… Me, however, being a poweruser wanted something a little more, how should I put it, powerful.

A couple of months back, a tutorial was posted on Boards.ie which showed you How to enable “bridging” on your UPC modem. When i say “Bridging”, they used DMZ, turned off firewalls, static IPs internally, turned off WiFi and DHCP, etc. It worked, quite well actually, but was “odd”… Today, however, there is a new tutorial Enabling REAL bridging on a Cisco EPC3925. I have tried this, and so far, it works! now just to set my router to work correctly, and update my IPs if they change…

PowerShell + HandBrake + AppleTV + iTunes = Automatic TV… Ish…

I have an AppleTV in the house (3, actually) and I am very happy with its ease of use, size and cost… You can’t argue with the small price!

I also have a lot of content that works great with the AppleTV in iTunes, but I have content which does not work so great with the AppleTV… So, I needed to find a way to convert files quickly and easily… that’s where PowerShell and Handbrake come in…

  • in the code above, you need to set the path of where your files live. in my case, they live on a NAS.
  • next, set the location of HandBrake… I have a 64-bit copy of Windows and a 64-bit copy of HandBrake.
  • set the new file name to where you want the file to go. in my case I have it set to my “Automatically Add to iTunes” folder, which is a magic folder for iTunes that copies any files dropped in there to your iTunes library.
  • finally, conversion is run…

This may take a few min, depending on a few factors:

  • how many files you are converting
  • how fast your machine in
  • how fast your machine can read and write the files…
  • etc…

I have set files to convert on 3 different machines (the GodBox and 2 other servers) and I am getting speeds of anywhere between 250FPS (on the GodBox running 2 instances of HandBrake CLI) and 40 – 60 FPS on the older servers… on the remote machines, they are sending files to the GodBox folder also, so once everything completes, it’s just a matter of opening iTunes and we are good to go… Now to figure out how to automate the Metadata import…

Crashplan Backups

I have been running CrashPlan for a while now, and, other than some minor issues (backup speed to their central location is the big one), everything has been going grand. I use it to backup about 600GB of photos and videos, 500GB+ of VMs, documents, source code and a fair whack of other stuff… In total, about 2TB of data.

Anyway, here are some tips i have figured out over the last while for making Crashplan work a little better…

I am also in the process of doing some further tests with iSCSI drives linked to the Cloud, and other weird and wonderful things… once I have finished, i will upload extra stuff here.

More VoIP Stuff

As part of my ongoing plan to upgrade the house to VoIP, and as a follow up to my first VoIP stuff post, here are some more things i have found…

  • I have added SipDiscount and SipGate for making and recieving calls.
  • SipDiscount allows me to set pretty much any number as my Caller ID, as long as i “own” that number (they either text or call you with a code, and you enter it on their site). They also allow me to make cheap calls to Irish Mobiles (check their rates here)
  • SipGate gave me a incoming UK phone number. Its an 0845 number, which I dont know what that means… but it was free, so its all good. Not sure if i can recieve text messages on it though…
  • I have a Blueface account, which gives me an Irish 076 VoIP number. 076 is the standard VoIP number here in Ireland…
  • I have a IpKall number, which is based in Washington State. You need to recieve a call on this line at least once every 30 days to keep it active.
  • My Google Voice accepts calls and forwards them to my IpKall number, which then rings my BlueFace SIP account (since i know they will be up all the time, by my home server may be offline since i am only testing) which, if a SIP device is connected, will forward it again… if i am offline, or no sip devices are active, that call is redirected to voice mail…

Its all very complicated at the moment, but the plan will be that any incoming calls should go directly to the machine in house, which will ring the desk phone and any other SIP clients. Any incoming PSTN calls will also do the same. Outgoing calls will depend on the dialing plan, which i still need to figure out, but the theory goes as follows:

  • Irish landline calls at certin times should go though the PSTN (since we get some free calls with our line). Other times they should go though SipDiscount or BlueFace.
  • if the PSTN is busy, fall over to one of the other providers…
  • Irish Mobile calls should go though SipDiscount and then fall back to land line, or if i ever get the BlueTooth setup working, SipDiscount, then bluetooth, then landline…
  • International calls should be sent though SipDiscount or Blueface, whichever is cheaper…

Its going to be an interesting setup… 🙂

Building a Cross Compiler for your Raspberry Pi

My main machine at home, known as “The GodBox” is a Dual Processor, Quad Core Xeon 5520 with 60Gb RAM, 2 300Gb 10,000 RPM Western Digital Velociraptor in RAID 0 for boot, 4X1Tb 7200RPM drives for storage, 2 more 300Gb 10,000 RPM drives for “scratch disk” and a couple high(ish) end graphics cards with 3 monitors plugged in… Hence the name, GodBox!

Anyway, The Raspberry Pi, on the other hand, has a 700Mhz processor, 256Mb RAM and not much else… So, if you need to write code for your Pi, and you don’t want to wait a long time to compile, check out this tutorial on how to build a cross compiler for your raspberry pi which will allow you to build your apps on a different machine… I have a college project which the Raspberry Pi will be used for, and i am thinking this will be how i build code.

MicroTik RouterOS VPN Setup

I have been running a MikroTik RouterBoard in the house for a couple of months now (the RB750G) and I am very much loving the thing. But one thing you may need to do is setup VPN connections… Here are some tips on how to create a VPN Server and Client on your RouterBoard.

##Client Setup

to setup a client, you need to do the following:

What does that all do? the first line creates an l2tp-client interface, pointing at “servername” with the username and password set. encryption, etc is enabled… Line 2 then enables the client. Line 3 sets all traffic comming from networkaddress/24 (for example, 192.168.0.1/24) to be sent though the VPN. any traffic going into networkaddress (same example) is not sent though the VPN. Line 4 creates a gateway, for all addresses (0.0.0.0/0) to use the VPN address. finally, NAT Masquerading is enabled on the VPN interface.

there are more advanced things you can set above… some examples I can think of are as follows:

  • There should be no good reason to limit the amount of VPN connections you have… in theory, you could have multiple…
  • for the mangle rule, set the src-address to a single machine in your network. that way, it gets VPN only connections. Also, you could set the dst-address to a single address or network to send only traffic going to a given server though the VPN… Example would be Netflix US traffic to a US VPN server, BBC iPlayer traffic to a UK VPN, etc.
  • the example above uses L2TP, but PPTP, SSTP and OpenVPN are also available.

Server Setup

As mentioned above, L2TP, PPTP, SSTP and OpenVPN servers are available on RouterOs. Details on setting them up are available on MicroTik’s Wiki at the following locations:

SSH Tunneling made simple

Something I do on a regular basis is use the internet while “out and about”. This could be college, which has a semi open network, or it could be a coffee shop, which also usually has a semi open connection. There is also the possibility of using the a mobile internet connection on my iPhone, which can be slow, but at least its only shared with me… Anyway, over on RevSys.com, there is a post SSH Tunneling made simple which shows you how to open an SSH tunnel to your machine somewhere else (could be at home, as is my case, or a VPS/Dedicated server somewhere, or even on Amazon…) and use that for different things… In the case he shows, its for SMTP access. For my case, i am forwarding my local port 3128 to my Microsoft TMG 2010 Server in house on port 8080. Then my system proxy on my laptop is set to use localhost:3128 for all web and HTTPS requests. Very handy. One other tip: Using the -C flag, so your command may look like:

ssh yourname@remotemachine -L 3128:remoteMachine:8080 -C

will compress data between you and the SSH server, which for basic web browsing (HTML, CSS, JS) will make things faster, but for stuff like images, etc, may not work so well… Your Mileage may Vary…

Also, while on the subject of SSH, Linux Journal has an article on Eleven SSH tricks which mentions compression, Encryption Cyphers, X11 Forwarding, Config files and other interesting bits.