Wednesday, January 2, 2013

Lvextend to the rescue. - Increasing the size of Root partition in Linux Filesystems.

I'm a linux newbie. I've been playing with it for about a year and a half now and I still see myself a novice user. Probably because I'm not a proper computer science student or may be I wasn't good enough with linux filesystems. Yeah, these things are such a pain in the ass. I agree. Root, Swap, /Boot, Logical volume, physical volume, ext4, lvm, sda, partition, bla-bla-bla, bla-bla-bla... "Oh my God! Spare me the linux mumbo jumbo. I just wanted to be an average user. I didn't want my linux experience to suck bad! Especially with drives and partitions. Grant me this wish, please..." I begged. "What is it son?", asked the Almighty.
"My linux root partition (the partition represented by "/") is running out of space. What do I do? I'm not good with partition manager or the command lines, for I know nothing." God replied, "Here's how..."
First understand what Logical Volume and a Physical volume is. Physical volume is the physical, abstract partition that exists. It is hard coded. That is how the disk drives and the drive partitions in it exists. Logical partitions doesn't exist as a single entity altogether for you to find and point at. They are made out of groups of physical volumes. I'd rather suggest you to refer to the diagram at the LVM Wikipedia page for more information.
Well, here's the real problem. You have installed your linux operating system in your PC by some means. Either using conventional installer mechanism, like Anaconda in Fedora or RedHat supported OSes or like me, with "Install inside Windows" as in Ubuntu. :P
Whatever it is, let's assume for the sake of this article or for real that you had messed up with the partition sizes and now you notice that the size of your root is annoyingly small. Annoying because of the pop-ups that come up, as and when you start to meddle something in it or when you boot your PC up. Goal is to increase any of the size of root, obviously. But, you want your other files to be intact and your existing Windows-Linux dual boot to be undisturbed or rather to put it precisely, everything to be the same except that you want your root size to be increased. "No way!." would tell the old me. "Bitch please... Get me your computer.", I shall tell now.
I'm taking that the linux OS you run shall work in legacy grub or the old grub, to be clear to all(E.g. Fedora 15, 16). Because, that's where you'd find a /boot partition as against grub2 where you wouldn't find one like that. Not an issue. All that really matters is to identify the root partition and increase the size, which I'm sure you can recognize as to what it is. That is, to find if it is /dev/sda9 or /dev/sda10 or whatever it is. And also, we're considering that the file system of the root partition to be lvm2 pv. (linux volume management).

Now, first step: Shut down your computer and make a bootable device with a linux OS. Preferably Fedora, because that's what I'm going to be using throughout and I guess it'll be easy for you to follow. If not, not a problem. Just make sure you install the packages using command line or through GUI.

Step 2: Boot from bootable device and install "Gparted." GUI partition manager for linux in the Live OS.
su -c 'yum install gparted'
snapshot1
Step 3: Run it as adminstrator, find a suitable drive and create a partition out of it, as unallocated space. The space you take out of the original drive is purely your wish. You may take out 5GB or 10GB and all that is left to you. If you can allocate an entire drive to increase the size of root, then fine. Else, follow this way.
Step 4: Right click the unallocated space and make a partition, preferably the same format as that of the lvm2 pv. (ext3 or ext4) After you format, let's assume the new device formed under sda to be /dev/sda10. Replace the sda10 with whatever you get, like if it is sda5, you take it to be /dev/sda5. Right?
snapshot2
Step 5: You can't simply extend this new volume to the root. That is because Gparted doesn't work with LVMs. You'll have to go the command line way.
Type,
"pvcreate /dev/sda10"
Step 6: Type
vgextent <volumegroupname> /dev/sda10
How do you find your volumegroup name ? Type
vgdisplay
and the VG name in it, specifies the Volume Group Name which in my case was vg_laptop.
So the command would be,
vgextent vg_laptop /dev/sda10
snapshot3
Step 7: Next is to find the number of extents. You can achieve this either using command
vgdisplay -v
as like "vgdisplay -v vg_laptop" where the Free PE value gives the number of extents.
Alternatively, you can use, vgdisplay command, that again displays the Free PE value.
Here, I found my Free PE value to be somewhere around 319. (Don't get confused with the screenshots provided. They have been given just for example purpose and doesn't actually reflect the original values that were executed for implementation.)
Step 8: Type
"lvdisplay"
to find the Logical Volume Path.
Which in this case was found to be: LV Path: /dev/vg_laptop/lv_swap
Step 9: Type
lvextend -l +<number-of-free-extents-found-in-step7> <logical-volume-path>
e.g., lvextend -l +319 /dev/vg_laptop/lv_swap
Step 10:
resize2fs /dev/vg_laptop/lv_swap
Voila ! Your root size has just been increased.
Sources :

