<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Gionn.net]]></title>
  <link href="http://gionn.net/atom.xml" rel="self"/>
  <link href="http://gionn.net/"/>
  <updated>2013-05-18T11:23:34+02:00</updated>
  <id>http://gionn.net/</id>
  <author>
    <name><![CDATA[Giovanni Toraldo]]></name>
    <email><![CDATA[giovanni@toraldo.net]]></email>
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[From Drupal to Octopress]]></title>
    <link href="http://gionn.net/2013/01/05/from-drupal-to-octopress/"/>
    <updated>2013-01-05T13:55:00+01:00</updated>
    <id>http://gionn.net/2013/01/05/from-drupal-to-octopress</id>
    <content type="html"><![CDATA[<p>During these Christmas Holidays, I&rsquo;ve decided to migrate this blog from <a href="http://www.drupal.org">Drupal</a> to <a href="http://www.octopress.org">Octopress</a> (after 2 years of goodwill).</p>

<p><em>Octopress</em> is quite popular among opensource developers since its include all the features needed to maintain a <em>simple blog</em> plus some extensions like <em>source code syntax hilight</em>, social networks integrations and support to deploy on <a href="http://pages.github.com/">GitHub Pages</a> and <a href="http://www.heroku.com/">Heroku</a> (both free).</p>

<p>I should say that Octopress isn&rsquo;t a CMS as many of you can imagine, but a static html pages generator. This may sounds oldie, but Octopress leverage some existing tools, and <a href="https://github.com/imathis/octopress">you will like it</a>.</p>

<p>The following is a <em>Google Webmaster</em> graph, the performance gain was from an <strong>average of 600 ms</strong> for page retrivial with Drupal (with caches) to an <strong>average of 120 ms</strong> with Octopress.</p>

<p><img src="http://static.gionn.net/images/gionn-from-drupal-to-octopress.png"></p>

<p>To migrate existing posts from Drupal 7, I&rsquo;ve used a slightly modified version of an existing migration script. Put your mysql connection details and execute it, it will generate a bunch of files to put inside the <strong>source/_posts</strong> folder of your Octopress.</p>

<!--more-->


<div><script src='https://gist.github.com/4370206.js'></script>
<noscript><pre><code></code></pre></noscript></div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Cloud Computing in practice with OpenNebula ~ Develer workshop 2012]]></title>
    <link href="http://gionn.net/2012/12/01/cloud-computing-in-practice-with-opennebula-develer-workshop-2012/"/>
    <updated>2012-12-01T00:00:00+01:00</updated>
    <id>http://gionn.net/2012/12/01/cloud-computing-in-practice-with-opennebula-develer-workshop-2012</id>
    <content type="html"><![CDATA[<p>These months have been quite busy for me, but I always try to find some time to seed on local communities the knowledge of some particular Open Source software, especially for OpenNebula (someone called me <em>evangelist</em>, but it is really too much for what am I doing).</p>

<p>On 26 Novembre 2012 I carried out a workshop, sponsored by <a href="http://www.develer.com">Develer</a> (offering space, organization and drinks), that attracted <a href="http://workshop.develer.com/ilcloudcomputingriempielaplatea/">quite many people</a> around the Florence area, spending a nice evening discussing about Cloud Computing with OpenNebula.</p>

<p>The presentation covered some basic topics, like what OpenNebula is and why users should use it, and continued with a live demo using the <a href="http://www.opennebula.org/cloud:tryout">OpenNebula Sandbox VM</a>.</p>

<script async class="speakerdeck-embed"
data-id="9e3d9a901a470130ab9412313d2a40b3" data-ratio="1.33333333333333"
src="http://gionn.net//speakerdeck.com/assets/embed.js"></script>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Using Twitter as notifications transport for Nagios or Icinga alerts]]></title>
    <link href="http://gionn.net/2012/06/24/using-twitter-as-notifications-transport-for-nagios-or-icinga-alerts/"/>
    <updated>2012-06-24T00:00:00+02:00</updated>
    <id>http://gionn.net/2012/06/24/using-twitter-as-notifications-transport-for-nagios-or-icinga-alerts</id>
    <content type="html"><![CDATA[<p>Are you wondering how many alternative ways to get notifications from your nagios/icinga exists, other than plain email messages? And what if you actually are monitoring your email or DNS infrastructure and you don&rsquo;t want to use a third-party email account dedicated to our precious notices?</p>

<p>An alternative and effective method to deliver the short status notification is via Twitter messages, using a protected account (for privacy).</p>

<!--more-->


<p>Register a new standard Twitter account and make sure to enable in the settings:</p>

<p><img src="http://gionn.net/sites/default/files/twitter-privacy.png" alt="twitter privacy settings" /></p>

<p>We need to install on the monitoring server a command-line Twitter client, such as Twidge:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>sudo apt-get install twidge
</span></code></pre></td></tr></table></div></figure>


<p>Do the one-time configuration procedure with the user you prefer:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>twidge setup
</span></code></pre></td></tr></table></div></figure>


<p>Move the generated configuration file from your home folder somewhere into the nagios/icinga configuration folder:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>sudo mv ~/.twidgerc /etc/icinga/twidgerc
</span></code></pre></td></tr></table></div></figure>


<p>Now add two new custom commands in the nagios/icinga configuration:</p>

<p><strong>/etc/icinga/commands.cfg</strong>:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>define <span class="nb">command</span> <span class="o">{</span>
</span><span class='line'>        command_name  notify-host-by-twitter
</span><span class='line'>        command_line  /bin/echo <span class="s2">&quot;HOST $HOSTALIAS$ is $HOSTSTATE$&quot;</span> | twidge -c /etc/icinga/twidgerc update
</span><span class='line'><span class="o">}</span>
</span><span class='line'>define <span class="nb">command</span> <span class="o">{</span>
</span><span class='line'>  command_name    notify-service-by-twitter
</span><span class='line'>  command_line    /bin/echo <span class="s2">&quot;SERVICE $SERVICEDESC$ on $HOSTALIAS$ is $SERVICESTATE$&quot;</span> | twidge -c /etc/icinga/twidgerc update
</span><span class='line'><span class="o">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>Now you need to use such commands as host and service notifications, like here:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>define contact <span class="o">{</span>
</span><span class='line'>        contact_name                    root
</span><span class='line'>        <span class="nb">alias                           </span>Root
</span><span class='line'>        service_notification_period     24x7
</span><span class='line'>        host_notification_period        24x7
</span><span class='line'>        service_notification_options    w,u,c,r
</span><span class='line'>        host_notification_options       d,r
</span><span class='line'>        service_notification_commands   notify-service-by-twitter
</span><span class='line'>        host_notification_commands      notify-host-by-twitter
</span><span class='line'><span class="o">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>Reload and enjoy!</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>sudo /etc/init.d/icinga reload
</span></code></pre></td></tr></table></div></figure>


<p><img src="http://gionn.net/sites/default/files/space%20new%20robot.png" alt="space new robot" /></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[EVA Florence 2012: Open low-cost HA cluster cloud]]></title>
    <link href="http://gionn.net/2012/05/10/eva-florence-2012-open-low-cost-ha-cluster-cloud/"/>
    <updated>2012-05-10T00:00:00+02:00</updated>
    <id>http://gionn.net/2012/05/10/eva-florence-2012-open-low-cost-ha-cluster-cloud</id>
    <content type="html"><![CDATA[<p>During these first hot-days in Florence, I&rsquo;ve attended the <a href="http://www.evaflorence.it/">EVA Florence 2012</a> conference, presenting a talk with <a href="http://twitter.com/ccorsani">Cristiano Corsani</a> about a project for the National Library of Florence (<a href="http://www.bncf.firenze.sbn.it">BNCF</a>), covering the deployment of a small Private Cloud using exclusively open source software, for serving internal and public BNCF services.</p>

<p>The proposed solution includes a virtualization stack running on commody hardware, using the Linux KVM hypervisor, managed by Proxmox 2.0 and with a GlusterFS shared storage.</p>

<p>I hope to write down some article to share the most interesting bits of this configuration, but time is not our friend.</p>

<p>Here are the slides of the presentation &ldquo;Open low-cost HA cluster cloud&rdquo;, hoping that they will satisfy your curiosity:</p>

<script async class="speakerdeck-embed"
data-id="e7174ab0163f0130c02122000a1e9b2a" data-ratio="1.33507170795306"
src="http://gionn.net//speakerdeck.com/assets/embed.js"></script>


<p>Thanks to everyone who helped us in this journey!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[cannot create zfs volume: one of the devices is part of an active md or lvm device]]></title>
    <link href="http://gionn.net/2012/04/22/cannot-create-zfs-volume-one-of-the-devices-is-part-of-an-active-md-or-lvm-device/"/>
    <updated>2012-04-22T00:00:00+02:00</updated>
    <id>http://gionn.net/2012/04/22/cannot-create-zfs-volume-one-of-the-devices-is-part-of-an-active-md-or-lvm-device</id>
    <content type="html"><![CDATA[<p>During the migration of a RAID1 mdadm on Ubuntu server to a ZFS mirror, I got stuck at the initial zfs volume creation with the following error:</p>

<blockquote>cannot create &#8216;tank&#8217;: one or more vdevs refer to the same device, or one of the devices is part of an active md or lvm device</blockquote>


<p>Obviously I&rsquo;ve removed the device from the old mdadm array with:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>sudo mdadm /dev/md3 --set-faulty /dev/sdb3
</span><span class='line'>sudo mdadm /dev/md3 --remove /dev/sdb3
</span></code></pre></td></tr></table></div></figure>


<p>However, the zpool utility doesn&rsquo;t actually look if the device is currently used or not, but simply look at the metadata at the beginning of the disk that is still there.</p>

<p>To wipe the mdadm metadata you need to use:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>sudo mdadm --zero-superblock /dev/sdb3
</span></code></pre></td></tr></table></div></figure>


<p>But the good old dd will do the job too:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>sudo dd <span class="k">if</span><span class="o">=</span>/dev/zero <span class="nv">of</span><span class="o">=</span>/dev/sdb3 <span class="nv">count</span><span class="o">=</span>64 <span class="nv">bs</span><span class="o">=</span>1024
</span></code></pre></td></tr></table></div></figure>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[zram on Debian/Ubuntu for memory overcommitment]]></title>
    <link href="http://gionn.net/2012/03/11/zram-on-debian-ubuntu-for-memory-overcommitment/"/>
    <updated>2012-03-11T00:00:00+01:00</updated>
    <id>http://gionn.net/2012/03/11/zram-on-debian-ubuntu-for-memory-overcommitment</id>
    <content type="html"><![CDATA[<p>In recent Linux releases, it&rsquo;s available a tiny module called <strong>zram</strong>, that permits us to create RAM based block devices (named /dev/zramX), which will be kept in memory as compressed data. These ram-based block devices allow very fast I/O, and compression provides a reasonable amounts of memory saving.</p>

<p>We can use it as a drop-in replacement for the well-known <em>tmpfs</em> (used for speeding up compilation tasks or for /tmp), or better as a primary swap device, that will lead to virtually <strong>increase memory capacity</strong>, at the expense of a <strong>slightly increased CPU usage</strong> to compress/decompress the swapped data.</p>

<p>Nowadays RAM is very cheap, so <strong>why bother with compression?</strong> Because there are some situations where you can&rsquo;t upgrade memory (netbooks) or you want to over-commit real resources (virtualization hosts).</p>

<h3>For Ubuntu Precise and later:</h3>

<p>Starting with Ubuntu Precise, there is an official upstart script for Ubuntu by Adam Conrad to configure zram in the main repository:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>sudo apt-get install zram-config</span></code></pre></td></tr></table></div></figure>


<h3>For other distributions or older Ubuntu:</h3>

<p>Googlin&#8217; around to find a nice way to configure zram devices as swap, I found a very nice upstart script that will create a bunch of ramz devices depending on the number of CPU cores available, with a total size of the available memory:
<a href="https://raw.github.com/gionn/etc/master/init.d/zram">https://raw.github.com/gionn/etc/master/init.d/zram</a></p>

<p>Copy the script to the init.d folder, mark it as executable and enable autostart on boot:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>sudo wget https://raw.github.com/gionn/etc/master/init.d/zram -O /etc/init.d/zram
</span><span class='line'>sudo chmod +x /etc/init.d/zram
</span><span class='line'>sudo update-rc.d zram defaults</span></code></pre></td></tr></table></div></figure>


<p>Try it manually executing it for the first time with:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>/etc/init.d/zram start</span></code></pre></td></tr></table></div></figure>


<p>Depending on the kernel version you are running, you may need to adjust the module parameter name to num_devices on line 26 to:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>modprobe zram num_devices=$num_cpus</span></code></pre></td></tr></table></div></figure>


<p>or keep as is for newer kernels:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>modprobe zram zram_num_devices=$num_cpus</span></code></pre></td></tr></table></div></figure>


<h3>Checking if it&rsquo;s working</h3>

<p>If everything went smooth, you will find a few notices on <code>dmesg</code>:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>zram: module is from the staging directory, the quality is unknown, you have been warned.
</span><span class='line'>zram: Creating 4 devices ...
</span><span class='line'>Adding 1497864k swap on /dev/zram0.  Priority:100 extents:1 across:1497864k SS
</span><span class='line'>Adding 1497864k swap on /dev/zram1.  Priority:100 extents:1 across:1497864k SS
</span><span class='line'>Adding 1497864k swap on /dev/zram2.  Priority:100 extents:1 across:1497864k SS
</span><span class='line'>Adding 1497864k swap on /dev/zram3.  Priority:100 extents:1 across:1497864k SS</span></code></pre></td></tr></table></div></figure>


<p>meaning that the zram device have been created and enabled as swap devices with highest priority.</p>

<p>You can discover the increased swap space available with <code>free -m</code>:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>         total       used       free     shared    buffers     cached
</span><span class='line'>Mem:          5851       5696        154          0         85       4310
</span><span class='line'>-/+ buffers/cache:       1300       4550
</span><span class='line'>Swap:         5851          0       5850</span></code></pre></td></tr></table></div></figure>


<p>Happy zramming!</p>

<p>Read <a href="http://www.reddit.com/r/sysadmin/comments/15kmby/using_compressed_ram_for_memoryovercommit_on_linux/">Reddit comments</a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Open@BNCF - LinuxDay 2011 a Pisa]]></title>
    <link href="http://gionn.net/2011/10/22/openbncf-linuxday-2011-a-pisa/"/>
    <updated>2011-10-22T00:00:00+02:00</updated>
    <id>http://gionn.net/2011/10/22/openbncf-linuxday-2011-a-pisa</id>
    <content type="html"><![CDATA[<p>This year I&rsquo;ve joined the LinuxDay of Pisa with a talk about my recent works in <a href="http://www.libersoft.it/">LiberSoft</a> to the <a href="http://en.wikipedia.org/wiki/National_Central_Library_(Florence)">BNCF</a>.</p>

<p>These includes:
* Desktop migration to Ubuntu Linux (10.04 LTS) with centralized login management (OpenLDAP) and shared /home with MooseFS;
* OpenNebula KVM-based Cloud with MooseFS as backend storage (and publishing of the relative transfer manager: <a href="https://github.com/libersoft/opennebula-tm-moosefs">https://github.com/libersoft/opennebula-tm-moosefs</a>);
* GlusterFS-based infrastructure for the national italian legal deposit of books (italian article: <a href="http://www.bncf.firenze.sbn.it/pagina.php?id=212&amp;rigamenu=Magazzini%20Digitali">http://www.bncf.firenze.sbn.it/pagina.php?id=212&amp;rigamenu=Magazzini%20Digitali</a>)</p>

<div id="__ss_9832968"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/gionn2/openbncf" title="Open@BNCF">Open@BNCF</a></strong><object id="__sse9832968" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=bncflinuxday2011-111022121646-phpapp01&stripped_title=openbncf&userName=gionn2" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse9832968" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=bncflinuxday2011-111022121646-phpapp01&stripped_title=openbncf&userName=gionn2" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object><div style="padding:5px 0 12px"></div></div>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[ZFS + GlusterFS on Linux]]></title>
    <link href="http://gionn.net/2011/08/27/zfs-glusterfs-on-linux/"/>
    <updated>2011-08-27T00:00:00+02:00</updated>
    <id>http://gionn.net/2011/08/27/zfs-glusterfs-on-linux</id>
    <content type="html"><![CDATA[<p>Time is almost ripe for start using the native ZFS port on Linux (<a href="http://zfsonlinux.org/">http://zfsonlinux.org/</a>), and to increase the performances, reliability and space usage of our affordable distributed opensource storage solution.</p>

<p>Installing ZFS on Debian/Ubuntu is straightforward: you need first to build the SPL (Solaris Porting Layer) and after ZFS itself.</p>

<p>Download the latest <a href="https://github.com/zfsonlinux/spl/downloads">SPL package</a>, unpack it and <a href="http://zfsonlinux.org/spl-building-deb.html">build</a>:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>sudo apt-get install build-essential gawk alien fakeroot linux-headers-<span class="k">$(</span>uname -r<span class="k">)</span>
</span><span class='line'>./configure
</span><span class='line'>make deb
</span><span class='line'>dpkg -i *.deb
</span></code></pre></td></tr></table></div></figure>


<p>Download the latest <a href="https://github.com/zfsonlinux/zfs/downloads">ZFS package</a>, unpack it and <a href="http://zfsonlinux.org/zfs-building-deb.html">build</a>:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>sudo apt-get install zlib1g-dev uuid-dev libblkid-dev libselinux-dev parted lsscsi
</span><span class='line'>./configure
</span><span class='line'>make deb
</span><span class='line'>dpkg -i *.deb
</span></code></pre></td></tr></table></div></figure>


<p>ZFS is now ready to be used.</p>

<p>Let&rsquo;s create our first pool with:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>zpool create tank raidz <span class="o">[</span>devices<span class="o">]</span>
</span></code></pre></td></tr></table></div></figure>


<p>Devices can be partitions, UUIDs or entire disk. Is often a <em>very</em> good practice to use an entire disk using the disks id as found on /dev/disk/by-id/* (it should be advisable to not mix up existing drives with one of an existing volume).</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>sudo zpool status tank
</span><span class='line'>df -h
</span></code></pre></td></tr></table></div></figure>


<p>Check pool status. :)</p>

<p>Now, the interesting features:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>zfs <span class="nb">set </span><span class="nv">compression</span><span class="o">=</span>on tank
</span><span class='line'>zfs <span class="nb">set </span><span class="nv">dedup</span><span class="o">=</span>on tank
</span></code></pre></td></tr></table></div></figure>


<p>Et voilà, your space usage is highly optimized compressing and deduplicating data.</p>

<p>Now it&rsquo;s the GlusterFS turn, download the latest version and install it:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>dpkg -i glusterfs_3.2.2-1_amd64.deb
</span><span class='line'>update-rc.d glusterd defaults
</span><span class='line'>/etc/init.d/glusterd start
</span></code></pre></td></tr></table></div></figure>


<p>Only on one node do the peer probing for every peer:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>gluster peer probe ip.add.re.ss
</span></code></pre></td></tr></table></div></figure>


<p>Only on one node, create and start the volume:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>gluster volume create gtank replica 2 transport tcp ip.add.re.ss1:/tank ip.add.re.ss2:/tank
</span><span class='line'>gluster volume start gtank
</span></code></pre></td></tr></table></div></figure>


<p></p>

<p>On every node, mount it with:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>mount -t glusterfs localhost:/gtank /gtank
</span></code></pre></td></tr></table></div></figure>


<p>Now some live example:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>root@debz-1:/gtank# df -h
</span><span class='line'>File system           Dim. Usati Disp. Uso% Montato su
</span><span class='line'><span class="o">[</span>..<span class="o">]</span>
</span><span class='line'>tank                   10G  1,8G  8,2G  18% /tank
</span><span class='line'>localhost:/gtank       10G  1,8G  8,2G  18% /gtank
</span></code></pre></td></tr></table></div></figure>


<p>GlusterFS replica 2 on 2 servers, anything unexpected here.</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>root@debz-1:/gtank# ls -lh
</span><span class='line'>totale 1,8G
</span><span class='line'>-rw-r--r-- 1 scorp scorp  253K  1 gen  1980 Fattura Garanzia redcoon dns-323.pdf
</span><span class='line'>-rw-r--r-- 1 scorp scorp   68K  1 gen  1980 fattura scontrino eeepc 900a.pdf
</span><span class='line'>-rw-r--r-- 1 scorp scorp   55K  1 gen  1980 Fattura Scontrino WD HD Caviar Green Videofantasy.pdf
</span><span class='line'>-rw-r--r-- 1 scorp scorp  681M 23 ago 19.29 lubuntu-11.04-desktop-i386.iso
</span><span class='line'>-rw-r--r-- 1 scorp scorp 1021K  1 gen  1980 Scontrino xbox 360.pdf
</span><span class='line'>-rw-r--r-- 1 root  root    98M 27 ago 12.00 test2_random.dat
</span><span class='line'>-rw-r--r-- 1 root  root    98M 27 ago 11.59 test_random_copy.dat
</span><span class='line'>-rw-r--r-- 1 root  root    98M 27 ago 11.55 test_random.dat
</span><span class='line'>-rw-r--r-- 1 root  root   293M 27 ago 12.06 test_random-with-zero-hole.dat
</span><span class='line'>-rw-r--r-- 1 root  root    98M 27 ago 11.53 test_zero.dat
</span><span class='line'>-rw-r--r-- 1 root  root   674M 18 ago 16.43 ubuntu-11.04-server-amd64.iso
</span></code></pre></td></tr></table></div></figure>


<p>Here I&rsquo;ve copied some PDFs, 2 ISO, and some dd generated file:
test_zero.dat is a dd if=/dev/zero
test_random.dat and test2_random.dat are 2 different iteration with dd if=/dev/urandom
test_random_copy.dat is a cp of test_random.dat
test_random-with-zero-hole.dat is the result of cat test_random.dat + test_random.dat + test2_random.dat</p>

<p>The following are the real disk usage:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>root@debz-1:/gtank# du -sh *
</span><span class='line'>259K  Fattura Garanzia redcoon dns-323.pdf
</span><span class='line'>69K   fattura scontrino eeepc 900a.pdf
</span><span class='line'>55K   Fattura Scontrino WD HD Caviar Green Videofantasy.pdf
</span><span class='line'>675M  lubuntu-11.04-desktop-i386.iso
</span><span class='line'>1,1M  Scontrino xbox 360.pdf
</span><span class='line'>98M   test2_random.dat
</span><span class='line'>98M   test_random_copy.dat
</span><span class='line'>98M   test_random.dat
</span><span class='line'>196M  test_random-with-zero-hole.dat
</span><span class='line'>512   test_zero.dat
</span><span class='line'>667M  ubuntu-11.04-server-amd64.iso
</span></code></pre></td></tr></table></div></figure>


<p>As you can see, compression is doing its work with ISO and test_zero.dat, but isn&rsquo;t effective with PDFs and random data (do you remember that if you zip an already zip file the total size will increase?).</p>

<p>And what about the dedup? You should check it with:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>root@debz-1:/gtank# zpool list
</span><span class='line'>NAME   SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
</span><span class='line'>tank  9,94G  1,60G  8,34G    16%  1.20x  ONLINE  -
</span></code></pre></td></tr></table></div></figure>


<p>so there are ~ 200 MB of available deduped space.</p>

<p>Other &ldquo;batteries included&rdquo; functions with ZFS are:</p>

<ul>
  <li>Decrease disk I/O bottleneck using fast SSDs as caches with <a href="http://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide#Separate_Cache_Devices">L2ARC</a></li>
  <li>Copy-on-write transactions: no need for fsck after hard reboot, data is always consistent on disk.</li>
  <li>Online Repair: ZFS store a checksum for every data block, and can notify data alternation on avery access or during a scheduled online scrub operation</li>
</ul>


<p>Let me know if you have some good usage tips to submit!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Ubuntu fast boot and application launch with SSD Storage]]></title>
    <link href="http://gionn.net/2011/08/07/ubuntu-fast-boot-and-application-launch-with-ssd-storage/"/>
    <updated>2011-08-07T00:00:00+02:00</updated>
    <id>http://gionn.net/2011/08/07/ubuntu-fast-boot-and-application-launch-with-ssd-storage</id>
    <content type="html"><![CDATA[<p>Quick and dirty video of Ubuntu Natty 11.04 boot-up and applications launch of my Sony Vaio laptop with a Corsair 60GB SSD (<a href="http://twitpic.com/61y3n5">http://twitpic.com/61y3n5</a>)</p>

<iframe width="425" height="349" src="http://www.youtube.com/embed/q-AXBr7NLic" frameborder="0" allowfullscreen></iframe>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Damned coincidence]]></title>
    <link href="http://gionn.net/2011/06/21/damned-coincidence/"/>
    <updated>2011-06-21T00:00:00+02:00</updated>
    <id>http://gionn.net/2011/06/21/damned-coincidence</id>
    <content type="html"><![CDATA[<p>SMART error (ErrorCount) detected on host: fs
Device: /dev/sdb, ATA error count increased from 0 to 74</p>

<p>=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.11
Device Model:     ST3500320AS
[..]
  9 Power_On_Hours          0x0032   070   070   000    Old_age   Always       &ndash;       26286</p>

<p>OH wait: 26286 / 24 / 365 = 3,00068493 yr</p>

<p>This disk broke exactly after 3 years. WTF?</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[OpenNebula shared storage with MooseFS]]></title>
    <link href="http://gionn.net/2011/04/21/opennebula-shared-storage-with-moosefs/"/>
    <updated>2011-04-21T00:00:00+02:00</updated>
    <id>http://gionn.net/2011/04/21/opennebula-shared-storage-with-moosefs</id>
    <content type="html"><![CDATA[<p>I&rsquo;ve written a post for the OpenNebula official blog about the usage of MooseFS as shared storage:</p>

<p><a href="http://blog.opennebula.org/?p=1512">http://blog.opennebula.org/?p=1512</a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Debian on Sony Vaio VPCS13V9E]]></title>
    <link href="http://gionn.net/2011/03/03/debian-on-sony-vaio-vpcs13v9e/"/>
    <updated>2011-03-03T00:00:00+01:00</updated>
    <id>http://gionn.net/2011/03/03/debian-on-sony-vaio-vpcs13v9e</id>
    <content type="html"><![CDATA[<p>After <a href="http://gionn.net/vendesi-macbook-pro-15-unibody-51-usato">selling my macbook pro</a>, I decided to go back to PC world and searching for something more suitable for a <strong>roadwarrior sysadmin</strong>.</p>

<p>I&rsquo;ve bought a 13,3&#8221; Sony Vaio (VPCS13V9E), and I have found some rusty after having successfully installed Debian Squeeze.</p>

<!--break-->


<ul>
  <li>black screen after grub: added <strong>nomodeset</strong> kernel parameter;</li>
  <li>nvidia proprietary drivers not detecting screen: used custom <strong>xorg.conf</strong>, after copying /proc/acpi/video/IGPU/LCD0/EDID to /etc/EDID (not needed after nvidia-glx 260.19.44-1 from unstable);</li>
  <li>touchpad not working: worked after <strong>upgrading kernel</strong> 2.6.37 from unstable;</li>
  <li>audio not working: worked after <strong>upgrading kernel</strong> 2.6.37 from unstable;</li>
  <li>monitor backlight (brightness): installed <strong>nvidiabl</strong> (https://github.com/guillaumezin/nvidiabl) and created a brightness.sh (thanks to Sony BIOS that export a dummy ACPI video module) (not needed from kernel 2.6.38);</li>
  <li>umts modem: apt-get install <strong>gobi-loader</strong> and copy in /lib/firmware/gobi/ the blobs amss.mbn, apps.mbn, UQCN.mbn from Windoze.</li>
  <li>fingerprint reader (147e:1001 Upek): follow http://www.n-view.net/Appliance/fingerprint/</li>
</ul>


<p><code>
Section &ldquo;ServerLayout&rdquo;</p>

<pre><code>Identifier     "X.org Configured"
Screen      0  "Screen0" 0 0
InputDevice    "Mouse0" "CorePointer"
InputDevice    "Keyboard0" "CoreKeyboard"
</code></pre>

<p>EndSection</p>

<p>Section &ldquo;Files&rdquo;</p>

<pre><code>ModulePath   "/usr/lib/xorg/modules"
FontPath     "/usr/share/fonts/X11/misc"
FontPath     "/usr/share/fonts/X11/cyrillic"
FontPath     "/usr/share/fonts/X11/100dpi/:unscaled"
FontPath     "/usr/share/fonts/X11/75dpi/:unscaled"
FontPath     "/usr/share/fonts/X11/Type1"
FontPath     "/usr/share/fonts/X11/100dpi"
FontPath     "/usr/share/fonts/X11/75dpi"
FontPath     "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
FontPath     "built-ins"
</code></pre>

<p>EndSection</p>

<p>Section &ldquo;Module&rdquo;</p>

<pre><code>Load  "extmod"
Load  "dbe"
Load  "glx"
Load  "dri"
Load  "dri2"
Load  "record"
</code></pre>

<p>EndSection</p>

<p>Section &ldquo;InputDevice&rdquo;</p>

<pre><code>Identifier  "Keyboard0"
Driver      "kbd"
</code></pre>

<p>EndSection</p>

<p>Section &ldquo;InputDevice&rdquo;</p>

<pre><code>Identifier  "Mouse0"
Driver      "mouse"
Option      "Protocol" "auto"
Option      "Device" "/dev/input/mice"
Option      "ZAxisMapping" "4 5 6 7"
</code></pre>

<p>EndSection</p>

<p>Section &ldquo;Monitor&rdquo;</p>

<pre><code>Identifier   "Monitor0"
VendorName   "Monitor Vendor"
ModelName    "Monitor Model"
</code></pre>

<p>EndSection</p>

<p>Section &ldquo;Device&rdquo;</p>

<pre><code>Identifier  "Card0"
Driver      "nvidia"
Option "ConnectedMonitor" "DFP-0,DFP-1,CRT-0"
Option "CustomEDID" "DFP-0: /etc/EDID"
Option  "NoLogo" "true"
VendorName  "nVidia Corporation"
BoardName   "GT218 [GeForce 310M]"
BusID       "PCI:1:0:0"
</code></pre>

<p>EndSection</p>

<p>Section &ldquo;Screen&rdquo;</p>

<pre><code>Identifier "Screen0"
Device     "Card0"
Monitor    "Monitor0"
DefaultDepth    24
SubSection "Display"
    Depth     24
EndSubSection
</code></pre>

<p>EndSection
</code></p>

<p>/etc/acpi/nvidia_backlight_up.sh
<code></p>

<h1>!/bin/sh</h1>

<p>test -f /sys/class/backlight/nvidia_backlight/brightness || exit 0</p>

<p>VAL=<code>cat /sys/class/backlight/nvidia_backlight/actual_brightness</code>
MAX=<code>cat /sys/class/backlight/nvidia_backlight/max_brightness</code>
STEP=10</p>

<p>VAL=<code>expr $VAL + $STEP</code></p>

<p>if [ $VAL -gt $MAX ]; then</p>

<pre><code>VAL=$MAX
</code></pre>

<p>fi</p>

<p>echo -n $VAL > /sys/class/backlight/nvidia_backlight/brightness
</code></p>

<p>/etc/acpi/nvidia_backlight_down.sh
<code></p>

<h1>!/bin/sh</h1>

<p>test -f /sys/class/backlight/nvidia_backlight/brightness || exit 0</p>

<p>VAL=<code>cat /sys/class/backlight/nvidia_backlight/actual_brightness</code>
MIN=0
STEP=10</p>

<p>VAL=<code>expr $VAL - $STEP</code></p>

<p>if [ $VAL -lt $MIN ]; then</p>

<pre><code>VAL=$MIN
</code></pre>

<p>fi</p>

<p>echo -n $VAL > /sys/class/backlight/nvidia_backlight/brightness
</code></p>

<p>/etc/acpi/events/sony-brightness-up
<code>
event=video/brightnessup BRTUP 00000086 00000000
action=/etc/acpi/nvidia_backlight_up.sh
</code></p>

<p>/etc/acpi/events/sony-brightness-down
<code>
event=video/brightnessdown BRTDN 00000087 00000000
action=/etc/acpi/nvidia_backlight_down.sh
</code></p>

<p><code>
faf675e54e68daa15bc95d883166e4ce  amss.mbn
d7496085f1af3d1bfdf0fa60c3222766  apps.mbn
633bed88c29244683635c261849d0e88  UQCN.mbn
</code></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to create a simple Activity Stream Weekly Digest using CCK and Views]]></title>
    <link href="http://gionn.net/2011/01/09/how-to-create-a-simple-activity-stream-weekly-digest-using-cck-and-views/"/>
    <updated>2011-01-09T00:00:00+01:00</updated>
    <id>http://gionn.net/2011/01/09/how-to-create-a-simple-activity-stream-weekly-digest-using-cck-and-views</id>
    <content type="html"><![CDATA[<p>I was researching for an easy method to publish as a single post my latest {month|week|day} activities on twitter aggregated by <a href="http://drupal.org/project/activitystream">Activity Stream</a>.</p>

<!--break-->


<p>This is how I did it:</p>

<ul>
  <li>Create a view that list the activity stream items published in the last week;</li>
  <li>Create a new content type (ex: activitystreamdigest), add a node-reference cck field with unlimited values, checkboxes as widget type and the precedent view as nodes that can be referenced;</li>
  <li>Update your frontpage view to include this new type of content (or promote them to frontpage, as you use to deal with your contents)</li>
</ul>


<p>Now, everytime I want to create an Activity Stream digest, I go for Create Content &ndash;> Activity Stream Digest, I select the items I want in my digest (throwing away unuseful tweets) and publish.</p>

<p>You can see an example output <a href="http://gionn.net/digest/2011-01-activity-digest">here</a>.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Android speech recognition behind NAT/firewall]]></title>
    <link href="http://gionn.net/2010/12/11/android-speech-recognition-behind-nat-firewall/"/>
    <updated>2010-12-11T00:00:00+01:00</updated>
    <id>http://gionn.net/2010/12/11/android-speech-recognition-behind-nat-firewall</id>
    <content type="html"><![CDATA[<p>For speech recognition to work on Android, you need to enable the forwarding on your firewall of the 19294 tcp port.</p>

<p>References: <a href="http://code.google.com/support/bin/answer.py?answer=62464"><a href="http://code.google.com/support/bin/answer.py?answer=62464">http://code.google.com/support/bin/answer.py?answer=62464</a></a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Slides corso Ubuntu Server al GOLEM (maggio 2010)]]></title>
    <link href="http://gionn.net/2010/11/01/slides-corso-ubuntu-server-al-golem-maggio-2010/"/>
    <updated>2010-11-01T00:00:00+01:00</updated>
    <id>http://gionn.net/2010/11/01/slides-corso-ubuntu-server-al-golem-maggio-2010</id>
    <content type="html"><![CDATA[<p>Rimettendo a posto i files dei vari documenti sparsi che si sono accumulati negli ultimi mesi, sono incappato nella slides che avevo preparato per il mini-corso di 8 ore gratuito che ho tenuto al <a href="http://golem.linux.it/">GOLEM</a> mesi fa, e che mi ero promesso di pubblicare da qualche parte, prima o poi.</p>

<p><a href='http://gionn.net/wp-content/uploads/2010/11/MiniCorso_Linux_server_GOLEM_2010.zip'>MiniCorso_Linux_server_GOLEM_2010</a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to circumvent the 417 Expectation failed behind a Squid proxy]]></title>
    <link href="http://gionn.net/2010/09/07/how-to-circumvent-the-417-expectation-failed-behind-a-squid-proxy/"/>
    <updated>2010-09-07T00:00:00+02:00</updated>
    <id>http://gionn.net/2010/09/07/how-to-circumvent-the-417-expectation-failed-behind-a-squid-proxy</id>
    <content type="html"><![CDATA[<p>Many applications rely on using a special HTTP/1.1 header (Expect: 100-continue) when doing a POST, which is not happily supported by Squid.</p>

<p><a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html">RFC2616</a> says:</p>

<blockquote>The purpose of the 100 (Continue) status (see section 10.1.1) is to allow a client that is sending a request message with a request body to determine if the origin server is willing to accept the request (based on the request headers) before the client sends the request body. In some cases, it might either be inappropriate or highly inefficient for the client to send the body if the server will reject the message without looking at the body. </blockquote>


<p>We can configure Squid to simply ignore that request header, and usually client with poor error handling will fallback without even notice it.</p>

<p>Add in squid.conf:
<code>ignore_expect_100 on</code></p>

<p>Android application like AppBrain and Facebook Contact Sync, and BOINC client was having login issues due to this reason.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Nintendo 8-Bits Mints]]></title>
    <link href="http://gionn.net/2010/08/24/nintendo-8-bits-mints/"/>
    <updated>2010-08-24T00:00:00+02:00</updated>
    <id>http://gionn.net/2010/08/24/nintendo-8-bits-mints</id>
    <content type="html"><![CDATA[<p><a href="http://gionn.net/wp-content/uploads/2010/08/IMG_20100824_204058.jpg"><img src="http://gionn.net/sites/default/files/images/IMG_20100824_204058-1024x768.jpg" alt="" title="Nintendo Mints" width="640" height="480" class="aligncenter size-large wp-image-3277" /></a></p>

<p>Via @<a href="http://twitter.com/orontobate">drg</a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Not so dirty bash script for fan control under GNU/Linux on Macbook (Pro)]]></title>
    <link href="http://gionn.net/2010/07/31/not-so-dirty-bash-script-for-fan-control-under-gnu-linux-on-macbook-pro/"/>
    <updated>2010-07-31T00:00:00+02:00</updated>
    <id>http://gionn.net/2010/07/31/not-so-dirty-bash-script-for-fan-control-under-gnu-linux-on-macbook-pro</id>
    <content type="html"><![CDATA[<p><strong>UPDATE!</strong>
macfanctld has been published on <a href="https://launchpad.net/~mactel-support/+archive/ppa">mactel ubuntu PPA</a>, it works great!</p>

<p>An exceptional pain when using native GNU/Linux distros on Macbooks, it&rsquo;s the totally awesomeness management of the fans: you could get very hot temperatures because fans will start only when thermonuclear temperatures are reached inside your machine.</p>

<p>Fortunately, it&rsquo;s possible to manage fan speeds in userspace using the kernel module applesmc (modprobe applesmc or add it to /etc/modules), so I write a tiny bash script for doing the dirty work.</p>

<p>This script has been published to GitHub: <a href="http://github.com/gionn/macbook-fans"><a href="http://github.com/gionn/macbook-fans">http://github.com/gionn/macbook-fans</a></a></p>

<pre lang="bash">
#!/bin/bash
# Settings
SMC=/sys/devices/platform/applesmc.768
TEMPMAX=90
TEMPMIN=45
FANMAX=6200
FANMIN=2000

# Thanks to god my cousin knows Math.
C1=$(( $FANMAX - $FANMIN ))
C2=$(( $TEMPMAX - $TEMPMIN ))
CF=$(( $C1 / $C2 ))
TM=$(( $CF * $TEMPMAX - $FANMAX  ))

# Be sure that manual mode is disabled:
# we don't want to burn everything is case of a bug
echo 0 > $SMC/fan1_manual
echo 0 > $SMC/fan2_manual

while :
do
CORETEMP1=$(( `cat /sys/devices/platform/coretemp.0/temp1_input` / 1000 ))
CORETEMP2=$(( `cat /sys/devices/platform/coretemp.1/temp1_input` / 1000 ))
TEMP=$(( ($CORETEMP1 + $CORETEMP2) / 2 ))
SET=$(( $CF * $TEMP - $TM ))
echo $SET > $SMC/fan1_min
echo $SET > $SMC/fan2_min
sleep 2
done
</pre>


<p>You can put this script in /usr/local/bin/fans, chmod +x /usr/local/bin/fans and add it in /etc/rc.local for automatic startup on system boot.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How to use apt* with discontinued Debian/Ubuntu releases]]></title>
    <link href="http://gionn.net/2010/07/29/how-to-use-apt-with-discontinued-debian-ubuntu-releases/"/>
    <updated>2010-07-29T00:00:00+02:00</updated>
    <id>http://gionn.net/2010/07/29/how-to-use-apt-with-discontinued-debian-ubuntu-releases</id>
    <content type="html"><![CDATA[<p>I&rsquo;ve recently discovered that both Ubuntu and Debian projects provide a single mirror to use if you put your hands on an outdated server with a discontinued release.</p>

<p>For Ubuntu you should use: <a href="http://old-releases.ubuntu.com/ubuntu/">http://old-releases.ubuntu.com/ubuntu/</a>
For Debian you should use: <a href="http://archive.debian.org/debian/">http://archive.debian.org/debian/</a></p>

<p>With these mirror you should be able to deboostrap an old ancient Debian buzz (1.1) or Ubuntu Warty Warthog (4.10) :)</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Aggiornare firmware Android su HTC Dream G1 Tim a Android 2.2 Froyo con CyanogenMod 6.0.0]]></title>
    <link href="http://gionn.net/2010/07/11/aggiornare-firmware-android-su-htc-dream-g1-tim-a-android-2-2-froyo-con-cyanogenmod-6-0-0/"/>
    <updated>2010-07-11T00:00:00+02:00</updated>
    <id>http://gionn.net/2010/07/11/aggiornare-firmware-android-su-htc-dream-g1-tim-a-android-2-2-froyo-con-cyanogenmod-6-0-0</id>
    <content type="html"><![CDATA[<p>Google e HTC avevano annunciato che Android 2.2, codename Froyo, non sarebbe <em>MAI</em> stato disponibile per i &ldquo;vecchi&rdquo; HTC Dream e Magic (e molti altri device)</p>

<p><del datetime="2010-09-01T17:34:33+00:00">Questa è una versione di testing (<del datetime="2010-08-16T07:36:03+00:00">RC1</del> RC3 &ndash; <a href="http://github.com/CyanogenMod/android_vendor_cyanogen/blob/froyo/CHANGELOG.mkdn">Changelog</a>), ma che dovrebbe già esser abbastanza stabile per l&#8217;utilizzo di tutti i giorni.</del>
E&#8217; uscita la release stabile CyanogenMod <del>6.0.0</del> 6.1.0 basata su Android 2.2</p>

<p>La procedura di aggiornamento del <a href="http://gionn.net/node/419">post precedente</a> è sempre valida (DangerSPL è obbligatorio, ma non serve reinstallarlo ogni volta).</p>

<p>Download: <a href="http://forum.xda-developers.com/showthread.php?t=722801">XDA</a></p>
]]></content>
  </entry>
  
</feed>
