After my last post about the Lightning Node using a MOD-1016 (Embedded Adventures), some tests and time has passed by. Especially I noticed, the disturber and noise rate is high. High as in, it disturbs the normal workflow. I was occasionally able to measure some lightnings, but with far than expected and anticipated precision and number. So back to the design, and start to think about pitfalls and design flaws.
My working hypothesis is, that because the small little antenna of the MOD-1016 is heading towards the Arduino Nano, it gets much noise from the microcontroller itself. So I decided to de-solder the current header and resolder it on the other side, so the antenna points to the outside. This is how the final product looks like
Preliminary tests look pretty good, as I do not detect any noise and distrubers anymore, while still being able to communicate with the MOD-1016.
Now, back into the field with the box. Let's hope for some nice thunderstorms this week 🙂
There are two kinds of users: The ones, who encrypt their stuff and the ones, who never had lost something or never got something stolen. Imagine your Laptop being stolen on the train. Not only, you probably lost all of your data (Backups!), but also there is now a stranger that has access to potentially very private data - Pictures of your last birthday, company records you need to keep secret or the new piece of code that is awesome and the capital of your startup you just wanted to create. Plenty of reasons for investing a little bit of time in your digital self-defence, and a sane full-disk encryption is a major part of it.
I personally have two different approaches: VeraCrypt (successor of TrueCrypt after they surprisingly closed, leaving lots of speculations about their non-commitment to build in a secret backdoor for a large state agency, but that is based on pure speculation and is on the list of conspiracy theorems that probably turn out to be at least somehow concise enough to be taken seriously.) seems to be sane enough to be used or LUKS. In this article I'm gonna cover LUKS, as I consider this the canonical way for every mature Linux environment.
Assuming the HDD is /dev/sdb and you want to call it Cryptodisk
Reformat the external HDD. Create a single partition with any filesystem (we will overwrite this in the next step)
Make sure all filesystems for that disk are unmounted.
cryptsetup -y -v luksFormat /dev/sdb1
Write the passphrase on a sheet of paper and store it on a safe place.
REALLY do it. You probably will forget the passphrase and then you can cry your data goodbye
Open the crypdevice: cryptsetup luksOpen /dev/sdb1 Cryptodisk
cryptsetup luksClose Cryptodisk
Plug the disk out and re-plug it in. In caja/nemo it should appear as encrypted device. If you click on it, it asks for the passphrase and it will be mounted. Alternatively, user cryptsetup cryptsetup luksOpen /dev/sdb1 Cryptodisk mount /dev/mapper/Cryptodisk /mnt/Cryptodisk
Note: It's possible to compartmentalize multiple partitions by putting a LVM volume atop cryptsetup. This is more advanced but pretty much straightforward.
Step by Step guide
I plug in my HDD and assume it's gonna be recognised as /dev/sdb.
First, We need to make sure that it's unmounted
Next, format the HDD. I normally use parted, but gparted seems to be the nicer way, as it's graphical and pretty easy. So, start gparted on the disk
# In Wayland this might cause trouble, as sudo and Wayland are not super nice to each other ... That's beyond the scope of what I write down here, sorry :-)
MAKE SURE IT's THE RIGHT DISK. Do the partitions look like the ones expected? Is there anything fishy? Once you clear your partition table or (even worse) wrote a new filesystem, it's unlikely you can fetch your data without any losses. Take a breath and double-check before doing anything.
OK, Then create the partition you want to encrypt. Select a random filesystem, as we are anyways going to delete the filesystem. It's only important to create the layout correctly. In my case it looks like the following: one partition that takes the full space (Little bit of empty space at the end is needed by GPT for the Backup table)
Close gparted and encrypt the partition using cryptsetup
Thiswill overwrite data on/dev/sdb1 irrevocably.
Are you sure?(Type uppercase yes):YES
Enter LUKS passphrase:
Congratulations, you created your first encrypted parition! Now we are gonna put a filesystem on that one, so you can actually use it 🙂
So, we are gonna "open" the cryptdevice. This means, we are putting an encryption/decryption layer, atop which we can run our filesystem
# Assuming you want to name it Cryptodisk. The name doesn't matter, it's just for the system to find the device
$sudo cryptsetup luksOpen/dev/sdb1 Cryptodisk
Cryptsetup asks for the Passphrase. After successfully opening the device, it will be listed as /dev/mapper/Cryptodisk
Now we create a filesystem. I chose xfs because it's a nice working horse, that runs everywhere, but you can choose whatever you want.
Great, now you've created the filesystem. Close the disk with cryptsetup
$sudo cryptsetup luksClose Cryptodisk
Wait until everything on the disk has been written (it stops flashing, depending on your disk) and unplug the disk.
The next time you plug your disk in, it will be recognised by caja/nemo as Encrypted Device, you type in your Passphrase and it will be automatically mounted (or with cryptstetup luksOpen and mount but the purpose was to create a convenient way to work with your external disks).
Congratulations, you just created your first fully encrypted external HDD!
The headline picture was created btw. by using the amazing dekryptize tool - a really cool ncurses animation to show how decrypting is definitely NOT working 😉
I've just got a brand new Raspberry Pi 4. For now I'm just playing around a bit with it. Until openSuSE Leap will be available, I'm using Raspbian Buster which comes by default with ext4. Since I want to have snapshots, the first thing I want to do is to convert the existing root partition into btrfs. So let's do this.
0. Get Raspbian
First, flash Raspbian to a SD card and boot it. I also recommend to run a system update after booting into Raspbian. There are plenty of tutorials on the internet, that are probably far better than what I can write.
1. Prepare initramfs
In Raspbian btrfs is included as module. In order to make the kernel mount a btrfs root filesystem, we need to build the corresponding initramfs. First install the necessary tools
sudo apt install initramfs-tools btrfs-tools
Now we add the btrfs module to /etc/initramfs-tools/modules
Next is to build the initramfs
And tell the bootloader to load the initramfs, by editing /boot/config.txt
# For more options and informations see
# Some settings may impact device functionality. See link above for details
And then reboot the device, to check if everything is set up properly. If the boot succeeds, shutdown the Raspberry and take the SD-Card to another computer. If you run at this stage into trouble, probably a filename is wrong and you should be still able to recover. Otherwise: Just start from scratch - at this point really nothing is lost.
2. Convert ext4 rootfs to btrfs
In my case I insert the SD card into my laptop. The SD card gets recognised as /dev/mmcblk0 and contains the following partitions:
I just wrote a small Bash script for creating offline-backups of a bunch of virtual machines on a server using btrfs snapshots.
The script shutsdown all running KVM machines, waits until they are down, creates a (readonly) btrfs snapshot and spins the machines back up. All together takes less than a minute. After the process I have an image of all KVM machines in the state, when the machines are shut down. This is then suitable for storing the machine image files on a different machine to have a complete working state of the machines. This is part of my backup (more hardware failure) strategy for one of our general purpose servers at work.
The KVM instances need to be in a btrfs subvolume, otherwise it doesn't work
See the script as gist on GitHub. You will need to do some adjustments and probably test it a couple of times, until it will work nicely.
I just recently got a new Laptop (a T440p) to test it, if it suits my needs. The old x220 is still a nice companion, but I kind of need a bit more horsepower on my daily companion.
Let me tell you something about the magic of Linux - I just removed the old SSD from my x220 and put it into the T440p. It booted out of the box, with all my configurations and everything in place. No need to reconfigure or even reinstall anything. I could be productive in a couple of minutes. Also transferring the SSD was a matter of some screws, so no problem at all. That's how it should be. That's one of the reasons, why soldered-in SSD suck so badly.
So, everything was working nicely, except for some reason NetworkManager seemed to have forgotten all the Wifi connections. Except, they were still there and configured, just for the Wifi interface of the other laptop. And reconfiguring all of them is kind of boring. There has to be a better way
NetworkManager & System connection
NetworkManager stores all the connections in /etc/NetworkManager/system-connections. They are there as plaintext files (restricted to root through)
Turns out, the line we need to change in every file is the following
This is the mac-address of my old laptop, and I just need to replace it with the MAC of my new laptop. Easy as goo pie. The following one-liner does the job. Remember to replace YY:YY:YY:YY:YY:YY with the MAC address of your laptop
My Pull-Request for including the CCfits package in Spack has just been merged into the development version. Very nice!
I use spack extensively on our scientific clusters in order to provide environment modules with various software packages (and versions) to our users. And because we need the CCfits package, I've created this package for spack. Now it's upstream and I hope that it makes the work of many other system administrators easier.
This blog post is about getting Kodi up and running with Netflix on Raspbian. This is not a tutorial, more a collection of notes for myself in order to reproduce the setup.
Get a recent version of Raspbian from the Raspberry Pi website. (Or my ftp mirror). Extract it to a fresh micro-SD card and get the system ready. Follow this guide, if you need help. Boot into the system and run a update and install some handy tools
sudo apt update
sudo apt upgrade
sudo apt install git tmux screen htop iftop iotop
usermod-aG audio,video kodi
Next, we are gonna harden the system. For that do the following
The Netflix Plugin is hosted on GitHub. Download the plugin and install the zip-file. Best option seems to be to put it on a USB-Stick and install it from there. This plugin needs parted or fdisk, you install them on your kodi and then let the plugin install the widevine library, necessary for the DRM. The DRM is by the way also the thing, that was in the way of getting Netflix work in the first place. And it's still a bit of a mess, since we are using here a extraction of the libwidevine from the chromecast.
Well, as long as it works, but it's not nice and probably creating causing one or two times headache until it finally works.
Allow Kodi to reboot and shutdown
This is now more a quick fix, based on the suggestion from here. The original clue was posted long time ago on the kodi forums, but those posts were only of limited help. So, create the following file
I encountered the problem, that if Kodi runs for too long (multiple days), the Netflix plugin stopped working. No errors given, it just won't play a movie again. A quick fix is to schedule a reboot every night using a cronjob
# Reboot the system every night at 5am
This is of course just the basic installation. You will need to configure Kodi to your needs (Skins, Addons, Timezone, connect your NAS, ...)
Also, I might create an ansible-playbook to setup this procedure. This looks like a fun project to do on a rainy Sunday.
Disclaimer: I don't want to blame anyone. I love btrfs and would very much like to get it running in a good manner. This is a documentation about a use case, where I have some issues
I am setting up a new server for our Telescope systems. The server acts as supervisor for a handful of virtual machines, that control the telescope, instruments and provide some small services such as a file server. More or less just very basic services, nothing fancy, nothing exotic.
The server has in total 8 HDD, configured as RAID6 connected via a Symbios Logic MegaRAID SAS-3 and I would like to setup btrfs on the disks, which turns out to be horribly slow. The decision for btrfs came from resilience considerations, especially regarding the possibility of creating snapshots and conveniently transferring them to another storage system. I am using OpenSuSE 15.0 LEAP, because I wanted a not too old Kernel and because OpenSuSE and btrfs should work nicely together (A small sidekick in the direction of RedHat to rethink their strategy of abandoning btrfs in the first place)
The whole project runs now into problems, because in comparison to xfs or ext4, btrfs performs horribly in this environment. And with horribly I mean a factor of 10 and more!
The results as text are listed below. Scroll to the end of the section
I use the tool dbench to measure IO throughput on the RAID. When comparing btrfs to ext4 or xfs I notice, the overall throughput is about a factor of 10 (!!) lower, as can be seen in the following figure:
sda1 and sda2 are obviosly the same disk and created with default parameters, as the following figure demonstrates
My first suspicion was, that maybe cow (copy-on-write) could be the reason for the performance issue. So I tried to disable cow by setting chattr +C and by remounting the filesystem with nodatacow. Both without any noticeable differences as shown in the next two figures
Hmmmm, looks like something's fishy with the filesystem. For completion I also wanted to swap /dev/sda1 and /dev/sda2 (in case something is wrong with the partition alignment) and for comparison also include ext4. So I reformatted /dev/sda1 with the btrfs system (was previously the xfs filesystem) and /dev/sda2 with ext4 (was previously the btrfs partition). The results stayed the same, although there are some minor differences between ext4 and xfs (not discussed here). The order of magnitude difference between btrfs and ext4/xfs remained
So, here are the results from the figures.
/dev/sda1 - xfs
Throughput 7235.15 MB/sec 10 procs
/dev/sda2 - btrfs
Throughput 623.654 MB/sec 10 procs
/dev/sda2 - btrfs (chattr +C)
Throughput 609.842 MB/sec 10 procs
/dev/sda2 - btrfs (nodatacow)
Throughput 606.169 MB/sec 10 procs
/dev/sda1 - btrfs
Throughput 636.441 MB/sec 10 procs
/dev/sda2 - ext4
Throughput 7130.93 MB/sec 10 procs
And here is the also the text file of the detailed initial test series. In the beginning I said something like a factor of 10 and more. This relates to the results in the text field. When setting dbench to use synchronous IO operations, btrfs gets even worse.
Phoronix did a comparison between btrfs, ext4, f2fs and xfs on Linux 4.12, Linux 4.13 and Linux 4.14 that also revealed differences between the filesystems of varying magnitude.
As far as I can interpret their results, they stay rather inconclusive. Sequential reads perform fastest on btrfs, while sequential writes apperently are horrible (Factor 4.3 difference).