Sunday, August 25, 2013

All about Raid 5

Good day guys.

I had some recent trouble with my office server, so I decided to write about the Raid version we were using.

What is Raid?

I know everyone says its Random Array of Independent Disks / Inexpensive Disks. (Inexpensive is really not that true, but you know, compared to the data they save, the disk could be inexpensive).

OK. Let me explain what it is. RAID is a mechanism in which your data will be split amongst several disks so that there are redundant (duplicate) copies of the data. With redundant copies, the system becomes fault tolerant. Remember, I am not giving you the real techie stuff. I'm writing this for people without the IT background to understand.

Raid has several levels that starts from 0 to 10 (so far). Different levels means different ways in which the data is divided and stored into the disks.

So I will be speaking about RAID 5 here. RAID 5 is a RAID level which requires 3 Hard Disks Minimum and maximum of 8.



In layman terms, RAID 5 handles 3 disks at minimum and blocks of data are split into the three disks. First of all, Raid will take these thrree or more disks and combine it as one logical unit. When you are installing the OS, you will notice that there is only one disk consisting of the total space of two disks, the third disk is not added. This is because the third disk is considered redundant and does not add up to the total space.

So if you use three 120gb hard drives, you will have 240gb of actual usable space. If you use five 120gb hard drives, you would have 480gb of usable space. The more drives you use, the more efficient your storage space becomes without losing any redundancy.

RAID 5 offers accelerated read performance because the data stream is accessed from multiple drives at the same time. Referring to figure 1, let's say that stripe A was a single file. Normally on a single drive when you open that file, the whole thing would be streamed from the one hard drive bit by bit - thus the one hard drive's max read speed is going to become a bottleneck. BUT, with a RAID-5, that one file can be accessed in 1/3 of the time because it will be read from all 3 drives at once; block 1 has the first 1/3 of the file, block 2 has the second 1/3 section of the file, and the block 3 has the last part of the file. This, in a perfect situation, causes your read speed to be tripled - with even more performance potential in RAID-5 arrays containing additional hard drives!

Rebuilding the Drive


For easier understanding/explaining, we are only going to be working with 4-bit blocks. Actual data blocks can range from 4kb (32,768 bits) up to 256kb (2,097,152 bits), but the method is exactly the same regardless of how many consecutive bits you work with. In figure 3, the yellow blocks represent the parities for each stripe. As you may notice, the parities are distributed evenly between all drives. This provides a slight increase in performance and is what separates RAID-4 from RAID-5 (RAID 4 keeps all parities on a single drive).
Lets examine the first stripe of figure 3. To compute the parity, we must run the XOR comparison on each block of data in that stripe. You XOR the first two blocks, then take the result and XOR it against the third block (and continue this for all drives in the array - except for the block where the parity will be stored).

(Drive 1) XOR (Drive 2) = (0100) XOR (0101) = (0001)
(Result) XOR (Drive 3) = (0001) XOR (0010) = (0011)

Recovering Data
The very cool thing about XOR comparisons - and what makes RAID 5 possible - is that if one value comes up missing, you can always find the missing value by doing an XOR comparison on the remaining values! Referring back to figure 3, let's say that drive 1 fails. The user will be prompted by the raid controller and alerted that a drive has failed and must be replaced. As soon as a new drive is put in, the controller will automatically start rebuilding the lost data. Here is how we rebuild drive 1, stripe 1

(Drive 2) XOR (Drive 3) = (0101) XOR (0010) = (0111)
(Result) XOR (Drive 4) = (0111) XOR (0011) = (0100)

As you can see, the final result is 0100. Now refer back to figure 3 at drive 1, stripe 1.... sure enough, its 0100! Amazingly, right? Just for fun, let's rebuild stripe 2 as well with the assumption that it is drive 1 that has failed.

(Drive 2) XOR (Drive 3) = (0000) XOR (0110) = (0110)
(Result) XOR (Drive 4) = (0110) XOR (0100) = (0010)

The missing block was calculated as 0010. Take a look at figure 3 to verify what drive 1, stripe 2 was before the failure and see if it matches the computed value... of course it does!

Thursday, August 1, 2013

How to Move or Copy Mail from One Gmail Account to Another (Using Only Gmail)

Move or Copy Mail from One Gmail Account to Another (Using Only Gmail)

