ZFS convert stripe to striped-mirror

OpenZFS LogoI’m a huge fan of ZFS because of its performance and other features like snapshots, transparent compression. In fact I had switched to FreeBSD for servers just because it had native ZFS support. But as of Ubuntu 16.04, ZFS is officially supported for non-root partitions.

Now I’m migrating a FreeBSD server to Ubuntu 16.04 with ZFS for data storage – this is happening because I need support for some special hardware which has drivers only for Linux and I do not have a spare server machine of same capacity in terms of memory/disk/processor.

My case –
Here’s the zpool layout on my existing FreeBSD server:

Each of those disks are 1TB in size and the layout here is something known as RAID 10, or striped mirroring. Striped mirroring can be extended to more than four disks but in my case, I have two pairs of disks. Each pair is mirrored and the each such mirror is striped, illustrated as in the image below:

Image taken from techtarget.com, their trademark/copyright holds.

The advantage of this layout is that you get read speed of four disks, and write speed of two disks and a failure tolerance of two disks (but in different mirrors) at the same time.

I have a spare 1TB disk which I can use for preparing a new server using a low-end machine for migration. I remove one of the disks from the live server so the pool there runs in a degraded state. The removed disk is used in the new server. So I create this zpool in Ubuntu:

The pool created here is a plain simple stripe. To convert this into a striped-mirror, the zpool attach command has to be used:

With this, the pool now becomes a striped mirror:

Perfect! 😀

 

SystemD FastCGI multiple processes

Of late, many mainstream distributions have been switching to SystemD as their init system. This includes Debian (since Debian 8) and Ubuntu (since Ubuntu 15.04). In the traditional SysV init system we used to have stuff like spawn-fcgi or custom scripts for starting a FastCGI process and having the web server connect to it over Unix or TCP sockets. Such kind of usage decreased when PHP FPM was introduced since it’s safe enough to assume that 90% (probably more) of the FastCGI deployments are just launching PHP interpreters using whatever mechanism is there (spawn-fcgi or custom scripts). PHP FPM does this for you now and it’s pretty good at it.

FastCGI is just a protocol, it can be used by any application. For custom applications which do not support starting their own FastCGI processes and listening on a socket we have to use external mechanisms. SystemD has a couple of good features which can help reduce the amount of custom work needed in terms of process monitoring, socket paths, file ownership, etc.

Continue reading “SystemD FastCGI multiple processes”

99% problems in electronics are related to power supply

Arduino FTDI chip

My dad, who has worked a lot in electronics always says this one thing:

99% of problems in electronics are because of a bad power supply

Today, a real experience of this: In 2014 I bought a GSM signal booster to solve the call drop problem at home. It was working fine for all these 2 years, but since a few weeks the calls started dropping again. The booster had come with an 5V 1A adapter which powered it and I never switched off the booster. When I went to check it, the small screen on it showing the signal strength was blank and even after restarting it a couple of times it didn’t turn up again.

So I replaced the power adapter with my old Nexus 4 charger which can supply 1.2A at 5V. And boom, it works. Signal strength improved and calls are clear again. So always need to keep this in mind, whenever there’s a problem in electronics, first check the power supply.

Results of an online survey about preferred tyres

I am facing some instability on my car rides and after showing it to numerous mechanics, wheel alignment centers everyone said the same: The tyres have gone bad and they need replacement. The car hasn’t had that much running to justify a tyre replacement so I started looking online for solutions. Finally I have to conclude after much online research that the tyres have gone bad.

With so many tyre brands available in the market at different price points it’s difficult to make a good selection by just reading stuff online and knowing about experiences of friends / mechanics. In a commission driven business model like India where every tyre vendor sells tyres of every company they would obviously try to sell the tyre that will fetch them most profits (exceptions exist, I know!). So to make a good choice I decided to run a survey on Twitter and Reddit. Posting the results of the same. I received total 41 responses.

Continue reading “Results of an online survey about preferred tyres”

Call Rate comparison: Per second vs Per minute

A simple graph I made using spreadsheet to compare call rate in per second vs per minute. There was a similar graph somewhere around, but I lost the link and hence I made my own graph 😛

call_rate

1.5 paisa/second and 45p/minute are common rates in per second and per minute plans offered across India, so used that as base for creating my graph. If you are interested in downloading the spreadsheet I used for this calculation, you can do so here. It’s an OpenDocument Spreadsheet. I don’t use Windows nor MS Office. 🙂