Pages

Wednesday, March 16, 2011

Partitioning your hard drive for multiple operating systems

Note: Do check out the hyperlinks in the post and use internet search for terms that you don't full understand. This whole scheme is a production of my idle brain and you can use it at your own risk.


The most crucial step while installing Linux is partitioning your hard drive. This is where most of the first time users end up loosing all their data. I had lost mine too ;). Don't worry I am not trying to scare you off. Its just that you need to be a little more careful and back up all your data before you proceed.
Most of the user friendly distros provide you with appropriate disk management tools for setting up your filesystem. What boggles the first time users is the invisibility of C: and D: drives that they have been so used to. Here they are referred to as /dev/sda1 and /dev/sda2 and some more alien symbols :P. Here is more information on the naming convention for partitions.  And here is  more gyan about primary and extended (or logical) partitions.
One more thing that is worth noting is that there can be a maximum of four primary partitions on a harddrive whereas there may be any number of logical partitions and most Windows OS boot from a primary partition only while Linux is capable of booting from logical partitions also.
Basic needs while installing a dual boot system may be

  • obviously, being able to boot into both OS at will.
  • access data from both OS.
  • have space to install and try more distros.
This is a wikipedia article on UNIX / Linux filesystem hierarchy. A bare-bone Linux installation needs two partitions to work properly: root (/) and swap. With this said and done I would like to show my own partition scheme and then explain what made me do so.
My stable partition scheme - developed after months of tampering and reinstalling.
The screenshot is pretty much self explanatory, however, what needs a little bit of introduction are the following:
  • Repository (NTFS) partition: One thing that the windows operating systems are famous for (apart from their baseless user-friendliness) is their proneness to crashes and viruses. One should prefer keeping data on a partition other than the one containing system files so that a reinstall of windows does not wash them away.
  • Swap: This partition is used by all Linux / UNIX based operating systems for the purpose of paging. More info on Swap space is available here.
  • Home partition: My idea of a separate and central home partition shared by all the Linux distributions is something that allows me to keep all my files on one drive irrespective of the location I OS I work from. And hence I do not have to hunt for files on different OSs when I need them. 
  • The other partitions you see are the root partitions of different OSs that I tried followed by the free space available for me to try more distros ;)
Although its not much of a problem form me now a days but ext (or Linux partitions) can not be accessed from Windows. Although many tools are available for facilitating that, I didn't find anything that would work flawlessly. So one should refrain from storing files on the Linux partition that might be required while running Windows, otherwise switch over to Linux completely.
This is something I found to be a stable configuration for my harddisk partition scheme and the idea is an independent production of my idle brain after months of wondering and tampering and re-installations. Hope this helps a troubled soul lost in the fromatting dilemma finding peace and decide on a partitioning scheme.
There shall be more posts on easily and successfully how I configured a multi-boot system.

Wednesday, March 9, 2011

36 hours in a train

It has been 8 hours since I got off the train which brought me from Delhi to Bangalore in 36 hours, but as I type this piece of my thoughts, I feel the to and fro swaying as if I was still in the train. Quite unusually and against the reputation for Indian Railways, the train left from Nizamuddin and reached Yesvantpuram on time.

This time I decided to travel by the non-AC sleeper class as the weather was pleasant and it just didn't seem sensible enough to pay thrice the usual fare just for being able to charge and use Laptop the whole way. To my demise there were just two charging slots working in 9 sleeper cars and they refused to charge my laptop as they couldn't take the load. This made me feed hungrily on Digit's March issue I was carrying with myself. After I was done with it I started with John Grisham's Theodore Boone which a co-passenger was trying to read. Alas that even lasted for hardly 4 hours. So what I did all the way was sleep, admire the scenery and think.
Scenery was really great but I didn't bother taking pictures because I knew from my previous experience that in such a condition (moving train) I would have to take thousands of pictures out of which only a few would turn out good. Then I thought of getting down the train and taking pictures which triggered a dream in which I was trekking along the mountains with just a d-SLR and a GPS.
I couldn't help but think about the plight of Indian Railways. Why do they assume that people travelling in sleeper won't be having laptop computers or the other way round people with laptops will not travel in sleeper class? The standard of travel in Indian Railways needs to improve a lot. I have a suggestion of creating a non AC first class sleeper in which people with proper reservation would be treated in the similar way as the AC ones so there is more sense of security more comfort and less wait-listed passengers would think of tagging along somebody. The train was almost empty the whole way so the wait-listed passenger problem was not there but I couldn't help but imagine in how many ways the standard in which the Indian mass travels can be improved. eg there is perhaps a design flow due to which water from the tank over wash-room and presence of mirrors in every compartment instead of most desired plug-points. Thoughts also came flashing by when swarms of trans-gender beggars (hijras - as they are popularly called) and asked for money as if I owed them all I had. Seriously, this problem is out of hands and needs controlling now. For most part off the journey I couldn't find electric poles which meant we were travelling in diesel, and I wondered how, if at all, were all engines going green. On the whole the journey passed with its share of daydreaming, conversing, sleeping, actually dreaming and reading.


