Thursday, October 21, 2010

If your Nightmare came true and you Terminated that instance Accidentaly !

If you are wondering what inspired me to write on this topic then you've guessed it right:-)..Well I have been there and done that ..lol.Now imagine you have an instance that is made by one of the Big B's of tech firms and it so happens that the instance simply refused to be bundled(Some cost factor involved here so they wanted to play safe I guess).Now here comes the real thing you have managed to configure the instance and are prepared to showcase this to a client and hence you have no option but to keep it running, But Wait! Hey if you cant bundle then how do you make sure that on the D day things will be just perfect and Mr Murphy's Laws will not come true.
So here is the plan you call your entire team on a weekend and start the recreation of a duplicate instance so that there are two parallel instances up and running and even if one fails the other is there to support.The team comes starts the process of recreation and suddenly the nightmare comes true ..Holy Cow The Main instance has been terminated ....Now what ? .. Watch this space.Coming Soon ....

Wednesday, August 18, 2010

Every Wondered How to launch a linux Instance automatically ?

I don't know about you, But whenever we need to launch an Instance the only option I could see is to login to the AWS console and select the AMI and then follow the usually process .Now the following command can come to your rescue .

ec2-run-instances AMI [-n INSTANCE_COUNT] [-g GROUP [-g GROUP ...]] [-k KEY] [-d USER_DATA | -f FILE_NAME]

Now if you observe the only important option that is not present is the Launch zone
viz. US-EAST..etc .Hence this is what you can do use "-Z" option as follows

$ec2-run-instances ami-xxxxxxxx -z us-east-1a

The above command will allow you to specify the launch zone so that you can safely attach the storage once its up.Amazon are you Listening why haven't you mentioned this on your website ."http://docs.amazonwebservices.com/AmazonEC2/dg/2006-10-01/CLTRG-run-instances.html"

Tuesday, August 17, 2010

So What Is Cloud Computing Exactly ?

The Wikipedia says "Cloud computing is a Internet-based computing, whereby shared resources, software, and information are provided to computers and other devices on demand, like the electricity grid" .But this is all about the technical jargon in a lay mans word what I would say is that cloud computing is what a Taxi is to an Automobile its basically A Pay As You go kind of a model in which an Individual,SME,Corporates hire or lend Computing services .So lets assume you have a website which has a regular number of hits but on certain occasions you see that the Hits are almost double of what you had expected, In that case the only option left traditionally is to Purchase a new Machine and configure the same Web server or have virtualisation implemented.But these technologies come at a cost which you may have to invest for a short period of time(In this case for the days in which you see above average Hits ).So here is where cloud computing comes to your rescue.So in case your server was on the cloud all you have to do is add a couple of servers which are a replication of the original one and use them untill you require them and once done you can Bundle the server or simply terminate .Even the scaling can be automated .In coming days I shall update the various types of Clouds that are picking up in the Tech World

Friday, August 13, 2010

Bundling errors in Linux Instances On AWS?

I have come across the following error while bundling since quiet some time now so though of posting the problem with the solution

1048576 bytes (1.0 MB) copied, 0.001952 seconds, 537 MB/s
mke2fs 1.39 (29-May-2006)
mount: could not find any free loop device
ERROR: execution failed: "mount -o loop /mnt/latin-bpo-dev-database-image2010-08-13 /mnt/img-mnt"
Copying / into the image file /mnt/latin-bpo-dev-database-image2010-08-13...

The reason this happens is cause the loopback device that is used while bundling has a maximum limit of 8 and in case the previous
onces havent been cleaninly unmounted and hence the kernel simply refuses to allow a new mount which is done during the bundling process

The Solution to the problem is as follows

[root@:~] losetup -a
[root@:~] losetup -d /dev/loop7
[root@:~] losetup -d /dev/loop6


Once done with this try Bundling the instances

Thursday, August 12, 2010

Well Times Change and so did I :-)

Hello Geeks,
Well its been long since I am back with Blogging and I guess will keep up to this habit.In the coming days I shall Blog More of Cloud Computing and Mobile Computing .I shall try to keep you guys abreast of the latest Tech surrounding these topics .Off-course that goes without saying Linux is still gonna be around so Happy Reading and do let me know your comments ..
Thanks
Jiten

Friday, December 28, 2007

Every wondered how an unpriveledged user could read /etc/group,/etc/shadow files ??

Well I am sure all u Linux Newbies have a question in mind if we are not privileged enough to read the restricted /etc/group, /etc/shadow etc .. file and a situation comes wherein we need to read or edit them then how do we go about it ? Well i have an answer to this in Linux we have a command called vipw,vigr which are there to help you I wont go much in detail's here and would recommend to read the man page of the same

Friday, March 16, 2007

Setting Up LVM(Logical Volume Manager) Using The Command Line Tools.

This is very useful to automate the setup, e.g. when you have lots of LV(Logical Volumes) to be created. We simply follow the three basic steps:

Step 1 (PVs): pvcreate /dev/device [/dev/device] ...
The command initializes (a) physical device(s) as (a) physical volume(s) (PV). Partitions must have the partition ID 8E (use fdisk, cfdisk or yast for partitioning), (whole) disks must have no partition table(Though you can create Physical Extents even if you have some raw space on your harddrive). To see all physical devices that are available, use the command lvmdiskscan. The command pvscan shows all existing PVs. If a disk (the whole disk, e.g. /dev/sdc) cannot be used and pvcreate complain about it having a partition table, after making sure you really want to use this disk for LVM and do not have anything else on it you can erase the partition table with dd if=/dev/zero if=/dev/device−name bs=1k count=1(followed by blockdev −−rereadpt to tell the kernel to re−read the p.table).

Step 2 (VGs): vgcreate vg−name /dev/device [/dev/device] ...
The vgcreate command creates a volume group with all the physical volumes specified. The default extent size is 4 MB. The limit for the number of physical extents/logical extents on a PV/LV is 65534 due to kernel limits. Therefore, the default size of 4MB limits the max. size of any PV or LV to 4M*65534~255GB.Should you have larger PVs or require bigger LVs you can increase the extent size. A PE is also the smallest unit by which you can increase, decrease or address (e.g. to move PEs to other PVs) storage in LVM.

Step 3 (LVs): lvcreate −L size[K|M|G|T] −n lv−name vg−name
The lvcreate command creates a logical volume on the volume group vg−name. If no name is given for the LV the default name lvol# is used, where # is the internal number of the LV. The LV can be created as striped (RAID0) over several or all available PVs using the −i # parameter, where # specifies the number of stripes. Normally LVs use up any space available on the PVs on a next−free basis, i.e. if you do the creation of LVs one by one you essentially get concatenation, until you start shrinking, growing, deleting and so on,when space gets freed and reallocated anywhere on the PVs.This is all. From now on you can use the LVs by referring to them via /dev/vg−name/lv−name. Use them like you would use any partition.

Automatic server setup from stored LVM setup.
The LVM of the server can be reset using lvmchange. This is a last resort if something goes wrong. It does not change the LVM setup stored on the physical devices, only the data in the running system is reset.To restore an LVM setup from the one stored on disk, run first vgscan to find all VGs and then vgchange −a y to activate them. This is what happens at each boot time, see init file /etc/init.d/boot (look for vcgscan). You can completely delete the local LVM setup information with rm −rf /etc/lvm*, including all device files for accessing the LVs (/dev/vg−name/lv−name), and it will automatically be recreated next time you boot or issue the vgscan command manually. This means that you do not have to do anything after a reboot to be able to use your LVs again, the runtime LVM setup happens automatically during a system boot, if any LVM setup is detected on any of the attached physical devices.