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

Oh My ZSH!

I spend a lot of time in front of the terminal and have been using bash ever since I can remember, it’s a fine shell indeed but as I discovered recently, there is a better alternative available. I came across a github project that extends zsh and adds to it, tonnes of features including themes, plugins and configurations Continue reading Oh My ZSH!

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 = internet@internet.mtsindia.in 
Phone = #777 
[Modem0] 
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 116.202.159.156 
--> remote IP address 10.228.138.131 
--> primary   DNS address 10.228.129.114 
--> secondary DNS address 10.228.129.113 

Accessing github in NITT

In my opinion github is the best way to share code on the internet but it was not possible to use it in NITT because of the geniuses that are our network administrators and their love for the beast that is sonicwall. This is bizarre when you think that most of the students of this prestigious engineering college would work with code on a regular basis, the only thing more bizarre would the count of students who don’t know about source code management at all.

This is now no more of an issue as github has come up with smart HTTP support. Now not only can all of us who are behind sonicwall can use it but anyone behind any firewall can, the other good part is that the transportation algorithm has been optimized so it uses lesser bandwidth. Do drop in a line if your institute also has a crazy firewall that blocks legitimate things.

The Lost Dan Brown

I had been a huge fan of Dan Brown, his initial few novels sold like wildfire and I was hooked to them. All of them were pageturners The da vinci code, Digital fortress and Angels and demons were all magnificent. Sadly and inevitably the master of conspiracy theories has finally run out of fuel to keep that fire burning.

Recently I read the Lost Symbol and it was a pain to labour through and the story more or less tells us that masons are grown ups who like dressing up and play wierd games. In general when I come across a poor book I just ignore it but this one was so pathetic that I must take time out and warn my fellow readers on the net to not commit the mistake that I made.

I think this is a manifestation of greed of the publishers, In Dan Brown they had a goose that laid golden eggs, they’ve fucked it so bad that now all you get is shit.

Of late I did read a few excellent books that one can definitely read, Laila Lamani’s The lost sun, Anita Desai’s The village by the sea or Fathima Bhutto’s Songs of blood and war would be a far better utilization of time for someone picking up a new book to read.

If you have any suggestions on what I should read( I’ll definitely read it if available in NITT’s Library), then drop in a line.

Getting MySQL to work on arch linux

I was setting up the LAMP stack on my arch linux installation, I followed the wonderful arch wiki and had no trouble getting apache and php working but there seems to be a problem with MySQL. It installs just fine but the daemon doesn’t start up.


lovelock# rc.d restart mysqld
:: Stopping MySQL Server [FAIL]
:: Starting MySQL Server  [FAIL]

I tried fixing the ownership and permissions but didn’t have any success. I realized the cause of the problem after running mysqld_safe

lovelock# /etc/rc.d/mysqld
usage: /etc/rc.d/mysqld {start|stop|restart}
lovelock# mysqld_safe
/usr/bin/mysqld_safe: line 531: hostname: command not found
111209 17:06:03 mysqld_safe Logging to '/var/lib/mysql/.err'.
/usr/bin/mysqld_safe: line 608: hostname: command not found
111209 17:06:03 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
111209 17:06:03 mysqld_safe mysqld from pid file /var/lib/mysql/.pid ended

I installed hostname


pacman -S inetutils

But that didn’t solve it either and I had to do this to fix it

rm -rf /var/lib/mysql/*
mysql_install_db --user=mysql --basedir=/usr

This removes the databases and creates a new copy. For me it wasn’t an issue as this is a fresh install but you should be careful when upgrading mysql. Its always handy to back up the databases first.

The online journal of Nikhil Bhardwaj