http://serverfault.com/questions/297631/extend-volume-group-with-adjacent-unallocated-space
http://www.centos.org/docs/5/html/Cluster_Logical_Volume_Manager/nofreeext.html

Friday, October 19, 2012

My weekend with Mozilla

   It has taken me about two long weeks to sit down and write a blog post. Hey there, I am talking about the Mozilla Mania and Tech Carnival Sastra that we had sometime back. Am I just too busy or not managing time properly? I had already thought about that a million times, before calling my state “Helpless”. Well, enough of oh-sorry-you’re-making-me-sleepy stuff.
Exactly a couple of weeks ago, we had two big events coming in Tamil Nadu. One at Velammal Engineering College, Chennai on 6th October and another one at Sastra University, Tanjore the very next day. Preparations had started about a week before the events. Each day, after I return home from college by evening, I would talk about an hour or two with the organizers, who would call me to ask about arrangements, logistics, food and again the regular “We sure will get goodies in time right?” It gives you so much pleasure and enthusiasm replying to a responsible team, although sometimes can make you a little tired in answering too many questions. :P
The swags had arrived to me just in time. Thanks to Konstantina, for making sure of that. I had to pick up Gauthamraj, my fellow Rep, from the Railway station, on early Saturday morning. Because it was kind of his first time in Chennai. But, I fell asleep and he had to find his way to my home. Sorry Gautham :( And, about the time when we had got dressed up and ready to start to the venue, Deb had landed at the Airport and was picked up already. We had a lot of goods to carry to the venue and the organizers had sent us a car to reach the college premises where we were joined by Karthik Padmanabhan and Naresh Kumar.
The hospitality of VEC was downright awesome! Volunteers had accompanied us wherever we went. The organizers had arranged a pretty good team to help us with the workshop. From students and staff to the Head of Department, everyone seemed too friendly.
Around the time, when we got prepped up and ready to say, “Hey every...”... oops, is there.. uh? Ummm... ?!” “Well, sorry, there is a power problem. We are sorry for the interruption.“ said an organizer. Yeah, power problems are rampant in Tamil Nadu. But, this ?! The irony or beauty of the situation, whatever you call it, is that, the back up had also failed that day. We had to wait for about an hour or so, before we could start the session. Gautham however, had made an intelligent use of the time and kept the crowd engaged with FOSS, Mozilla and Webmaker initiatives.
Soon after, boom! The power was back. For almost about 3 to 4 hours, Deb had given a good session with Firefox Addon making. There was enthusiasm all around. Students rising their hands, asking doubts. We had just enough time to wind up the worshop back at VEC. We were given special shields by the College's Entrepreneurship Development Cell for participation in Mozilla Mania. Call it a little too much ?! I won't say so. After all, its Mozilla !
After the event got over, we had a little over five hours before we started for Tanjore to attend the Tech Carnival 2k12, where we were supposed to conduct similar sessions. Deb, myself and Gautham had come to my home and spent some time here. Soumya had successfully managed to flatter my parents with his so called “obedience and respect towards elders.”. Well, that's all what happened here.
And at around 8 or so, we started to again. Myself, Gautham, Naresh and Soumya, at Egmore station to Tanjore. When everything seemed to go smooth, we suddenly noticed that our names weren't there in the boarding list ! We got all panicked, shocked and finally surprised only to know that our tickets were upgraded. The night's journey was unforgettable. We were talking everything except Mozilla. :P It was like friends on a bachelor party.
By morning, we were picked up again at the Tanjore railway station. People at Sastra were no less than the ones at VEC. Their reception was equally commendable. Only that we had to run two sessions back to back. Although the first one was a little delayed owing to problems, second session went on to be really nice.
I had to miss so much of Mozilla's events owing to several reasons. “Be it bad luck or fate, I am not blaming anyone, but I had ultimately missed the joy” I would often think and worry. But now, I think I've made up for it. Early Saturday morning, I never knew who Gautham even was. Now, he is my best pal. Not to mention Soumya. He has already been a good friend to me. But we bonded really well those two days and especially the Monday morning. I had my project review that day at my college and I didn't bother to bunk it just to spend time with Soumya to give him company. He had about 6 hours to go before he could board his flight. We didn't know where to go. We were tired, strained and stressed. But, that didn't stop us. Out of nowhere came the thought of hitting the beach to watch the sunrise. At first,I thought Soumya is reserved and moody. That was back when I had first met him during March. Not anymore. I never knew, we would open up so much to ourselves. From our retirement plans to my first crush, there was actually so much to talk about. Probably that brought us really close I feel.
This is the best part I guess. Building community and friends. Mozilla is not always about building good goals, motives and exposure. It also about adding values, creating bonds. Those two days of Mozilla was certainly a memorable one.  

Monday, April 23, 2012

Comes a new blog page !

Hi All !

Its been a while since I wrote a blog on my page. The reason its because, I’ve started writing for the 4cast.com – The new technology site in the making. Doesn’t mean, I would stop blogging here from now.

4Cast shall also host my blog entries.

Follow me @4cast here : http://www.the4cast.com/author/dwarak/

Follow 4Cast : http://twitter.com/#!/We4Cast

Monday, March 26, 2012

Creating Add-on, Hands-on the fun way ! at Chennai Workshop

What makes Firefox the best browser ? Open Source ? nah ! HTML 5 ? No… you gotta be better than that. Look, I’m an average user just wanting to have the best browsing experience. I don’t really care if you got HTML 5 or 4 or 6 in it.  Well, Its not just me. Its about how Firefox has maintained a significant user base. Obviously, it all comes down to the greatest collection of Addons that the browser has got !

We’ve all enjoyed using addons with Firefox. It’s even more fun to develop one right ? We just wanted to share it to a greater crowd there and thus happened the Add On Development Workshop at Madras Institute of Technology, Chennai on 25th March 2012.

The speaker for the event was Soumya Deb a.k.a Debloper. He got along really well with the audience and was very interactive. Assisting him were Dwaraka – (myself), Harvish and Naresh.

We had the session split up into 2 parts, covering, the need to have Addons- an introduction, setting the developer environment in 1st part and developing addons using online builder in the 2nd part.

All the participants had developed a sample add-on that provided a right click menu option to see all the ‘About:<--->’ pages using a simple javascript code.

Internet connection was slow but, we were able to manage though. Thanks to the MIT hospitality team ! You were amazing :) On the whole, the session was very productive and enjoyable !

