Bye backups… hi ZFS snapshots!

Today an entire folder disappeared from my Owncloud instance. It is an entire mystery why has disappeared. And I haven’t backups since owncloud data supposedly is synced between all client computers…

But, who wants backups when you have ZFS snapshots? I have all my private Owncloud data into a ZFS volume, and a cron job that do snapshots at midnight. Unlike Solaris, ZFS on Linux doesn’t have snapshotting natively so we have to use this set of pretty scripts: zfs-auto-snapshot

ZFS snapshots can be accessed like if they were a regular filesystem and they show you the files as it were just at the snapshot moment. The good thing is that the space occupied is *very* low (only stores changed data like it were an incremental backup).

So you only have to copy the missing data from the snapshot folder into the original place.

zfs list shows us all the datastores, mountpoints and snapshots:


We want to restore the latest snapshot from May 12th at 04:25am. First we have to ensure that snapshots are visible to us. We’ll set RomaniHD/Magatzem datastore to show snapshots. It will be located hidden on the datastore root (/datastore/.zfs)


Voilà, we have a virtual copy of our datastore of the last week:

Now we have to enter the desired folder (day) and copy the contents into the correct place.

In my case, I restored Owncloud data, so after copying the missing data I had to do a content refresh. First become www-data user and tell owncloud to refresh its entire data folder:


Streaming audio to two different targets (or networks)

It may sound strange, but one radio station (or somebody) may want to stream audio to two different networks. I had this special need in Boca Ràdio (a local Radio Station from Barcelona) because this station broadcasts through a provider and also broadcasts into (A community based, open and neutral network).

So, the box that transcode analog audio coming from the station’s sound mixer, it has to send it to:

  • Streaming provider in Shoutcast format
  • Localhost in Icecast format. In the same box there is an Icecast server listening to Guifi network clients. (Note that Icecast server may be running on another location).

I utilize this little transcoder: Darkice that reads configuration from /etc/darkice.cfg and sends analog audio coming from the Soundboard to the specified targets and in the specified format. It is available in Debian repo.

Configuring Icecast server is pretty straightforward but be sure that this items are properly configured:


Multiple internet WAN at home or office

It’s not uncommon to see on many offices that the Internet connection comes from several WAN connections (for redundancy, or whatever). Even on the more freak homes I’ve seen a multiwan setup (i.e., one wan from the ISP, other from a vpn, and other wan being stolen from the neighbors).

I know three methods for managing automatically more than one WAN connection. Best yet, automatically but meeting several rules (i.e.: youtube transit sent to wan1, bittorrent to wan2 and HTTPS transit to wan3).

Method 1: RouterOS PCC

Mikrotik routers can handle natively a multiwan setup through PCC (Per Connection Classifier). Packets must be marked with a routing mark and then the PCC chosses where to send them. Best references:

Method 2: OpenWRT MWAN3

MWAN3 is a package for OpenWRT that do the job and can be configured in a easy and visual way. So you need a powerful router fully compatible with OpenWRT and MWAN3. I have an ex-coworker that uses this stuff and wrote this excellent post:

Method 3: Linux

Method 1 and 2 requires a special router, but this method only requires a Linux Box with two or more ethernet cards. I’ve not tested it but it seems very interesting because it’s not hardware-dependant. In fact, that software is designed for, given more than one WAN connection, discard the first that gets disconnected (hence the title of the project).

FTTH a la porta de casa

Qui m’ho havia de dir, que en un poble de 15.000 habitants a 40km al nord de Barcelona… em posarien una caixa de distribució de FTTH just a 20cm del meu balcó! Doncs sí, ja ha arribat la FTTH a Canet de Mar.

De totes formes, actualment amb una ADSL de Pepephone per 23€ mensual que m’aporten 9mbps de baixada i 1mbps de pujada….no crec que cap solució amb FTTH arribi en aquests preus tant econòmics i per tant, ADSL fins que el coure ens separi!

Powering a 79xx Cisco Phone with a Standard POE

A VoiP Phone Cisco 7040G arrived to my home (on another post I’ll explain why/how/etc) and the big surprise was that it has to be fed with an special POE from Cisco. It’s called pre-standard POE. I have a standard POE (802.3af) that fed properly my previous VoIP phone… and after connecting it to the 7940, the phone won’t boot up… Continue Reading →

Torna a veure la llum!

Després de la mort del veterà blog tecnològic (2002-2009), i després d’uns anys sense gaire activitat al web, he pensat que potser és hora de tornar a mantenir un blog tecnològic.

La idea és que ara sigui el “meu” blog tecnològic: experiències, opinions i d’altres temes sempre vinculats amb la tecnologia i sempre amb la vessant d'”utilitat pública”. O fins i tot utilitat per a mi mateix, el dia de demà (la típica comanda de Linux que descobreixes, la perds, i et tornes mico tornant-la a cercar).

Val a dir que el domini .CAT ha desaparegut per a sempre (al morir el blog ja no el vaig renovar, i com no, just després el va pillar una tercera persona). A banda, prefereixo mantenir el .info ja que probablement publiqui en anglès (per no rovellar el meu deteriorat anglès..). Per tant, el blog tornarà als orígens amb el domini, que per cert és el primer que vaig tenir (any 2002) i ja el mantindré per sempre per motius històrics.