The Myth of Redundancy

In Uncategorized on 15/12/2015 by weirdfellow

I have just read an interesting article: and I am nothing but shocked and astonished…

Astonished how the maths has became a weird, mysterious artefact of the past and logical thinking is now passé. C’mon SMB IT guys – I expect more from writers of such long essays.

Long story short – author claims that today, with massive discs of terabytes, RAID5 did loose its appeal and does not provide sustainable data protection.

I don’t argue with that. Even without huge experience with RAID5 I can imagine that it might be very hard to successfully resilver such array when one drive dies:

  • not only resilvering slows the array down, but it also stresses it much more. That combined with other factors, such as age of the drives means that the failure of second drive during resilvering is much more probable.
  • there is also the case of URE (Unrecoverable Read Errors) which severity I don’t really understand.
    I accept the fact that current implementations will fail the array when during resilvering when an URE happens, but this is just a limitation of the software. URE during resilvering does not destroy the data – it is still there, in exactly same state as it was before an URE. Why the array does not just drop the resilvering and put the array in “unrecoverable/online” state? Data would still be accessible!

But that’s not what did strike me… The author went further and suggest that RAID5 is so bad, that even RAID0 provides better protection. What a blunt piece of nonsense…

To the calculators!

Let’s do some calculations (Bernoulli trial to be precise)… We’ll be using the 3% annual fail rate of a harddrive in RAID0, as stated in the article. I’ll bump the failure rate to 4% for RAID5 – as the initial build puts some stress…


Probability of a 8 disk RAID0 array surviving a year (no hard drive failure) equals 78%. Thus probability of failing within a year is 22%.


Probability of a 9 disk RAID5 (to provide as much capacity as 8 disk RAID0) array surviving a year (0 or 1 harddrive failures) can be calculated by calculating the simpler, non overlapping cases and adding the probability:

  • zero HDD failures: 69%
  • one HDD failure: 26%
  • zero or one hdd failure: 69%+26% = 95%
  • probability of RAID5 failure within a year  – 5%

You can verify above figures by using piece of paper (the formulas are in the previously linked Wikipedia page) or an online calculator.


RAID0 is more than 4 times more prone to failure than RAID5 (and that goes up to 7 times should I use the 3% failure rate).

Please, don’t believe in some mumbo-jumbo… Believe in numbers… As flawed RAID5 is today, it still much more reliable than RAID0.



DHCPv6 and RA with dnsmasq

In Uncategorized on 05/09/2014 by weirdfellow

Dnsmasq has been a good companion of small network administrators for years. It proved to be a swiss knife for the IPv4 networks, providing DHCP and DNS services…

The IPv6 is coming, whether you like it or not… And dnsmasq can help here too, by providing both DHCPv6 and RA services.

However, there is a bit of confusion what the options flags in dhcp-range setting mean. Man pages help just a tiny bit…

I’ve recently spend some time spoofing the packages and came up with the following results. The table below shows how the M (Managed Address Configuration Flag), O (Other Configuration Flag) and A (Address Configuration Flag) bits. I’ve skipped the O flag when M is set – in such scenario it can be ignored because it does not carry any meaningful information.


Options___________________ M O A______ Comment
no options

+ SLAAC disabled, stateful DHCPv6. This is identical to DHCPv4 service

+ + SLAAC enabled, stateful DHCPv6. Hosts will have at least two addresses – from DHCPv6 and SLAAC

+ + SLAAC enabled, stateful DHCPv6. Based on the information received from host while DHCPv4 request, DNS tries to guess the auto-configured IPv6.
ra-stateless + + SLAAC enabled, stateless DHCPv6. Hosts will get only auto-configured address and get additional configuration from DHCPv6
ra-stateless,ra-names + + SLAAC enabled, stateless DHCPv6. Hosts will get only auto-configured address and get additional configuration from DHCPv6. DNS will try to guess the auto-configured addresses.
ra-only + SLAAC enabled, DHCPv6 disabled. Hosts will get only auto-configured address. DNS might get configured by ND RDNSS.


