Category Archives: tech tips

Churning out ruby gems

If you didn’t already know then let me tell you that I’m a huge fan of the ruby programming language. I have dabbed with a few imperative languages and none can come close to ruby, it’s syntax is like sugar and libraries like alcohol. You get addicted to them once you start. I use gems (that’s the fancy name for ruby libraries) from time to time. They can be used in both programs that you write and some also provide a standalone binary. But that is hardly the fascinating part, what is fascinating is that how easy it is to create them. I just created one and will mention the steps briefly so that you are also inspired to try your hand at it. Continue reading Churning out ruby gems

Installing ubuntu to a usb drive using vmware

In this post I’m going to walk you through installing ubuntu on a usb drive using vmware, that can boot any system not only virtual machines also we’ll create an ntfs/fat32 partition so that we can use it with windows computers as an ordinary pen drive too.

The first step is to partition the pendrive, I have a 16 GB device and I’ll use half of it for the linux installation and the other half for data. We can use either gparted or cfdisk from the live cd to do this. Another important thing to note is that for any usb storage device, it’s life is affected more by the number of writes that reads. So we’ll also tune a few parameters after the installation to maximize the life of the usb drive.

Partitioned USB drive - VMware Player_2012-06-25_16-10-56

Once the device is partitioned correctly we can install ubuntu as we would on an ordinary hard drive be sure to install the boot loader to the usb drive too. Don’t create any swap partition during the installation that will literally kill your usb drive because it continuously writes data to and from the swap.
Also, having a swap partition on a usb drive doesn’t make too much sense. There is no way you can compare the performance of the RAM to a cheap usb disk.

Once you are done with it, you have successfully installed ubuntu to a usb drive, you can use this to boot any computer. Your OS form now will be in your pocket but I’ll mention a few tips that will make your performance slightly better by using the usb drive more efficiently. Linux keeps a track of the timestamps when files are accessed, this involves writing data to the disk whenever a file is used on a usb drive this is something we don’t need. You can disable this using the noatime option in /etc/fstab. Also we shouldn’t keep update the systemeach time a tiny update is released and ther is no benefit of caching the packages or letting ubuntu install multiple kernels. It may also help to use cinnamon, I have described how that can be used in an earlier blog post. Another thing is that you shouldn’t install restricted drivers or vmware tools as they will create a problem when you boot on machines where that specific piece of hardware isn’t present.

To summarize, keep the usb install lean and mean, you can install the gcc compilers and configure vim and you now have a world class OS in your pocket to use anywhere you want. Let me know how your install went and feel free to ask if you have any doubts in the comments.

Creating a usb recovery image for a netbook using dd

Yesterday I got my new shiny Acer aspire one 722 netbook, it comes with windows 7 starter and I’m not going to stick with it for long but before I start with my experiments I thought of creating a recovery image for it. Having one is particularly useful if things go wrong and you want to use Acer’s warranty, trust me it’s a pain in the rear to explain to the customer support that you use linux or another operating system. Fortunately acer ships with Acer E Recovery Management which is an excellent utility to create a startup disk. I used my USB drive to create a restore disk and also to store my drivers. The only problem is that it took a total of about 12GB out of the 16GB available on my USB drive. I keep using the pendrive for other things too so this couldn’t be a permanent solution. Continue reading Creating a usb recovery image for a netbook using dd

MTS Settings for Ubuntu 12.04

I switched to ubuntu after the new LTS release and was having some problems with my MTS Mblaze connection. Sometime’s it’d work and sometimes it wouldn’t. There seems to be a bug in modem-manager which constantly keeps crashing so I decided to use wvdial instead. We need to install the wvdial package

sudo apt-get install wvdial

and then create the file /etc/wvdial.conf

[Dialer mts]
Stupid Mode = 1 
Inherits = Modem0 
Password = mts 
Username = 
Phone = #777 
Init1 = ATZ 
SetVolume = 0 
Modem = /dev/ttyUSB0 
Baud = 115200 
FlowControl = Hardware (CRTSCTS) 
Dial Command = ATDT 

Then we can connect to the internet using

sudo wvdial mts

This is the output that I get when the dialer is run. Occasionally it will have some problems you can just disconnect and try again.

--> WvDial: Internet dialer version 1.61 
--> Initializing modem. 
--> Sending: ATZ OK 
--> Modem initialized. 
--> Sending: ATDT#777 
--> Waiting for carrier. ATDT#777 CONNECT 3100000 
--> Carrier detected.  Starting PPP immediately. 
--> Starting pppd at Sun May  6 18:35:05 2012 
--> Pid of pppd: 7231 
--> Using interface ppp0 
--> local  IP address 
--> remote IP address 
--> primary   DNS address 
--> secondary DNS address