Thursday, December 20, 2012

3 TB HDD + Raid 5 + LVM

So i got my new HP Microserver N40L :) and 3x HDDs WD30EFRX.

If you ask your self how to setup a mdadm raid 5 and LVM here is a quick Howto...

My Setup:
1x 4BG USB Stick for the OS Centos 6.3 64 bit.
1x HDD 160GB for temporary HDD work. so i don't have to start the idle raid every time...
3x 3TB HDDs for Raid 5.


Here are the commands i used for the partitioning + Raid 5 + LVM Setup.

Note 1: Do not use "fdisk" if i remember right it does not work with partitions larger then 2TB...

Note 2: Check your system and replace the below commands with your setup... (sdx, sdy).

Note 3: repeat Partitioning steps 2 - 7 for all your Raid Members.

Partitioning:
  1. yum install parted
  2. parted /dev/sda   (see note 2)
  3. (parted) mklabel gpt
  4. (parted) unit TB
  5. (parted) mkpart primary 0.00TB 3.00TB
  6. (parted) print
  7. (parted) quit

Raid Setup:
  1. yum install mdadm
  2. mdadm --create /dev/md0 --level=raid5 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1
  3. cat /proc/mdstat (you will see that 1 drive is rebuilding. thats normal...)
LVM:
  1. yum install lvm2.x86_64
  2. pvcreate /dev/md0
  3. vgcreate vgdata1 /dev/md0
  4. lvcreate --name lvdata1 -l 100%FREE vgdata1
  5. mkfs.ex4 /dev/vgdata1/lvdata1

Linux Performance Tools To Troubleshoot Problems.

Find your bottlenecks.

What tools or commands are recommended to troubleshoot performance related problems?
Sometimes you need to check HW bottlenecks. the easiest is to use "top" and "iostat" or "dstat"
If you have the time to Setup a "Munin" Server. This is perfect. It will help you analyze Performance and also bottlenecks with nice to view graphs.

basic or essential tools that every Linux or UNIX System Admin should be aware of:


Command Line Tools
top
htop
sar
dstat
vmstat
iostat
free




Web Tools
Munin http://munin-monitoring.org/
Cacti http://www.cacti.net/


Here are some examples

Top - Command
top provides a real time view of a running system.















Sar - Command

sar Collect, report, or save system activity information. It can generate report and email them to sys admin.
CPU and Queue
Disk I/O
Swap and Memory
CPU interrupts, Networking and more...














Iostat - Command
iostat Device Utilization Report and more...














Wednesday, December 19, 2012

Hard Drives and Smart.

Some Time ago i found a very interesting article from google about HDD's.
I was very surprised from some of the information i found in that document.

for example:

How smart is SMART?
Not very, as Google found, and many in the industry already knew. SMART (Self-Monitoring, Analysis, and Reporting Technology) captures drive error data to predict failure far enough in advance so you can back up. Yet SMART focuses on mechanical failures, while a good deal of a disk drive is electronic, so SMART misses many sudden drive failure modes, like power component failure. The Google team found that 36% of the failed drives did not exhibit a single SMART-monitored failure. They concluded that SMART data is almost useless for predicting the failure of a single drive.
So while your disk drive might crash without warning at any time, they did find that there are four SMART parameters where errors are strongly correlated with drive failure:
  • scan errors
  • reallocation count
  • offline reallocation
  • probational count
For example, after the first scan error, they found a drive was 39 times more likely to fail in the next 60 days than normal drives. The other three correlations are less striking, but still significant.
The bottom line: SMART can warn you about some problems, but miss others, so you can’t rely on it. So don’t. Back up regularly, and if you do get one of these errors, get a new drive.


 If you would like to read your S.M.A.R.T Infos just install "smartmontools".
"yum install smartmontools"

# smartctl -a /dev/sda
...
...
...


Will give you the information.


google HDD Study: Google HDD Research

Is hyper-threading enabled on a Linux system

Is hyper-threading enabled on a Linux system ?

When you need to know whether hyper-threading is enabled without the luxury to reboot the system,
you can simply look at the output of /proc/cpuinfo and compare the siblings with the cpu cores fields.

The most common answer was to check the values of 'cpu cores' and 'siblings' in /proc/cpuinfo.
When Hyper-Threading is enabled, those values should be different for each logical processor:


# egrep 'siblings|cpu cores' /proc/cpuinfo | head -2

siblings : 12
cpu cores : 6



As you can see on my test System HT is enabled.