Trust me, I have experienced the worse train journey once http://bit.ly/h6Ksh9  and nothing can strike that chord again. So this journey was a good one.

Tuesday, March 1, 2011

Portrait of a Rat

There are rats in my hostel .. and this is the proof.

One day I requested Mr Rat to pose so that I could take a picture  and post it on my blog ;) .
Just kidding !! It got caught accidentally on new years eve and I couldn't let it go without taking a few pictures :P. For the Animal Rights Evangelists, I took it far from my hostel and released it near a gutter on the New Years Day. There are still many that keep plundering my food stuff. :(

Monday, February 28, 2011

NO STOPPING NO STANDING

It is meant to be followed while driving but people tend to abide by it while LIVING.
chalna hi zindagi hai ... chalte hi jaa rahe hai 
NO STOPPING NO STANDING

Sunday, February 27, 2011

A worthy candidate for my desktop wallpaper.


I have no idea what its called, it was attractive enough to grasp my camera's attention :)

Tuesday, February 22, 2011

kill a non responsive process

So what do you do when you a process running on your Linux box hangs? Obviously you terminate it and start it again. But how do you terminate it is the question - series of commands or few clicks in System Monitor?
Frankly this post is for those who use the terminal - the "geeks".
Until today I used to kill programs "in this case" like 
$ ps -e | grep firefox
which gave me output like
2472 ?        00:00:00 firefox
2480 ?        07:16:45 firefox-bin  
And I used to fire
$ kill  2472 2480
to terminate the programs.
But today it just occurred to me to automate the process of looking up the process number and killing them. So I set out to use gawk and xargs.
Using gawk I got the process numbers extracted from the output of grep like this:-
$ ps -e | grep firefox | gawk '{print $1}'
2472
2480
and then pipelined this output to xargs kill to invoke kill on each pid.
$ ps -e | grep firefox | gawk '{print $1}' |xargs kill
It kills two processes but for completely restarting the application go to a terminal and type
$ ps -e | grep firefox | gawk '{print $1}' |xargs kill; firefox &
$ firefox & # starts firefox in the back ground
This served my purpose. Terminating two processes manually is not a big task, but why not automate it and make the computer do it for you if its possible?
And don't forget to have a look at man pages of gawk xargs and grep because that is the ultimate source of knowledge :)

Saturday, February 19, 2011

calculate 5000th fibonacci number

This year programming competition in tech-fest at college, was organised by the friend with whom I team up for participating in competitions of other colleges. It was obviously better than previous years. I mean,questions were good, had considerable participants and most importantly, programming was supposed to be done using gcc/g++/java.
There was a question which asked to print the n^th term of Fibonacci series where 0<=n<=5000. Frankly such a large number does not fit in whatever predefined data type you can think of. Creating something like BigInteger of java would have been impossible during the competition and I am not an expert when it comes to java, so I skipped the problem. The coordinators accepted solution for 20 to 30 terms from other teams but demanded it for 5000 from me :P (being famous has its drawbacks !!!). Still I concentrated on other problems  (got through this one but couldn't go to the finals because its timing clashed with another one :( ).
Later that night, after the competition was over, one of the coordinators pinged me on gtalk and asked sarcastically for the solution. This got on my nerves and I determined that I will smack the 5000th element on their face.
There was a bigint library I had created about an year ago which stored numbers in character arrays and manipulated them. I shuffled through my code directory, found it and quickly created a recursive function using memorisation to serve the purpose. The problem was that it worked fine for inputs upto 1302 but gave a segmentation fault for numbers above that. Puzzled and perplexed I resorted to Internet search and discovered that it was because of default stack size of 1MB allocated to every process. A few minutes later I stumbled upon the solution to increasing it which was as simple as adding
ulimit -s unlimited  
to
/home/<user_name>/.bashrc  
file and starting a new session. This increased the stack size to unlimited i.e now my program could use all the RAM available.
After this was done, my program successfully calculated and printed the sequence upto 7000 but ran out of RAM after this and gave Bus Error. 
I redirected the output of the program to a text file, attached it to a mail and sent it to the coordinators ;)
Here is a screenshot showing a terminal window with the 7000th Fibonacci number and  the state of my system while calculating it.