Have also in mind that Windows hosts (by default), in order to protect privacy, do two additional things:

  • don’t follow EUI-64 and use different way of generating addresses when doing autonomous configuration. This means that setting the ra-names option will have no effect – DNS will not guess correctly the IPv6 address of those machines, so no entry in DNS will be populated. This behaviour can be changed and revert to EUI-64 by executing netsh interface ipv6 set privacy state=disabled command.
  • configure additonal IPv6 address – so called temporary address – and prefere it when initializing outgoing connections. Again, this can be switched off by executing netsh interface ipv6 set global randomizeidentifiers=disabled

Some android hosts (exp. my Nexus 7 running 4.4.4) still cannot be configured by stateful DHCPv6. The only supported way is SLAAC. My ZTE phone, running 4.2.1, successfully receives the unicast address when SLAAC is not allowed on the link…


Jetbrains in Unity integration

In Java, Ubuntu on 02/07/2012 by weirdfellow Tagged: , , , , , ,

I really really love products by . Those guys really know what a developer expects, needs and they deliver. However, the IDEs (I have been using IntelliJ IDEA, as well as PhpStorm) don’t integrate with Unity that well – it’s not possible to pin the icon to launch bar, the windows do not merge and you get duplicate icons etc.

To tackle this problem, you can create custom launchers and drop them into /usr/local/share/applications (you might need to create this directory first).

IntelliJ IDEA.desktop

[Desktop Entry]
Name=IntelliJ IDEA Community Edition
GenericName=Java Editor
Comment=Develop with pleasure!


[Desktop Entry]
GenericName=PHP Editor
Comment=Develop with pleasure!

The important thing is the StartupWMClass – it allows Unity to identify the windows and connect them to icon in the launcher, so that they merge nicely… Small thing, but makes me so much happier 🙂


Cannot open Name index using db3

In Ubuntu on 28/09/2011 by weirdfellow Tagged:

I am using Ubuntu 10.04, but often have to work with RPMs – see what’s inside or get the content. And errors drive me crazy – “Cannot open Name index using db3 – No such file or directory (2)” especially.

Eventually I figured it out. If you are getting it, that means the file /var/lib/rpm/Name is missing.

Because I am on Ubuntu and don’t really depend on RPMs databases, I purged the whole /var/lib/rpm directory, and then ran rpm --rebuilddb to recreate them. This created empty /var/lib/rpm/Packages file. Now just copy it as /var/lib/rpm/Name.

Error free environment 🙂


Compressing RAM with zRam

In Ubuntu on 04/05/2011 by weirdfellow Tagged: , , , , , , ,

A successor to compcache, zram, has been already integrated in the Linux kernel for a while now. This means that no additional compilation nor tweaking is required to benefit from compressing memory on the fly and massively reduced swapping.

As with compache, I wanted to nicely integrate the solution into the Ubuntu Upstart deamon – hence this short article. After a couple of minutes of playing the configuration was ready.

Create file zramswap.conf in /etc/init and put the following content in it.

description "Initializes zram swaping"
start on runlevel [2345]
stop on runlevel [!2345]
pre-start script
# load dependency modules
modprobe zram num_devices=2
# initialize the devices
echo 1073741824 > /sys/block/zram0/disksize
echo 1073741824 > /sys/block/zram1/disksize
# Creating swap filesystems
mkswap /dev/zram0
mkswap /dev/zram1
# Switch the swaps on
swapon -p 5 /dev/zram0
swapon -p 5 /dev/zram1
end script
post-stop script
# Switching off swap
swapoff /dev/zram0
swapoff /dev/zram1
rmmod zram
end script

Now you can start the service with sudo start zramswap (it will be automatically started on after the reboot as well).
You will benefit from 2x1GB swap files, which will be compressed and stored in the RAM. Tested on Ubuntu 11.04.


I don’t believe in Groovy

In Java on 31/10/2010 by weirdfellow Tagged: ,

I always try to stay on the open minded part of the population. I have been trying with Groovy too… Half year later I can state – it is a fancy toy that looks great in the sample, but not a generic purpose language.

