Category: administration

Undelete Files with SnapRAID

Today I accidentally deleted a whole folder of important documents on my OpenMediaVault(OMV) NAS, while doing some cleaning up.
Of course I would have a backup of the folder on an external hard-drive, but this was the perfect opportunity to test SnapRAID.

SnapRAID is a software RAID which comes as a plugin for OMV. SnapRAID computes redundancy/parity information for the files stored on multiple data disks. This redundancy/parity must be stored on a separate disk. If one data disk fails, the lost data on that disk can be reconstructed from the redundancy/parity information and the other remaining data disks. SnapRAID is quite flexible and allows any number of data disks and redundancy disks and a lot of options, which I haven’t even looked at to be honest.
The most important difference to other RAID systems is that SnapRAID is an offline RAID. This means SnapRAID will not constantly monitor disks and update the redundancy in real-time. Instead you are required to run SnapRAID manually every couple of days/weeks or schedule a cronjob to periodically update the SnapRAID parity disk.

Enough of that, here is how a deleted file or folder can be restored. The SnapRAID plugin for OMV allows to do this from the web UI, but I ended up using the shell anyway.

To check which files have been removed (or added) since the last parity update:
$> snapraid diff --test-fmt path
$> snapraid diff --test-fmt disk

To fix an entire array, i.e. fix everything that is missing:
$> snapraid fix -m
To fix everything on one disk (example disk name “MyDisk2” as assigned during SnapRAID creation):
$> snapraid fix -m -d MyDisk2
To fix a folder with a given name (located on any data disk):
$> snapraid fix -m -f myFolder/
or a file:
$> snapraid fix -m -f myFile
To just check what SnapRAID would do instead of fixing errors right away do:
$> snapraid check -m -f MyFile -v

After a couple of minutes my folder was back where it belonged. Feels good to be prepared for mishaps like that 🙂


WSL on Windows 10

There is a new kid in town when it comes to “doing Linux under Windows”. Up to now there was primarily Cygwin and MinGW. But for a while now Microsoft offers the Windows Subsystem for Linux (WSL). I personally think the name should be the other way around (LSW) but what do I know.

To enable WSL under Windows 10 you first need to enable the required feature.
1. From the start menu go to “Apps and Features”
2. Scroll to the bottom and select “Programs and Features”
3. Click “Turn Windows features on or off” on the left side.
4. Set the check mark on “Windows Subsystem for Linux”
5. Finally a reboot is required for the changes to take effect.

That’s it. Almost. Now we need to install a Linux distribution to run. WSL only brings the environment for Linux to “run on” Windows 10, but there is no default distro included.
The easiest way is to go the App Store and install one of the available distros, like Ubuntu 18.04.
Alternatively you can download the required .appx package and install it manually using the PowerShell (Administrator permissions required) with
Add-AppPackage <filename&gt;.appx

Let’s see when Windows will completely adopt the Linux Kernel.

How to set up NordVPN on Ubuntu

There are two ways to set up a VPN connection with NordVPN on Ubuntu. The first one is to add NordVPN’s package repository to the apt sources and then install the nordvpn client via a simple sudo apt install nordvpn. The second one is to install OpenVPN and configure it to use the servers of NordVPN.
This how-to was written for Ubuntu 18.04 LTS (Bionic Beaver).

NordVPN setup with NordVPN package repository

  1. Download the NordVPN package (.deb) for Ubuntu:
  2. Install the package on your Ubuntu system:
    sudo dpkg --install ./nordvpn-release_1.0.0_all.deb
    Note that installing this package does only add the NordVPN package repository to apt, no executable is installed.
  3. Install the nordvpn client software:
    sudo apt update
    sudo apt install nordvpn
  4. Connect the nordvpn client (the server is selected automatically):
    nordvpn connect
    The general command to connect has the form:
    nordvpn connect [<country&gt;] [<city&gt;] | [server]
    so to connect to a specific country (and city) the additional arguments must be given:
    nordvpn connect United_Kingdom Manchester
    To get a list of available countries and cities you can query them with:
    nordvpn countries
    nordvpn cities
    It is also possible to give the server name directly:
    nordvpn de442

NordVPN setup with OpenVPN

  1. Install openvpn on your Ubuntu system:
    sudo apt install openvpn
  2. Get the OpenVPN configuration files for NordVPN:
    cd /etc/openvpn
    sudo wget
    sudo unzip ./
    If an error is encountered during the download step above, it may be necessary to install the ca-certificate package:
    sudo apt-get install ca-certificates
    After unzipping there will be a folder ovpn_tcp and ovpn_udp which contain the NordVPN server configuration files for OpenVPN.
  3. Connect to OpenVPN using one of the NordVPN servers:
    openvpn /etc/openvpn/ovpn_udp/
    You will need to enter your credentials for NordVPN.

Installing Altera Quartus Prime on Fedora 23

Installation did run without problems.
Executing &gt;&gt;quartus from the ~/altera/15.1/quartus/bin folder has no effect whatsoever, no error is printed on the command line.
Adding the above path to $PATH has no effect.
Running &gt;&gt;quartus 2&gt; quartus.stderr to redirect stderr to a file uncovers the following error:

&gt;&gt;cat quartus.stderr
&gt;quartus: error while loading shared libraries: cannot open shared &gt;object file: No such file or directory”

Aha, so a file is missing, why can’t quartus just tell me this?

&gt;&gt;sudo dnf search libpng12
&gt;libpng12.i686 : Old version of libpng, needed to run old binaries
&gt;libpng12.x86_64 : Old version of libpng, needed to run old binaries
&gt;libpng12-devel.i686 : Development files for libpng 1.2
&gt;libpng12-devel.x86_64 : Development files for libpng12

&gt;&gt;sudo dnf install libpng12

Ok let’s try again…


Finally, it works.