P.S: The code for my program is hosted at www.github.com/bhanuvrat/bigint .

Tuesday, June 29, 2010

misusing transport technology

I have just had the worst travelling experience on my way back from Patna to Dhanbad. In a compartment meant to accommodate 8 there were at least 20-25 people stuffed like pigs and hens. Although I had a berth reserved for me, it was occupied by 5 other people. And these were not the ones with a wait-listed Sleeper ticket that did not get confirmed, they were the ones supposed to be travelling in Second Seater. The situation was worsened by the hot and humid climate. "We Indians are hairy people, we perspire a lot and then stink" - Russel Peters. Its not like I haven't travelled in DTC busses, but that is for at most 2 hours while this was a 9 hour journey ( took 11 - courtsey highly unpunctual Indian Railways). I developed sympathy for the British people whom I hated for kicking Indians out of railway carriages during British Raj, because I was feeling a similar urge. Until 12 there was no sign of any TT, and upon inquiring we came to know about incidences when these so called "daily passengers" had pushed the Ticket Checker out of running train.

All we so called tech-literates complain about is slow speed of Internet and interrupted power supply while there are people who still travel like slaves, and the middle class people are not able to travel comfortably despite having paid for it. Indian Railways boasts off about being the only successful public sector railways! But I want to ask the authorities, what do they want me to be proud of? The stinking platforms of Old Delhi where all you can see is shit on tracks or the utterly comfortable journey that I just had?

Thursday, May 27, 2010

FC13 : solution to apparently all problems.

Yesterday I came across a tweet which said Fedora core 13 has been released. I have been using FC12 for over a month now and hence was excited about FC13. Although I am on the verge of crossing the data limit of my internet connection, I downloaded the live CD and gave it a try. I was astonished by my findings.

FC13 has done away with most of my problems.

I am merrily downloading the Installer DVD, can't wait for tech-magazines to ship it with them. I think most of the major distributions coming out now will be able to include the required drivers and hence work out of the box on my DELL. So in case you've been facing problems with your new laptop whose hardware was not supported by the contemporary distros, its time to switch over to Fedora Core 13

Solved the no sound problem on my dell :)

It was right on Day one that I formatted my new Laptop's hard drive to create partitions on it and install Linux. Well that was in fact a failure because of the ACPI problem. But after I came to know about acpi=off work around I managed to install linux and then the most torturing problem on my system was absence of sound. I nearly spent the whole next week trying to figure out (rather google out) the solution. But it was not there. It was just day before yesterday that I stumbled upon the solution.

The problem was :

There was no sound from the inbuilt speakers, and one of the two jacks worked but produced sound which was barely audible. I lingered over forums for a very long time - meanwhile switched and tried different distros .. hoping one of them might come with a solution by default.

Attempts made by me to solve it:

Most of the times when I looked into search results that said "solved", what I found was "the audio channel was muted". I also found posts that asked me to modify the modprobe.conf and add dell-m6 after intel-hda-snd etc. but none of them worked ... in fact I found a complete list of such options that could be appended on to the modprobe.conf file and tried every one of them that was related to dell.

Recently After installing Arch Linux I came across OSS - Open Sound System and installed it instead of ALSA.. it seemed to work but I couldn't figure out how to mute the speakers while using head phones. I was determined to look for the solution in the same direction.

Solution:

The way to get it to work is to install the new version of alsa ( god why couldn't I think of it .. argh). For obtaining it follow the ***link*** to realtek's site. This is the genius post which brought me closer to the solution. And this is where I was spoon fed with it.

I am loving it :)