Category Archives: Linux

Speeding up my Ubuntu 12.04

My laptop will turn two (years old) soon. Some people would find this computer young enough for their task but they are not me. Actually, it started to feel ancient on my hands a few months ago ;-) Do not mistake! I like it, I like its design, it is slim and light (well… it can be lighter) and it was surprisingly efficient when I bought it… two years ago.

Nowadays, there are amazing ultrabooks everywhere: Samsung series 9, Asus Zenbook, Dell XPS 13, HP Spectre/Folio, Vizio thin+light… They are so thin and so light and so beautiful and so… everything! And comparing those beasts with my puppet would be unfair, isn’t it? I think that my Acer 3820T would lose all possible benchmarks.

Anyway, last week I decided to keep this one and upgrade some components instead of buying a newer one because I don’t want to spend more than 1,000 euros on a laptop that I like and I’m not going to waste several hundred of euros in one that I don’t and that it’s not really what I want.

So, I made a list of upgradeable components and checked that I would bring a second childhood to my laptop just replacing its HDD and 9-cells battery for and SSD unit and a lighter and slimmer battery. This time i’m not in RAM and processor races; both of them are not squeezed enough yet.


SSD Units recommendations

Once decided that I will upgrade my hard disk for a flash memory based one (when my cash flow accepts this operation), I started to find references from former SSD-Ubuntu users. And I found some interesting recommendations:
  • The first one is to disable the swap partition. Their arguments were that disk swapping requires a lot of read and write operations and this could reduce SSD lifetime. I DO NOT RECOMMEND this at all but, configuring your system to consume more RAM before swapping to disk[1] would be a good idea.
    NOTE: Remember! it is possible to configure modern Linux systems to use a file as swap area[2].
  • The second one is to enable TRIM. I had no idea of what TRIM meant before reading its Wikipedia page[3] and a question on AskUbuntu[4] about it. Actually, it looked something very specific on SSD units and I don’t recommend to enable it on current HDD.
  • The last one is about migrating all logs and temporal files into main memory. It ‘s something tricky because you need to know what you are doing. I mean, you need to know what these files can tell you and, later, ask yourself some questions like: Is it smart to lose all your log data every time you turn off your computer to increase the whole system performance? Wouldn’t it be smarter to switch off all your logging? At the end, you won’t keep this information for so much time! As always, nothing is just black or white so, let me explain what I’ve done.

Moving temporary files and logs to main memory

Moving temporary files into main memory is not so risky as moving log data. You need to understand that if you don’t keep your temporary files on disk you can lose your unsaved information in case of power failures or similar but that’s all.
Moving log data into main memory is slightly different. Some programs or services highly rely on their log data (for example, the Apache server is not able to start if it doesn’t have its log folder) and the operating system wouldn’t boot properly if you don’t keep this information safe and sound.
At the end, I decided to switch logs to main memory by default and create a safe_log folder to store these required logs (like the Apache ones) explicitly modifying their responsible software configuration.
To move all these files to the main memory follow these steps:

STEP 1: Add these lines to /etc/fstab

tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0

STEP 2: Stop the rsyslog daemon

$> sudo service rsyslog stop

STEP 3: Delete your temporary/log files

$> sudo rm -rf /tmp/*
$> sudo rm -rf /var/log/*
$> sudo rm -rf /var/tmp/*

STEP 4: Mount your filesystems

$> sudo mount -a

STEP 5: Start the rsyslog daemon (or just reboot)

$> sudo service rsyslog start

NOTE: There was a project called Ramlog that provided a similar functionality with some useful extras like syncing log files into disk before shutting down and so on but it doesn’t seem to have any activity since early 2010.

Creating a new folder for your “safe logs” would be as easier as creating that folder as super user, giving permissions to system users to write on it and updating configurations to place applications logs there.

Results and warnings

First of all, be careful! I made all those changes after five years or more of working exclusively with Linux distributions at home and managing several Linux servers on different work positions. Do not follow these steps without understanding what they mean. Questions are welcomed on the comment section!
Second, and not less important, I’ve improved my laptop performance further than I expected with those changes. At the moment, I will slow down my SSD units deliberations and see how much I can tune this computer without breaking it. I will keep you up to date ;-)

[1] Swappiness Wikipedia article: link
[2] Useful information about swap (includes how to configure swap files): link
[3] TRIM article on the Wikipedia: link
[4] Question on AskUbuntu regarding TRIM: link

Fix touchpad behavior in a Macbook Air (Ubuntu Linux 11.10)

I received a brand new Macbook Air this week but I had already decided that I was going to install Ubuntu to be more efficient at work (yes, I’m used to work with GNU/Linux and I didn’t want to spend a few hours getting on with OS X Lion).

In order to make everything work I followed step by step* instructions available on the Ubuntu community page about my concrete Macbook model ( and everything seems to work as expected… but the touchpad.

The touchpad way to work had two issues that really annoyed me:

    • The first one was that I could not disable the tap-to-click feature, which is very annoying when you try to write with the built-in keyboard.


  • The second one is that the scrolling behavior was reversed to work like it does by default in the OS X Lion. Ok, this is not as annoying as the first issue but this behavior affected the external mouse scroll-wheel too.


To fix these issues you need to edit the /etc/X11/xorg.conf file and add these three lines in the touchpad section:

Option "MaxTapTime" "0"
Option "ScrollUpButton" "5"
Option "ScrollDownButton" "4"

So, you will have something like:

Section "InputClass"
    Identifier       "Multitouch Touchpad"
    Driver           "mtrack"
    MatchDevicePath  "/dev/input/event*"
    MatchIsTouchpad  "on"
    Option           "CorePointer"     "true"
    Option           "Sensitivity"     "0.65"  #    1 : movement speed
    Option           "ScrollDistance"  "100"   #  150 : two-finger drag dist for click
    Option           "ClickTime"       "25"    #   50 : millisec to hold emulated click
    Option      "MaxTapTime"      "0"
    Option      "ScrollUpButton" "5"
    Option      "ScrollDownButton" "4"

Once you have updated this file, you will need to restart your computer or restart the lightdm service (service lightdm restart in the command line) to make these changes effective.

I hope that this short post helps you in some way and keep in touch cause I’m going to explain how to fix the function keys behavior in a few days :-)

* NOTE: I must say that I’ve decided to not set up a swap partition but a swap file in order to make it easier to manage partitions both from Ubuntu and Mac OS (I usually love to have separate partitions for home, swap and boot but it’s not as easy in a Macbook, believe me, I’ve done it before in a Macbook 2,1). Another thing that I’ve also modified is the swappiness parameter but it’s something personal, it has no relation with maintenance issues.

Macbook Touchpad