Click to view the Slides and Notes of the Workshop.

Sunday, February 5, 2012

Phonetic Typing…? Yes, you can do that in Linux !

Typing always makes us shit crazy ! English typing is a you-have-to-do-it situation. But, most of them using Internet, are non-Englsh speakers. How about typing in that language ? Not many would’ve learnt typing in that language keyboard layout. Phonetic typing might be an answer. But, do we have the right stuff to get it working ?

Yes, we got tools for that. Consider using Google Transliteration. It works, yes. But, native support for Phonetic typing is always preferable, if you want it to work in a cross-application platform scenario – not just the web. Unfortunately, Google has released its Input Method Editor (IME as how it is shortened) only for Mac and Windows operating systems. Poor old, Linux is left back :(

We’ll now see a workaround to this. iBus (Intelligent Input Bus) to the rescue. Let’s see how to get it working in Linux, in our case a Fedora 16 x64 operating sytem.

Steps

 

  1. You first need to install the iBus tools. Do it command line, by typing,

         su –c ‘yum install ibus’

  2.  Once, the install is complete, you may run it by executing,

         ibus-daemon from the run dialog window (Alt+F2)

  3.  You’ll now see a ‘keyboard icon’ getting displayed in your window

4. Right click the window, click preferences and choose the language you want;

5. Always choose a phonetic language;

6. Now, you’ll see an option to choose between the Input Methods as below.

7. Voila ! You’re typing your language ! (Tamil language screenshot has been given below)

Wednesday, December 14, 2011

The Dual Power Phone Adapter… Finally ;)

Everything has a story behind it. Do you agree ? Once again, I’m going to stick to the same old style of why and how the Dual Power Phone Adapter came into being.

