10gbe Cc2 N320e Sr

I finally connected my NAS with my build server with 10 Gigabit Ethernet.

The network card I used is the: Chelsio CC2-N320E-SR. You get this cards around 30$ from ebay and similar places. Plus the direct attach cable needed, which costs around 8-20$, we are looking at a total of less than 100$ to connect 2 computers with 10GbE. Which is very impressive to me.

The coolest part about this cards is that they just work out of the box with FreeBSD. This was harder than expected. Since I put the first card in slot 1 of my Dell T20 and it never showed up. According to the documentation the 1 slot is: One full-height, half-length x16 PCIe Gen3 card slot connected to processor. It is unclear to me why the card never showed up, not in the BIOS, not with pciconf -lv. So I moved it to slot 4: One full-height, half-length x16 (x4) PCIe Gen2 card slot connected to PCH. And it showed up.

When the card is recognized the drive is loaded automatically. And you can check dmesg if the card needs a firmware upgrade.

kernel: cxgbc0: using MSI-X interrupts (9 vectors)
kernel: found old FW minor version(5.0), driver compiled for version 7.11
kernel: cxgbc0: firmware needs to be updated to version 7.11.0

The firmware binary: t3fw-7.11.0.bin is found on https://service.chelsio.com/legacy.html. This can then be unpacked and flashed with the help of cxgbtool. (Which is shipped with FreeBSD but needs to be compiled)

cd /usr/src/tools/tools/cxgbtool
make install
cxgbtool cxgb0 loadfw t3fw-7.11.0.bin

And that's it, reboot and check dmesg again. There is a great blog post by Boris Tassou which explains many of these steps in detail if you are interested.

Now to the big question how fast is it? According to my very primitive iperf testing:

[ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 7.82 GBytes 6.71 Gbits/sec

World Backup Day

Today is the world backup day. This is a wonderful excuse to talk about how I do backups (again).

And I can happily report that the solution I build and blogged about is working perfectly. (If you missed that here is the blog post from two years ago ZFS remote backups).

The biggest change since then is the hardware. You might remember that I own a Dell T20 which is still very cool hardware but with a Intel(R) Xeon(R) CPU E3-1225 v3 it uses quit a bit of power. That is why I switched to a self built solution with a Intel(R) Xeon(R) CPU D-1528. This is 35 watt TDP instead of 84 watt TDP. But you can read all about that in my previous blog post Self built NAS

The big improvement I implements since last year is the monitoring. I switched from observium to telegraf, grafana and influx for monitoring. The next logical step was to create a dashboard for my backup status.

This is how it looks (you can find the template in this gist):

grafana backup dashboard

Which is so much better than just write the infos to a log file in /tmp and check it manually.

It is built with the Line Protocol of influx. Which allows to post data with curl.

curl -i -XPOST -u username:password 'https://hostname:8086/write?db=databasename' \
        --data-binary "backup,host=backuphost status=${code}i
backuptime,host=backuphost value=${SECONDS}i"

It is not perfect but it is the best solution I ever built. And here is your reminder: do backups, check if your backup was executed successful (visibility in a dashboard helps immensely) and last but not least try to restore it. A backup with out restoring is useless.

Self Build Xeon D Nas

Requirements for my new NAS

I thought it's 2019 and time for 10GbE. Also I was bored, so I upgraded my Dell T20 after 5-ish years. The main features I was looking for: lower power consumption, 10GbE Network and M.2 SSD boot support.

M.2 SSD boot support is important to me since I upgraded the Dell T20 with a PCI adapter to have a M.2 SS as boot device. Which did not work as well as expected and I needed a USB stick for /boot. This is very annoying.

10GbE Network is self explanatory it is the future and who doesn't want the future now.

Last but not least less power consumption the Dell T20 comes with a Intel(R) Xeon(R) CPU E3-1225 v3 which has a 84 watt TDP which is unfortunate but I needed the power for Plex movie encoding. But as time has gone on CPUs use less power for the same or more performance.

What I built

how my new NAS looks

As motherboard I selected the MBD-X10SDV-6C-TLN4F-O. It ticks all the boxes, I wanted to have from new hardware. Also I think it is one of the better price/value motherboards you can find. It has 2 10GbE NICs. It has the M.2 SSD slot on the motherboard and I can boot FreeBSD from it. And it uses a Intel(R) Xeon(R) CPU D-1528 which is 35 watt TDP. That is less than halve of the E3-1225 v3 at the same passmark score. This means it still is fast enough to live transcode my plex moves for me.

This motherboard is now in a Supermicro mini tower SC721TQ-250B. In general I like the case but in comparison to the Dell T20 it is not as quite as it use to be. Mostly the fault of the 30mm fan on the PSU I guess. But on the bright site with this case it is possible to hot-swap disks. And I got an insanely good deal on it.

To power my ZFS pool which is still on 3x8TB HDDs (never did an update on this as far as I remember) I added Kingston Server-Branded Memory KSM24RD4/32HAI 32GB ECC, Registered. As boot disk I use a Samsung SSD 860 EVO M.2 500GB which is more than enough space for the base OS and all my jails.


Thanks to ZFS and iocage the migration was very smooth. I just setup FreeBSD 12.0 and copied over a few config files like /etc/rc.conf. Exported the ZFS volume on the Dell T20, put the disk in the new server and just imported it again. I did the same for all the jails just iocage export and iocage import on the other side. After some minor jail config tweaks all my services where up and running again. (I forgot to migrate a jail but that is a story for an other time) The entire migration took about 45 min from start to finish.

Unicode Magic On Linux

2019 is the year of Linux on the desktop 🎉! Or something.

We all know to be a successful platform you need to have emojis. And who can hate emojis, they are the best.

So here is how you get a simple way to use emojis and other special characters on Linux (with i3 and rofi). It was surprisingly easy (probably because I mostly just stole it from entiPi).

You need two programs to get started rofi to display the menu and xclip to put characters in your X selection buffer to paste it. My keyboard shortcut is Win + u for unicode. And it looks like this in my i3 config:

bindsym $mod+u exec --no-startup-id rofi -lines 10 -dmenu -input ~/.symbols.txt | cut -d' ' -f1 -z | xclip -selection c

Rofi unicode menu

As you can see it takes the character from the .symbols.txt file. The format is simple it is just 'character' 'name' 'category'. Checkout a example symbols file from github

☮ peace symbol                                               	 Miscellaneous Symbols

Now you can search for the character and press enter to add it to the X selection buffer and paste it where ever you want (Terminal, Pull Request, Email, etc.).

👍 Have fun with unicode 👍

Sort With Xslt By Version Number

There are this moments in my life where I get really excited about technology. The latest of these moments was when I found out that nginx autoindex supports xslt out of the box.

Lets go 2 steps back what does that even mean. Nginx autoindex is the feature which allows you to list all available files and folders in the web root of you server. So it's just a very simple web page listing all files as link. The config for that looks like this:

location /documentation {
	autoindex on;

The problem is, this list is really basic. Maybe this list is not good enough, maybe you want more than files just alphabetically sorted and listed. Maybe you want to sort them by date, alphabetically descending or something else. Maybe you want to style this list which some CSS. And that exactly what I want to do. I have folders with different versions like 2.07.03 and 3.0.0 and I want to sort them in a way that you see the latest version first. So that you see 3.0.0 > 2.07.03.

And here comes xslt (and my excitement) in to play. Nginx autoindex does also support three alternative output modes to html. Thats xml, json and jsonp. And when you use xml you can provide your own xslt file. So that is what we do:

location /documentation {
	autoindex on;
	autoindex_format xml;
	xslt_stylesheet /path/to/your/transform.xslt;

You find the full documentation for the xslt module here. And now we can use all the amazingness of xslt.

The plain xml autoindex generates looks like this:

<?xml version="1.0"?>
  <directory mtime="2018-08-23T09:40:02Z">2.12.01</directory>
  <directory mtime="2018-11-19T15:04:06Z">2.12.02</directory>
  <directory mtime="2018-09-05T14:07:04Z">3.0.0</directory>
  <directory mtime="2018-10-08T07:14:02Z">3.0.1</directory>
  <directory mtime="2018-11-29T17:06:58Z">3.0.12</directory>
  <directory mtime="2018-11-13T11:34:26Z">2.99.99</directory>
  <directory mtime="2018-11-29T17:06:58Z">latest</directory>

And here is how you sort with xslt by version.

<xsl:stylesheet version="1.0" 
<xsl:output method="html" encoding="utf-8" indent="yes"/>

<xsl:template match="/list">
                <xsl:for-each select="directory">
                    <xsl:sort select="substring-before(., '.')" data-type="number" order="descending"/>
                    <xsl:sort select="substring-before(substring-after(., '.'), '.')" data-type="number" order="descending"/>
                    <xsl:sort select="substring-after(substring-after(., '.'), '.')" data-type="number" order="descending"/>
                            <a href=".">
                                <xsl:value-of select="."/>
                            <xsl:value-of select="substring(@mtime, 9, 2)"/>
                            <xsl:value-of select="substring(@mtime, 6, 2)"/>
                            <xsl:value-of select="substring(@mtime, 1, 4)"/>
                            <xsl:text> </xsl:text>
                            <xsl:value-of select="substring(@mtime, 12, 8)"/>


As you can see this creates just a basic html table so I leave it up to to you to Style it in a way you like. And a big thanks to michael.hor257k on stackoverflow who created this readable version of the xslt based on my horrible hacky xslt.

Enjoy your new fancy autoindex pages!