Bharat Banate's Work Profile

View Bharat Banate's profile on LinkedIn

Saturday, July 26, 2008

What is Raid Level and LVM in Linux...

What is RAID and LVM

RAID is usually defined as Redundant Array of Inexpensive disks. It is normally used to spread data among several physical hard drives with enough redundancy that should any drive fail the data will still be intact. Once created a RAID array appears to be one device which can be used pretty much like a regular partition. There are several kinds of RAID but I will only refer to the two most common here.

The first is RAID-1 which is also known as mirroring. With RAID-1 it's basically done with two essentially identical drives, each with a complete set of data. The second, the one I will mostly refer to in this guide is RAID-5 which is set up using three or more drives with the data spread in a way that any one drive failing will not result in data loss. The Red Hat website has a great overview of the RAID Levels.

There is one limitation with Linux Software RAID that a /boot partition can only reside on a RAID-1 array.

Linux supports both several hardware RAID devices but also software RAID which allows you to use any IDE or SCSI drives as the physical devices. In all cases I'll refer to software RAID.

LVM stands for Logical Volume Manager and is a way of grouping drives and/or partition in a way where instead of dealing with hard and fast physical partitions the data is managed in a virtual basis where the virtual partitions can be resized. The Red Hat website has a great overview of the Logical Volume Manager.

There is one limitation that a LVM cannot be used for the /boot.

Thursday, June 19, 2008

C++: void pointers

The keyword 'void' can be used to define a pointer to a generic term. In C++, special care has to be taken to handle the assignment of void pointers to other pointer types. Following code shows the same:

void *p;
char *s;
p = s;
s = p;

Here, the second assignment would flag an error indicating a type mismatch. While you can assign a pointer of any type to a void pointer, the reverse is not true unless you specifically typecast it as shown below:

s = (char*) p;


C++: Anonymous unions and enums

An anonymous union does not have a union name (tag) and its elements can be accessed directly without using a union variable.
For example,

union {
int i;
char ch[2];
};

Both i and array ch[] share the same memory locations and can be accessed directly simply by saying

i = 10;
ch[0] = 'A';

Simply omitting the union name in declaration does not make the anonymous union. For an union to qualify as an anonymous union, the declaration must not declare a variable of the union type.

Similarly, we can build anonymous enums as shown below:

enum {first, second, third};
int position = second;

The stream I/O classes define several anonymous enumerated types.

Monday, May 19, 2008

Do you know?

If you want to find out which interrupt caused your application to terminate, use following formula to find this out.
Interrupt Number = Return Code - 128
where,
Return Code is value returned by your application on exit.

Cheers!

Wednesday, April 2, 2008

Send an Email to Undisclosed Recipients from Gmail

Whenever you want to send mail to a mass of people, you generally include all the email IDs in the TO: field of your email client. So, when a recipient receives this mail, he/she can see who all are the other recipients. But what if you do not wish to disclose recipients email addresses? Here is a trick to keep recipients' addresses undisclosed. I have used Gmail to test this trick, but it works with all other email clients.
 
To address a message in Gmail so that it goes to "undisclosed recipients" but arrives in all the real recipient's inboxes:
1. Click Compose Mail to start a new message.
2. Type your own email address  OR "Undisclosed Recipients <your email address>" (without double-quotes) in the To: field. 
3. Click Add Bcc.
4. Type the email addresses of all the intended recipients in the Bcc: field. Make sure you separate addresses by comma. If you write to same group of recipients frequently, you can make a mailing list.
5. Now type the subject and message, and finally click Send button.
 
That's all !!