Groovy advocates usually have following reasoning:

Static typing doesn’t give any benefits – you have to unit test anyway
I am almost certain that nobody will ever hear from me that testing is unnecessary – quite the opposite.
But type checking allows to instantly identify a whole bunch of common coding mistakes, without need to wait for the tests to execute (and those can take some time)…

Java is too verbose, Groovy is much more compact.
Let’s make the identifiers optional wherever there is only one token in scope that fits! Compiler can figure things out and the code will be 17 bytes shorter!!! All this time I would have spent so much time on pressing the space…

Java is verbose – but what is wrong in being verbose? The more compact code, the more comments are required and it the end it sums up to the same number of bytes. I could start writing a more verbose, self explanatory Groovy code too. In other words – to make a code that is easier to read I would have to discard the compactness of Groovy. In such case – why bother with Groovy at all?

I don’t deny Groovy the right to exist – I definitely can see its the benefits. There are even things in Groovy I really like. Closures. Compact syntax for creating instances of ArrayList and HashMap. XML parsing. Groovy definitely can be useful.

However I am certain that those are only the situations when once you got working code, you never touch it again… Projects when the functionality has to be there now, and will be thrown away week later. Or tiny, very specialized classes you can throw away when they need to change and write them again. Refactoring a Groovy code will be a nightmare – because of its dynamic nature.

So – if doing anything with longer time frame, anything that might get refactored – keep away from Groovy.


Patching Cairo

In Ubuntu on 01/08/2010 by weirdfellow

I had it enough… GTK applications are respecting some of the Fontconfig setting (you can switch antialias or hinting on/off), but others were just ignored (it wasn’t possible to specify hintstyle or switch between grayscale and subpixel antialiasing)… Not only I have had issue with that – in my case the “quasi-bitmap” fonts used for programming look much better with grayscale AA. There were some ad-hoc patches, for instance cairo-respect-fontconfig, but they don’t really fix the problem – just sweep the problem under the carpet.

First of all I had to decode what is used to render fonts in Gnome. After identifying that the bugs are in Cairo, I decided to compile it myself. After a bit of the struggle with missing libraries – thank you Ubuntu for Synaptic Package Manager – I managed to compile Cairo 1.8.10. I have applied patches shipped with Ubuntu and started to look into the problems.

The functions dealing with properties returned by Fontconfig have been rewritten and profusely commented – patch file and binary package available to download below.

Be aware: After the installation, you might notice that the Appearance panel seems not to work. This behavior is intentional and absolutely OK.
Gnome does not save it’s settings in Fontconfig registry, and by default Fontconfig comes with some settings – they are stored in files in /etc/fonts/conf.d. By default they cover switching on antialiasing (10-antialias.conf) and switching on slight hinting (10-hinting-slight.conf). In the result Fontconfig will always override those two settings.

As a workaround, remove those two mentioned symbolic links, and the panel will start to behave correctly again. Files 10-hinting.conf and 11-lcd-filter-lcddefault.conf are ok and should stay in /etc/fonts/conf.d. The long term solution would be for Gnome to save the font settings in the Fontconfig registry too – I am working on the plug-in for gnome-settings-daemon, that would do this.


The source of Cairo is available from the project homepage, but I downloaded the source package from Ubuntu launchpad – this version does not require autoconf, you can just call ./configure.


Ubuntu patches are to be downloaded from here. Each patch is to be executed from cairo-1.8.10 directory in following manner:
$ patch -p 1 <path-to-the-patch-file. After applying Ubuntu patches, you can apply my patch.


My version of library would compile, but it was much bigger than the one shipped within distro. Setting environment variables to skip debug information and add some optimizations prior executing configure (export CFLAGS='-Wall -g0 -O0 -O2') helped a lot. After successful execution of configure and make, the result can be found in src/.libs directory. Copy it into the /usr/lib folder and restart X.

Results and downloads

Finally I have fonts that work as I want.

Patch file from Rapidshare
Binary package from in progress.