Author: rahul

  • Guy Kawasaki Hindsights Speech

    An interesting speech by Guy Kawasaki which he has given at many high schools / colleges. The key points he stresses are on (copied verbatim from his blog entry):

    #10: Live off your parents as long as possible.
    #9 Pursue joy, not happiness.
    #8: Challenge the known and embrace the unknown.
    #7: Learn to speak a foreign language, play a musical instrument, and play non-contact sports.
    #6: Continue to learn.
    #5: Learn to like yourself or change yourself until you can like yourself.
    #4: Don’t get married too soon.
    #3: Play to win and win to play.
    #2: Obey the absolutes.
    #1: Enjoy your family and friends before they are gone.

    Read the full speech at http://guykawasaki.com/hindsights-speech/

  • It’s a girl!

    I am pleased to announce that we have been blessed with a baby girl on Sep 26, 2014 5:57 P.M weighing 2.76 kg. I had strongly desired for a girl and this is like a dream come true. We decided to name her “Tanvi”. Words can’t describe my joy :).

    Tanvi

  • A decade since I started my career!

    Today marks the tenth anniversary of starting my career. Exactly ten years back, on June 14 2004, I, along with few of my schoolmates joined Infosys Bangalore for undergoing training. Ten years later, I am again working in Bangalore!

    It has been a long time since my initial days in Bangalore. A very eventful journey of ten years, though not necessarily the most smoothest. But definitely with a lot of learnings. The three most important advices that I can give to people starting off with their careers are:

    1. Plan your life: Don’t get carried away with your day-to-day life. Try to lead a planned life. Once in a while, look back at what you have achieved. Ask yourself whether this is in-line with you want? And then look forward and think about what you want to do in the years ahead of you and whether you are in the right path. You need not have lofty goals, but you definitely should ask yourself this one question – Few years down the line, if I look back, what could probably be the thing that I would regret the most? Not travelling? Not starting my own venture? Working all the time? And that would help you answer what you want to do today.
    2. Take risks: Advance into unknown forays, but do it with careful thinking and feedback. Be risk aware, but not risk averse. There might be a possibility of failure but that shouldn’t stop you from trying. Shit happens all the time. My first startup was a fiasco. I got rejects from all the universities that I had applied to for MS, in spite of having a pretty good GRE score. I was asked to leave an organization with absolutely no fore-notice. But all through this, I finally realized, that what is more important than being successful, is to be resilient.
    3. Take care of your health: Last but not the least, take care of your health. It is not for no reason that people say – “Health is wealth”. I ignored it back then and today it is too late. There isn’t a day when I am not in pain (some days it is less, some days it is more). I see a lot of people in their late-twenties and early thirties facing back problems, most of them who like me took their health for granted and abused their body. So, if you are not eating right or not exercising or smoking or drinking, then it probably is high time you start doing the right thing.

    Today, I feel truly nostalgic. Some things that I still remember vividly from those 3 months stay in Bangalore:

    • A 5 km walk on the first day
    • Shared two rooms in a PG with six of my schoolmates
    • A snacks shop in front of our PG, where they used to make hot jilebi and samosa. We were pretty regular visitors there.
    • One of my roommates, Kishore, who was so scared of dogs, that he used to keep track of the movement of each and every one of them in our colony, including those which had an illicit relationship
    • An incident where I got confused and made everyone deboard the bus that was returning home, a couple of stops before the destined stop. And I was severely chastised for this. The very next day, someone from the group did the same mistake and I didn’t leave a stone unturned in returning the favour 😉
    • Making a very good Tamilian friend “Shobia” with whom I still continue to be in touch

    To all my colleagues and ex-colleagues, some of you with whom I am in touch, and some of you with whom I am no longer in touch, no matter where you are and what you are doing, I wish you all success and a blessed life.

  • Lesser Know Useful SSH Features

    I had given a small presentation in my organization on five of the lesser known useful SSH features. I am uploading the presentation here.

    Her is an interesting link I came across talking about the same topic – http://blog.tjll.net/ssh-kung-fu/

  • Configuring Thunderbird As KNotes Mail Action

    The steps are really simple.

    1. Save the below script to /usr/local/bin/knotes-mail-wrapper.sh

      #!/bin/bash
      
      set -eu
      
      # See /usr/share/doc/util-linux/examples/getopt-parse.bash for getopt example
      TEMP=$(getopt --name "$0" --options s:,b: --longoptions "subject:,body:" -- "$@")
      
      # Bad arguments, something has gone wrong with the getopt command.
      if [ $? -ne 0 ]; then
        echo "Termintaing ..." >&2
        exit 1
      fi
      
      # Note the quotes around `$TEMP': they are essential!
      eval set -- "$TEMP"
      
      # Now go through all the options
      while true; do
        case "$1" in
          --subject)
            subject=$2
            shift 2;;
      
          --body)
            body=$2
            shift 2;;
      
          --)
            shift
            break;;
      
          *)
            echo "Error parsing arguments" >&2
            exit 1;;
        esac
      done
      
      thunderbird_command=$(command -v icedove >/dev/null 2>&1 && echo icedove || echo thunderbird)
      $thunderbird_command -compose "subject='$subject',body='$body'"
    2. Make the script executable.
      $ chmod +x /usr/local/bin/knotes-mail-wrapper.sh
      
    3. Go to Configure Knotes… -> Actions and in mail action set it to “/usr/local/bin/knotes-mail-wrapper.sh –subject %t –body %f”.

    Now whenever you right click on a note toolbar and click on Mail…, thunderbird compose window should pop-up with the subject as the note title and body as the content of the note.

  • Setting up SSH and OpenVPN on Netgear WNDR4300

    Introduction
    Unknown to many, the official Netgear WNDR4300 firmware is based on OpenWrt. The procedure described here involves making use of the OpenWrt repos to have openvpn up and running. It also involves recompiling the official firmware. So, this is certainly not for the faint hearted and expects you to have a good knowledge of Linux.

    Stock Firmware Info
    From the file /etc/banner on the router (I will tell later how you can telnet to the router), it is clear that stock firmware is based on OpenWrt kamikaze (bleeding edge, r18571). Based on http://wiki.openwrt.org/about/history, the closest available stable release is Kamikaze 8.09.2 r18801, released in 2010 January. Also, as there is a file /lib/ar71xx.sh in the stock firmware, it indicates that the arch is ar71xx.

    Stock Firmware Compilation And Installation

    1. For stock firmware source compilation, it is recommended to use Ubuntu 10.04 (server edition) as the official firmware binary has been compiled on Ubuntu 10.04.1 (Server) with gcc 4.1.3. So, download and install Ubuntu 10.04 (you can use a VM as it is more convenient).
    2. After installing Ubuntu 10.04 for building the firmware, install build dependencies.
      $ sudo apt-get install gcc-4.1 g++-4.1 libncurses-dev zlib1g-dev gawk flex
      $ cd /usr/bin
      $ sudo ln -s gcc-4.1 gcc
      $ sudo ln -s g++-4.1 g++
      $ sudo ln -s gcc cc
      
    3. Netgear stock firmwares can be downloaded from http://kb.netgear.com/app/answers/detail/a_id/2649. Download and extract WNDR4300-V1.0.1.42_gpl_src.zip. You will also need WNDR4300-V1.0.1.30_gpl_src.zip for the toolchain.
      $ unzip /path/to/WNDR4300-V1.0.1.42_gpl_src.zip
      $ bunzip2 WNDR4300-V1.0.1.42_gpl_src.tar.bz2
      $ tar -xvf WNDR4300-V1.0.1.42_gpl_src.tar
      $ ls
      README.build  wndr4300-GPL.git  wndr4300_gpl_source_list.txt  WNDR4300-V1.0.1.42_gpl_src.tar
      
    4. Add init script wndr4300-GPL.git/target/linux/wndr4300/base-files/etc/init.d/startup with below content:
      #!/bin/sh /etc/rc.common
      START=99
      start() {
        if [ -x /jffs/startup.sh ]; then
          /jffs/startup.sh
        fi
      }
      

      Also make the init script executable

      $ chmod +x wndr4300-GPL.git/target/linux/wndr4300/base-files/etc/init.d/startup
      

      Now, you can write any commands in /jffs/startup.sh and they will be executed whenever the router boots up.

    5. Follow remaining instructions in README.build to finish the build.
    6. The final image is “bin/WNDR4300-V1.0.1.42.img”. Go to the Router Upgrade Page and upgrade to this newly built firmware.

    Logging in to the router (using Telnet)
    You can use the software at https://code.google.com/p/netgear-telnetenable/ to telnet to the router. The instructions for doing this are pretty straight forward.

    OpenWrt wiki page http://wiki.openwrt.org/toh/netgear/telnet.console also mentions other ways of accessing the telnet console but I haven’t tried them as netgear-telnetenable worked like a charm.

    Setting up ipkg

    1. wget, which is used by ipkg for downloading packages, is broken in the stock firmware. So, we need to download wget and dependent packages from http://downloads.openwrt.org/kamikaze/8.09.2/ar71xx/packages and install them. However, as wget is broken, I didn’t know how to download the packages directly to the router. So, I downloaded them to my laptop, started a tftp server on my laptop, logged into the router, and using the tftp client transferred and installed the packages.
      Setting up tftp server is out of the scope of this tutorial, but it is quite easy and you will find many tutorials on-line on how to do it.

      $ python telnetenable.py <IP> <MAC> <Username> <Password>
      BusyBox v1.4.2 (2013-12-26 18:08:07 UTC) Built-in shell (ash)
      Enter 'help' for a list of built-in commands.
      
        _______                     ________        __
       |       |.-----.-----.-----.|  |  |  |.----.|  |_
       |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
       |_______||   __|_____|__|__||________||__|  |____|
                |__| W I R E L E S S   F R E E D O M
       KAMIKAZE (bleeding edge, unknown) ------------------
        * 10 oz Vodka       Shake well with ice and strain
        * 10 oz Triple sec  mixture into 10 shot glasses.
        * 10 oz lime juice  Salute!
       ---------------------------------------------------
      root@WNDR4300:~# tftp -g -r libopenssl_0.9.8i-3.2_mips.ipk 
      root@WNDR4300:~# ipkg install libopenssl_0.9.8i-3.2_mips.ipk
      root@WNDR4300:~# tftp -g -r libopenssl_0.9.8i-3.2_mips.ipk 
      root@WNDR4300:~# ipkg install wget_1.11.4-1_mips.ipk
      
    2. Create /etc/ipkg.conf and update ipkg list.
      root@WNDR4300:~# echo -e "dest root /jffs\nsrc openwrt http://downloads.openwrt.org/kamikaze/8.09.2/ar71xx/packages" > /etc/ipkg
      root@WNDR4300:~# export PATH=/jffs/bin:/jffs/sbin:/jffs/usr/bin:/jffs/usr/sbin:$PATH
      root@WNDR4300:~# ipkg update
      

    Installing SSH

    1. Now, you can install SSH from OpenWrt Kamikaze repos.
      root@WNDR4300:~# ipkg install openssh-server
      

      As a matter of fact, you can install any of the packages in http://downloads.openwrt.org/kamikaze/8.09.2/ar71xx/packages/ and they should most probably work.

    2. Kindly note that the binaries and libraries are installed to /jffs partition and not /, as we we have configured the same in /etc/ipkg.conf (dest root /jffs). We did this so that the files persist when we reboot the router. So, to accommodate this, you will have to modify /jffs/etc/init.d/sshd accordingly. Here is the modified script.
      #!/bin/sh /etc/rc.common
      # Copyright (C) 2006 OpenWrt.org
      START=50
      
      start() {
              for type in rsa dsa; do {
                      # check for keys
                      key=/jffs/etc/ssh/ssh_host_${type}_key
                      [ ! -f $key ] && {
                              # generate missing keys
                              [ -x /jffs/usr/bin/ssh-keygen ] && {
                                      /jffs/usr/bin/ssh-keygen -N '' -t $type -f $key 2>&- >&- && exec /etc/rc.common "$initscript" start
                              } &
                              exit 0
                      }
              }; done
              mkdir -p /var/empty
              chmod 0700 /var/empty
              /jffs/usr/sbin/sshd -f /jffs/etc/ssh/sshd_config
      }
      
      stop() {
              killall sshd
      }
      
    3. To start OpenSSH server:
      root@WNDR4300:~# /jffs/etc/init.d/sshd start
      

    Installing OpenVPN

    1. Install OpenVPN using ipkg
      root@WNDR4300:~# ipkg install openvpn
      
    2. Dump your config file (ex. amaram.vpn.conf) in /jffs/etc/openvpn/ directory.
    3. For OpenVPN, I preferred to start it directly and avoid calling the openvpn init.d script.
      root@WNDR4300:~# LD_LIBRARY_PATH=/jffs/usr/lib /jffs/usr/sbin/openvpn --daemon --cd /jffs/etc/openvpn --config amaram.vpn.conf --log /tmp/openvpn.log
      
    4. You might need to modify iptables rules whenever openvpn starts. This can be achieved by passing the –route-up option to the openvpn binary with argument as path to the script containing the firewall rules to be executed whenever a tunnel is established.

    Configuring the launch script
    We finally have to write the /jffs/startup.sh script to automate setting up of ipkg and starting ssh and openvpn servers whenever the router reboots. Here is the content of /jffs/startup.sh script that I am using:

    # Set PATH
    echo "export PATH=/jffs/bin:/jffs/sbin:/jffs/usr/bin:/jffs/usr/sbin:\$PATH" >> /etc/profile
    
    # Set LD_LIBRARY_PATH
    echo "export LD_LIBRARY_PATH=/jffs/usr/lib" >> /etc/profile
    
    # Setup ipkg
    echo -e "dest root /jffs\nsrc openwrt http://downloads.openwrt.org/kamikaze/8.09.2/ar71xx/packages" > /etc/ipkg.conf
    
    # SSH authorized_keys
    mkdir -p /tmp/.ssh
    echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6emYnBS1NLG1j1HsuMb3X6nI0+jWrpRvjhBSuB9q4lOO4NpxNdgCiDd7+qoYGLd4fE7hy/GYN1TvXXuDtDZPnuIOg8XaRxZg5wSDZV0nRsDNKGH8NikGzvxGEI9KeqBNrl+iRLS/ipl0QRmLpNScwXWOW6h9eP+S7GaL6Y56YyL+uwuUg14ow2nA2YFYQKLRXM20EiEm4C419XknYHsIG16ix2AamrH1CGJrQCo0m6f1Kf5OUjX8gSQvaToaD2J5NFbdGfaykW/RvmQH+37PlVnfE24SVrZ0ylRHvnqMTgSE1ZQ54U/zAbRpwB3vpEQCdW/kNz/gLwzbUHW0yzEw+w== rahul@rahul-laptop" > /tmp/.ssh/authorized_keys
    
    # Start SSH
    /jffs/etc/init.d/sshd start
    
    # Start openvpn
    LD_LIBRARY_PATH=/jffs/usr/lib /jffs/usr/sbin/openvpn --daemon --cd /jffs/etc/openvpn --config amaram.vpn.conf --log /tmp/openvpn.log
    
  • Filing Complaint In Consumer Court India

    A while back, I had filed a case in the consumer court of India against HP for giving me a faulty HP printer, which was consuming high amount of ink. I thought it might be beneficial to share the details pertaining to the case so that others could benefit from it.

    Should I file a case?
    Before proceeding, I would like to clearly mention, that after going through the entire ordeal, I am now of the opinion that one should file a case under only one of the below three conditions:

    1. The amount involved is huge
    2. The judgement passed benefits a larger audience rather than just an individual
    3. It is something that is sensitive in nature. For ex., the negligence of doctors causing the death of your relative (not sure if this comes under the Consumer Court or Criminal Court, but I believe you get the point)

    There are many steps from filing the case to judgement. And for every step, the opposite party can be absent for upto 3 to 4 times. Therefore it is not uncommon to take even 25 hearings to pass the judgement. And there is generally only one hearing per month. This could mean that it could take well above two years for the judgement. Not to forget, the opposite party can again challenge the judgement in a higher consumer court.

    Therefore, unless you have a strong reason, and strong evidence, the effort and time you put in might not justify the end result.

    Types of Consumer Courts
    There are three types of consumer court – District Consumer Disputes Redressal Forum, State Consumer Disputes Redressal Commission, and National Consumer Disputes Redressal Commission. Based on the amount involved in the case, it gets filed in the appropriate forum.

    Steps involved

    1. Sending a notice to the opposite party – The first step involved, al though not an actual part of filing a complaint in Consumer Court, but is nevertheless needed, is to send a notice to the Opposite party. This notice should mention the details of the complaint, and what you are seeking, and also that you would file a case in consumer court if no response is received within the stipulated time. It often happens that the opposite party tends to resolve your concern at this stage. If so, consider yourself lucky :). For reference, I am attaching the notices (notice1.pdf and notice2.pdf) and the responses (notice1-response.pdf and notice2-response.pdf) that I got from HP. I had sent two notices as they had requested for some time.
    2. Filing the complaint in Consumer Court – The first step involved is filing the complaint. For this, you will have to submit two copies to the court, and an additional copy for each of the opposite party. Kindly note that you should not submit the original evidence, such as invoices, right now. Another important point to keep in mind is that you can also demand monetary compensation for the time, effort and mental harassment that you had to go through. For reference, I have attached the complaint and affidavit that I have filed (complaint.pdf and affidavit.pdf).
    3. Counter / Response from Opposite Party – After you file the case, the complaint is sent to the opposite party. The opposite party then responds to the complaint. This is known as Counter. For reference, I have attached the counter sent by HP (counter.pdf).
    4. Evidence Under Affidavit / Rejoinder – Next step involved is to file a rejoinder to the counter that has been given by opposite party. The rejoinder serves two purposes. First is to counter-argument the response given by the Opposite Party. Second is to submit the original evidence in support of your arguments (invoices, etc.). For reference, I am attaching the rejoinder and its associated affidavit that I had filed (rejoinder.pdf and rejoinder-affidavit.pdf).
    5. Marking of documents – Next the documents that are submitted as evidence have to be marked by the judge.
    6. Evidence by Opposite Party – After marking of the documents submitted as evidence, the opposite party is asked to submit evidence. In my case, the Opposite Party requested to use the counter as evidence.
    7. Written arguments by Complainant – Next comes submission of the written arguments by the complainant. I requested to use the rejoinder that I submitted for written arguments as I had nothing else to add. For reference, I am attaching the memo that I had submitted requesting using the rejoinder for written arguments (written-arguments-memo.pdf)
    8. Written arguments by Opposite Party – Similarly, the opposite party will also submit the written arguments. In my case, the opposite party requested that the counter be considered as written arguments.
    9. Oral Arguments – In my case, there were no oral arguments. Probably because the amount involved was not huge. But I have heard that oral arguments are part of the process.
    10. Judgement – Now comes the most crucial stage of the entire process, the judgement. The judgement is delivered in the form of a written order. For reference, I am attaching the final written order (order.pdf).
    11. Petition – Assuming that the order is in your favour, and that the opposite party has not responded to the order within 40 days, you will have to file a petition requesting the court to take action against the opposite party for enforcing the order. I was told to submit 5 copies and submit the original order as well (keeping a copy for myself). For reference, I am attaching the petition that I have filed (petition.pdf)

    After filing the petition, either the Opposite Party might agree to uphold the order or it might challenge the order in a higher level consumer court.

    So, what happened with my case?

    I guess this speaks for itself.

    Finally, I won the case and HP took back the printer and paid me compensation as per the order passed by the court :).

    Case Notes
    Aug 2011 – Filed the case
    Sep 2011 – Opposite party did not turn up
    Oct 2011 – Opposite party did not turn up
    Nov 2011 – Opposite party turned up and asked for some more time
    Dec 2011 – Opposite party handed over the counter (response to the complaint).
    Jan 2012 – Went to the court. Was supposed to submit an evidence under affidavit. But wasn’t aware of it.
    Feb 2012 – Submitted the evidence under affidavit.
    Mar 2012 – Documents were supposed to be marked. But postponed this to April.
    Apr 2012 – Documents had been marked. Opposite party had to submit evidence.
    May 2012 – Judge was on leave.
    Jun 2012 – Opposite Party asked for two weeks time to submit Evidence.
    Jul 2012 – Opposite Party again asked for two weeks time to submit Evidence. The Judge marked it as the last chance.
    Jul 2012 – Opposite Party asked to use the counter that he gave initially as evidence. Marking of documents and final hearing scheduled for next month.
    Aug 2012 – Opposite party was present. Judge asked to come next month. No other conversation.
    Sep 2012 – Written arguments to be submitted next month. The previous written evidence could be used for written arguments.
    Oct 2012 – Documents were marked now. A 2 minute process where each document/exhibit is marked as A1, A2, …. (probably implying Annexure 1, Annexure 2, …). Arguments to be submitted next time. As I wanted to use evidence for arguments, I was asked to submit a written memo mentioning this.
    Nov 2012 – Submitted written memo requesting to use rejoinder / written evidence for written arguments. (Note: It is always a good idea to take a signature from OP whenever a document is given to them)
    Dec 2012 – Case closes. The judge enquired whether the written arguments were submitted and informed that the order would be passed in a week. There were no oral arguments though.
    Jan 2013 – Followed up with the court on the status of the order
    Feb 2013 – Again visited the court to find the status. Order had been given in my favour.
    Mar 2013 – Received the order by post asking the opposite party to compensate for the charges.
    Apr 2013 – Went to court to find out what to do next as 40 days has passed. I have been asked to file an Execution Petition. I was told to submit 5 copies and submit the original order as well (keeping a copy for myself).
    Jun 2013 – Finally, HP agrees to refund me as per the order and I am asked to collect the cheque.

  • Linux Backup Solutions

    In an earlier post, I spoke about the need for backup. However, I hardly spoke about the available backup solutions in Linux and just mentioned about a software that I no longer use. In this article, I will primarily focus on some of the popular linux backup solutions.

    Factors to consider

    There are many questions one should ask himself before deciding on a backup solution. Some of them being:

    • What is the scale of the backup? Is it just my system or is it multiple systems in the network?
    • Do I want to backup to hark disk or cloud (S3, rackspace) or tapes or CD/DVD?
    • What protocol should be used for backing up over network?
    • Do I want the backed up archives to be automatically split into fixed sizes? (for example for writing to CD/DVD)
    • While using windows, should the permissions of files be backed up as well?
    • For network based backup, should it be a pull model or push model i.e. should the backup be initiated from the backup server or from the machine being backed up?
    • Do I want the backups to be stored opaquely (archives) or transparently (plain files)? Note that storing in transparent format (i.e. as plain files) has its limitations that compression and encryption cannot be supported
    • What is the backup frequency and policy that I want to use?
    • Is it feasible to automatically purge old backup data?

    Graphical Backup Software for Desktop PCs

    There are three popular graphical backup software : Déjà Dup (which is actually a graphical frontend to duplicity), Back In Time and luckyBackup. All of them are good but there are features in one which is missing in other. Therefore it became impossible for me to decide on which was the best. Below is a comparison chart of all the three software. I leave it for you to decide which one do you want to use.

      Déjà Dup Back In Time luckyBackup
    Description Déjà Dup is a simple backup tool. It hides the complexity of backing up the Right Way (encrypted, off-site, and regular) and uses duplicity as the backend. Back In Time is a simple backup tool for Linux inspired from “flyback project” and “TimeVault”. The backup is done by taking snapshots of a specified set of directories. luckyBackup is an application for data back-up and synchronization powered by the rsync tool. It is simple to use, fast (transfers over only changes made and not all data), safe (keeps your data safe by checking all declared directories before proceeding in any data manipulation), reliable and fully customizable
    Scheduling Method Daemon (deja-dup-monitor) started upon user desktop login. Can also be scheduled using Cron. Cron Cron
    Highest Backup Frequency Daily (can be configured for hourly by following this tip) 5 mins Cron compatible
    Visual notification during backup System Tray None System Tray
    Simulated Run (for backup and restore) No No Yes
    Backup Locations S3, FTP, SSH, Webdav, Windows Share, Custom Location, Local Folder SSH, Local Folder SSH
    Restore individual files Yes Yes No
    Backup data format Opaque All revisions are stored transparently Only the most recent backup is stored transparently
    File Browser Integration Out-of-the box integration with Nautius (GNOME) and can be integrated with Dolphin (KDE) as well No No
    Support for multiple profiles No Yes Yes
    UI Ease of Use Very Simple Easy Average
    Encrypted Backups Yes No No
    Old Backups Purge Policy Based on time Based on time Based on number of snapshots

    As you can see, it is pretty difficult to select one clear winner as the features provided by one are not found in the other. I encourage you to take the above comparison table as a starter and evaluate each of the products before deciding on one.

    Command Line Backup Software

    rdiff-backup – rdiff-backup backs up one directory to another, possibly over a network. The target directory ends up a copy of the source directory, but extra reverse diffs are stored in a special subdirectory of that target directory, so you can still recover files lost some time ago. The idea is to combine the best features of a mirror and an incremental backup. rdiff-backup also preserves subdirectories, hard links, dev files, permissions, uid/gid ownership, modification times, extended attributes, acls, and resource forks. Also, rdiff-backup can operate in a bandwidth efficient manner over a pipe, like rsync. Thus you can use rdiff-backup and ssh to securely back a hard drive up to a remote location, and only the differences will be transmitted. Finally, rdiff-backup is easy to use and settings have sensical defaults. Check out its complete set of features.

    duplicity – Duplicity backs directories by producing encrypted tar-format volumes and uploading them to a remote or local file server. Because duplicity uses librsync, the incremental archives are space efficient and only record the parts of files that have changed since the last backup. Because duplicity uses GnuPG to encrypt and/or sign these archives, they will be safe from spying and/or modification by the server. Check out its complete set of features.

    rsnapshot – rsnapshot is a filesystem snapshot utility for making backups of local and remote systems. Using rsync and hard links, it is possible to keep multiple, full backups instantly available. The disk space required is just a little more than the space of one full backup, plus incrementals. Depending on your configuration, it is quite possible to set up in just a few minutes. Files can be restored by the users who own them, without the root user getting involved. There are no tapes to change, so once it’s set up, your backups can happen automatically untouched by human hands. And because rsnapshot only keeps a fixed (but configurable) number of snapshots, the amount of disk space used will not continuously grow.

    DAR – Disk ARchive – dar is a shell command that backs up directory trees and files, taking care of hard links, Extended Attributes, sparse files, MacOS’s file forks, any inode type (including Solaris Door inodes), etc. From a filesystem, dar creates an archive, which may be split in a set of files (called slices) which size is user defined. Dar archives are suitable to be stored on floppy, CD, DVD, usb key, hard disks, and since release 2.4.0 to tapes too. Dar can perform full backup, incremental backup, differential backup and decremental backup. Dar is able to be run on a live filesystem. Dar can be used through ssh for remote backups. Check out its complete set of features. Combined with SaraB, it is possible to schedule and rotate backups on random-access media. SaraB supports the Towers of Hanoi, Grandfather-Father-Son, or any custom backup rotation strategy. It is easy to use and highly configurable.

    Box Backup (supports continuous backup) – (As mentioned in wikipedia) Box Backup is a client-server application in which a client sends data to the server for storage. The server provides management of client via certificates, storage quotas, and data retention. Together, a unique and robust solution is created that scales allowing clients with low-bandwidth connections to effectively perform reliable backups. Box Backup is ideal for backing up laptops and computers with intermittent or low-bandwidth connections, because it is capable of continuous data protection in the background, starting automatically when an internet connection is present, and recovering gracefully and efficiently from connection failures. Box Backup uses a modified version of the Rsync algorithm, that works with encrypted blocks. This allows it to store data on the server in a form that the server operator cannot read, while still uploading only changed portions of data files.

    Enterprise Grade Network Backup Software

    My personal favourite when it comes to enterprise grade backup software is BackupPC. The most important reasons being:

    • Disk-based backup medium (and not tape based)
    • Simple to setup (unlike most other enterprise grade backup solutions)
    • Easy to use web interface where I can manage backups, restore from backups and view status of all backups (missing with most other solutions)
    • Compression and De-duplication
    • Password protection of archives. See http://akutz.wordpress.com/2008/12/23/creating-archives-with-backuppc-and-7zip/
    • Auto-splitting to fit on CDs/DVDs

    Other popular software considered were Amanda (too complicated for small networks and primary backup medium is tapes) and Bacula (almost ideal solution but is slightly complicated to setup. Also provides native client for windows implying backup and restore preserves file permissions as they are).

    References:

    • http://askubuntu.com/questions/2596/comparison-of-backup-tools
    • http://forums.linuxmint.com/viewtopic.php?f=90&t=87236
    • http://www.techdrivein.com/2010/12/top-5-open-source-backup-software-for.html
    • http://www.techradar.com/news/software/applications/best-linux-backup-software-8-tools-on-test-909380/4
    • http://www.techrepublic.com/blog/10things/10-outstanding-linux-backup-utilities/895
    • http://en.wikipedia.org/wiki/List_of_backup_software
  • Setting up hourly backups in Deja Dup

    Déjà Dup is an excellent graphical backup solution for the GNOME Desktop environment. However, it is limited by that it does not provide backup frequency higher than a day through its graphical interface. So, we will leverage cron to achieve this for us. Adding a simple cron job with the command “xvfb-run deja-dup –backup –auto” will do the trick. But there no fun in it. So lets do it with some style so that we receive the same visual notification that we get whenever a backup happens.

    1. First we need to keep track of the X server display that we log into. This can be done by creating a temporary file whenever we login which contains the value of the DISPLAY environment variable. For this, we will have to add an autostart script. Running the below command should do that:
      $ echo -e '[Desktop Entry]\nName=Dump Display\nType=Application\nExec=echo $DISPLAY > /tmp/display-`whoami`' > ~/.config/autostart/dump-display.desktop
      
    2. Next add the below cron entry (customize the frequency as you like)
      0 * * * *       DISPLAY_FILE="/tmp/display-`whoami`" ; test -f $DISPLAY_FILE  && XCMD="env DISPLAY=`cat $DISPLAY_FILE`" || XCMD="xvfb-run" ; $XCMD deja-dup --backup --auto 1>/dev/null 2>&1
      
    3. If you do not have xvfb-run command, you can install the xvfb package which provides it:
      $ apt-get install xvfb

    However, it should be noted that if you login and logout, the file /tmp/display- is left dangling with old information and so the cron command might fail to run successfully till you again login to your desktop session.

  • The Theeka Pan Experience

    Another Sunday evening. With my wife not at home, I feel bored and decide to go to office and finish some pending work. After work, I go to a restaurant and have two delicious parathas. As I begin to walk home, I pass a paan shop where I had a meetha (sweet) paan the other day and had relished it. So, I go to the paan shop and not wanting to have the same flavour paan again, order for a theeka pan. I pay the guy and start walking home chewing the paan.

    Within less than a minute of starting chewing the paan, I begin to feel extremely dizzy. I’m unable to walk straight. I was holding two water bottles in my hand and it felt impossible to hold them any longer. My body began to sweat and I started to feel slightly nauseous. I jut couldn’t understand what was happening to my body. Wild thoughts start crossing my mind. Have I been sedated? Could this be the symptoms of some dominant major health condition which has just manifested? Was it the food at the restaurant? Or was it the paan?

    I had already swallowed half of the paan by now. I quickly look around for a spot and spit out the rest. It was already past ten in the evening and there just seemed no way I could make it home, which was still about a kilometer away. Thinking quickly, I ran back to a restaurant where I have dinner generally. Terrified and not understanding what was happening to my body, I called up a colleague of mine living in the same building as mine. He came like a God sent person, and took me home.

    After reaching home, I just fall flat in my bed. The feeling of nausea had increased and my body continued to sweat , the way it happens when you are running a high fever and then it suddenly comes down. I have a hard time trying to fall asleep and get up much earlier than usual the next day. I felt I had lost my appetite and didn’t feel like eating anything much that day morning. However, by lunch, I had recovered and was feeling much better.

    So, what had happened? Simple. The paan which I had ordered contained tobacco. The two varieties of paan that I have are Meetha (Sweet) Paan and Saada (Plain/Mild) Paan. For some reason, I wasn’t able to recollect the latter name and instead asked for a theeka paan. The guy at the paan shop took it for a tambaaku (tobacco) paan which I had never had my life. And all the side-effects that I have mentioned above, were as a result of my first time consuming of tobacco.

    This will be quite an episode that I’ll remember all my life. I often wonder – Does it really take rocket science to understand that a substance that can affect your body so strongly, could also have extreme adverse affects on your health? Shouldn’t this be the first sign to turn one away from smoking and nicotine. Yet, people get involved and addicted with it. Food for thought.