How to replicate a ZFS dataset to a second offsite TrueNAS computer with OpenVPN

I am a big fan of the ZFS filesystem and the TrueNAS operating system for DYI NAS. In my previous post I wrote about why backups are important and described my personal backup strategy. In this blog post I’ll describe the nitty-gritty involved with setting up automatic replication to an offsite TrueNAS box.

The Options

TrueNAS has built in support for replication via SSH. So, what we basically need to do is to make the offsite TrueNAS box accessible via SSH. There are few options to do it.

Theoretical options and practical solutions

“Yes honey.. I swear we need this many HDDs..”

We all accumulate digital files that we can’t bare to loose. Many only realize the importance of backups when they loose something important. The most common case being lost baby pictures that were on someone’s phone.

In this blog post I aim to outline the available options and give some recommendations based on my many personal trials and tribulations on the subject.


First let me refresh the fundamentals that you should be aware of:

All storage mediums will fail

It’s important to remember that all types of storage local mediums like, hard disks, pen drives, DVDs, etc will all eventually fail. There are no expectations…

How to cast yourself as a C++ pro without segfaulting

C++ is easy to pickup and read. Features like mutable by default and implicit conversions, are powerful features that make it easy to write “close to the metal code”. However it is also very easy to shoot yourself in the foot by writing sub-optimum code that generates unnecessary machine instructions and/or memory copies. It’s also very easy to write code that is hard to extend and test; resulting in hard to maintain code.

While the language spec is now 40 years old, it is currently in the midst of an accelerated evolution that is rapidly introducing new features. Thus we…

What modern science has to say about obesity, diabetes and cholesterol

source: link

Recently, my wife and I watched a documentary movie called Fat Fiction (2020) and had our minds blown! Turns out that there is no science behind some of the things we were taught about nutrition during grade school. Needless to say, we have since made drastic changes to our diet.

Fat Fiction is a must watch! We actually had to watch it a few times to properly absorb the avalanche of information. In this blog post, I will try to consolidate the key takeaways.

Disclaimer: I am not a medical professional and this blog is not intended to be taken…

Tips and tricks on how to do fast OCR with Python and Tesseract


Unstructured text is the opposite of what you find in a printed text book. It’s when you have text in random places with different fonts, sizes and colors. Traditionally OCR (optical character recognition / text extraction) of such unstructured text has been a difficult problem. When I attempted this previously, a decade ago, it required a lot of preprocessing and was not even close being real time.

The open source solutions have come along way since then and I am happy to report that it’s now viable to run them at real time speeds. …

Here is how you setup your Linux computer to code, build and debug apps for Windows

Wait.. what?

Yeah.. you read that right! You can use the comfort of your Linux computer, with your multi-monitors and tools setup just right, to develop Windows stuff. No, using a remote desktop doesn’t count. That’s laggy and you can’t use your Linux tools.

I am leveraging SSH here, which is nothing new. But what I found out recently is that it is now insanely easy to setup thanks to the hard work done by.. err.. Microsoft ¯\_(ツ)_/¯

What exactly is possible?

I will be using the following two key pieces of technologies for this setup:

Zbarlight is a lightweight Python wrapper for the popular ZBar barcode reader library. In this post I describe how to get it to work in Windows.

Photo by Markus Winkler on Unsplash


I am currently developing an application that needs to quickly decode QR codes off of a video stream. I initially started development under Ubuntu and evaluated Python modules on Pypi. It appeared that all the popular libraries were based on libzbar, which is based on the popular ZBar project. The most popular module was pyzbar and it was able to decode at 30 FPS. However their is also a zbarlight module, which uses a C extension to interface with the native libzbar-dev libs. It doesn’t doesn’t return the detected QR code’s coordinates, but it did process significantly faster, running at…

Part 2 of my series on Tips and Tricks for the Linux Desktop

ZFS on Linux (ZOL) logo

ZFS is a “next gen” filesystem that brings many useful features to the table. With the Ubuntu 20.04 LTS release, I think it’s finally ready for the tech literate data hoarders to embrace it!

This blog post aims to describe what is currently possible with ZFS and is not a step-by-step guide. Where possible, I have linked to more detailed instructions.

ZFS Primer

Before we begin, a quick overview of ZFS for the uninitiated.

ZFS was originally developed by the folks at Sun for the Solaris OS. It was later open sourced, forked and ported to Linux. …

Part 1 of my series on Tips and Tricks for the Linux Desktop

But why?

Have you ever opened a folder of pictures and had to wait for your file manager to sequentially generate the thumbnails? Does it bug you when sometimes the previously generated thumbnails somehow resets and you have to sit through the thumbnail generation AGAIN??

Waiting for them thumbnails to generate ⏲️

Well, I have a sizable collection of about 80,000 photographs taking up about 1.1 TB and I don’t want to waste time waiting for thumbnails to load when I am trying to find a particular photo. So, I have been getting to grips with how thumbnails work in an attempt to make culling through my photos faster…

How to setup Pi-hole for DNS over HTTPS and DHCP duties in your home network

Image credit:

The Problem

Did you know that DNS queries are unencrypted? This means that your ISP could “potentially” build an advertising profile (age, gender, political bias, etc..) by data mining your DNS queries. YIKES!

But what is your average Sri Lankan techie to do about it? Unfortunately not much! Unless you have the disposable income to pay for a trusted VPN service (with decent performance); it is costly to protect your data privacy. Even if you did have the spare change, getting all your connected devices (Smart TV, Wireless Printer, Game console, .. ) on to a VPN is a challenge.

Using an…

Ruvinda Dhambarage

Embedded Systems & Linux Techie

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store