To move (or, of course, merely copy) all received and sent emails from one Gmail account to another Gmail account by having the new account fetch the messages:
  • Make sure all email programs or services you have configured to download mail from your old Gmail account using POP are closed or set not to check mail automatically.
  • Log in to the account from which you want to import.
  • Click the Settings gear in your Gmail's toolbar.
  • Select Settings from the menu that comes up.
  • Go to the Forwarding and POP/IMAP tab.
  • Make sure Enable POP for all mail (even mail that's already been downloaded) is selected underPOP Download: irrespective of the current status under Status:.
    • You do not have to move messages to the old account's inbox for the new account to pick them up. Archived mail will be fetched.
  • You can select archive Gmail's copy under When messages are accessed with POP to have your old account's inbox cleared or delete Gmail's copy to move mail instead of copying it; you can also choose keep Gmail's copy in the Inbox (unread) or mark Gmail's copy as read, of course.
  • Click Save Changes.
  • Click your picture (or the icon) in Gmail's top right corner.
  • Select Sign out from the menu that appears.
  • Log in to the Gmail account to which you want to move the messages.
  • Click the Settings gear.
  • Select Settings from the menu that shows up.
  • Go to the Accounts and Import tab.
  • Click Add a POP3 mail account you own under Check mail from other accounts (using POP3):.
  • Enter the email address of the Gmail account from which you want to import under Email address:.
  • Click Next Step ».
  • Verify the desired Gmail account's user name is entered under Username:.
  • Type the Gmail account's password under Password:.
  • Make sure pop.gmail.com is selected under POP Server:.
  • Make sure 995 is selected under Port:.
  • Now make sure Leave a copy of retrieved messages on the server. is not checked.
  • Verify Always use a secure connection (SSL) when retrieving mail. is checked.
  • Optionally, check Label incoming messages: and pick the label corresponding to the old Gmail account's email address, an existing label or New label… for a new label.
  • Optionally, check Archive incoming messages (Skip the Inbox) so imported emails do not show up (or clutter) your new Gmail account's inbox.
  • Click Add Account ».
  • Typically, select Yes, I want to be able to send mail as ___@gmail.com. under Would you also like to be able to send mail as ___@gmail.com?.
    • Having your old address set up as a sending address in the new account lets Gmail recognize your old sent messages and place them in the Sent Mail label.
    • You can choose No, of course; you can always add your old address as a sending address later.
      If you select No for Would you also like to be able to send mail as ___@gmail.com?, clickFinish and skip the upcoming steps.
  • Click Next Step ».
  • Enter your name under Name:.
  • Click Next Step ».
  • Leave Treat as an alias. checked.
  • Click Next Step ».
  • Now click Send Verification.
  • Click Close window.
  • Click your icon in the top right corner of Gmail.
  • Select Sign out from the sheet that comes up.
  • Log in to Gmail using the address from which you import.
  • Open the message from Gmail Team with the subject Gmail Confirmation - Send Mail as ___@gmail.com.
  • Highlight and copy the numeral confirmation code under Confirmation code:.
    • Do not follow the verification link.
  • Again, click your account's icon in the top right corner.
  • Select Sign out.
  • Log in to Gmail again, this time with the account to which you import.
  • Click the Settings gear.
  • Select Settings from the menu that comes up.
  • Open the Accounts and Import tab.
  • Click Verify for the old Gmail account's address under Send mail as:.
  • Paste the verification code under Enter and verify the confirmation code.
  • Click Verify.
    • As an alternative to this somewhat convoluted process, you can try waiting for Gmail to import the verification message and follow the confirmation link right from inside the new Gmail account.
Gmail will not fetch all messages in one go. It will download mail from the old account in batches of approximately 100–200 emails at a time instead. Typically, importing will start with the oldest mail.
Gmail will download messages in your old Gmail account's Sent Mail label in addition to messages you have received. If you have set up the address from which you imported as a sending address in the new account, sent mail will appear under the new account's Sent Maillabel, too. <

Stop Continued Importing of Mail from the Source Gmail Account (and Prevent Duplicates)

To stop Gmail from continuing to import new messages from the old account (or import everything anew if you ever reset the POP access status for the old account to offering all messages):
  • Click the Settings gear in the new Gmail account.
  • Choose Settings from the menu that comes up.
  • Go to the Accounts and Import category.
  • Click delete for the Gmail account from which you imported under Check mail from other accounts (using POP3).
  • Click OK under Are you sure you want to delete this mail account?.
Unlock Gmail for a New Email Program or Service
To allow a new email program that Gmail has blocked as suspicious access to your account:
  • Have the email program or service that has failed to access your Gmail account ready.
  • Visit the Allow a new application to access your account page at Google.
    • Log in to the desired Gmail account if prompted.
  • Click Continue.
  • Within 10 minutes, have the previously blocked email service or program check for new messages.