Okay. Down South in Chennai is where I live. We have the worst power shortages here. Nobody knows when the power may go and come back. Real Worse. So, one problem that usually irritates me is when I talk over my cordless phone and power goes down all of a sudden. Line gets lost. Well, after all it’s just 9 volt DC supply that’s powering the base station from the adapter. Why not, use it with a battery cum AC voltage ? So, you know, we could have it set it up like, whenever the power goes, we can use the battery for alternate supply. Cool, right ? I soon decided to make one.

Okay, that was the story behind and now we go on to the schematics of the circuit.

 

Circuit

Essentially, you’ll need

  • A 230v, 5A AC supply –> 9v DC supply transformer
  • 4 nos. of 1N4001 Diodes or something similar
  • Electromagnetic Relay – Something like RSM822 (Data sheet here : http://www.ges.cz/sheets/r/rsm822.pdf )
  • A 9v DC Battery
  • Connecting Wires
  • Phone Adapter Pins

 

In India, the standard power supply is 230v, 5A. Choose the transformer appropriate for you to step down the input voltage to 9v or required power supply that your phone needs. Check with the product manual.

 

  1. First step, its obvious. You’ll need to step down, your input power to 9v DC supply.
  2. So, connect, your input to transformer and output secondary winding to a bridge rectifier. So okay. Bridge rectifier is one with which you make your input AC into a DC voltage. Essentially DC voltage is a single polarity voltage. It doesn’t have a positive and negative voltage concept at all. So, we’re going to clip the negative side of the AC voltage to get a single polarity. But, that alone is just not enough. It is still a pulse. –> pulsed voltage. To make it tend to much more DC characteristic, we may use a capacitor. Although, we didn’t use capacitor in the circuit given, you may use it for best results as in a full wave rectifier.
  3. To switch back and forth between the AC and DC supplies, we’re going to use a Relay coil. It is basically a 2-input, 1-output switch, controlled by electromagnetic coil. Whenever the coil gets powered, output from 1 terminal and when the power goes down, output comes from another terminal. We’re going to power the coil in switch with the rectified power from Bridge rectifier and use it send AC input to phone. Whenever, there isn’t AC supply, DC shall take over.
  4. Find more about Relays here : http://www.kpsec.freeuk.com/components/relay.htm
  5. Connect the negatives of both the AC and DC together and use the Relay switch to control the adapter.
  6. Use appropriate adapter pins to connect the supply to your phone.
  7. This might not be the ‘perfect’ solution to the problem. But, suffices, one may say.

 

Find my adapter here :

 


Find more @ Dwarak'sBlog.

Below is the Cadsoft Eagle Schematic. Free to share and edit Smile

http://ubuntuone.com/4kS5MKZGSQJlQPbQe2m2wv

Thursday, December 8, 2011

Kanaku – The Simple Calculator for Windows Phone 7

For sometime now, I’ve been intrigued on developing apps for Mobile devices and platforms. Sure enough, most of the devices right now, run either Android or iOS. Windows Phone 7 platform is slowly gaining momentum, with big break coming from Nokia’s Deal with Microsoft to produce Win 7 phones from now on.

The following is a simple calculator with text boxes and buttons that runs on Win 7 Phone Platform. Designed exclusively for those running v7.1 and above and supports Metro UI.

Source Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace calculator
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            int x = Convert.ToInt32(tb1.Text);
            int y = Convert.ToInt32(tb2.Text);
            int z = x + y;
            tb3.Text = Convert.ToString(z);
        }
       
        private void button2_Click(object sender, RoutedEventArgs e)
        {
             int x = Convert.ToInt32(tb1.Text);
            int y = Convert.ToInt32(tb2.Text);
            int z = x - y;
            tb3.Text = Convert.ToString(z);
        }

        private void button3_Click(object sender, RoutedEventArgs e)
        {
             int x = Convert.ToInt32(tb1.Text);
            int y = Convert.ToInt32(tb2.Text);
            int z = x * y;
            tb3.Text = Convert.ToString(z);
        }

        private void button4_Click(object sender, RoutedEventArgs e)
        {
            int x = Convert.ToInt32(tb1.Text);
            int y = Convert.ToInt32(tb2.Text);
            int z = x / y;
            tb3.Text = Convert.ToString(z);
        }
    }

}

Download

The project is hosted at codeplex.com and can be found at http://kanaku.codeplex.com.