UnixServerAdmin

Server Administration & Management

zombie_process.sh

###########################################################
## zombie_process.sh ##
###########################################################
#!/bin/bash
x=0;
for x in `ps -ef | grep defunct | awk ‘{print $3}’` ; do
echo $x
kill -9 $x
done

November 20, 2013 Posted by | Security, Shell Script, Tips & Tricks, Unix/Linux | , , , , , | Leave a comment

How to Extend or increase size of LVM partitions in RHEL/CentOS

# /usr/sbin/lvextend -L+50G  /dev/mapper/VolGroup00-LogVol04

  Extending logical volume LogVol04 to 149.75 GB
  Logical volume LogVol04 successfully resized

# /usr/sbin/vgdisplay

# /sbin/resize2fs /dev/mapper/VolGroup00-LogVol04

resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/VolGroup00-LogVol04 is mounted on /var; on-line resizing required
Performing an on-line resize of /dev/mapper/VolGroup00-LogVol04 to 39256064 (4k) blocks.
The filesystem on /dev/mapper/VolGroup00-LogVol04 is now 39256064 blocks long.

Its Done !!!

November 10, 2013 Posted by | LVM, Tips & Tricks, Unix/Linux | , , , | Leave a comment

How to Shrink or reduce size of LVM partitons in RHEL/CentOS

1. Check disk partitions size

# df -hT

Filesystem    Type Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00 ext3 34G 6.6G 26G 21% /
/dev/mapper/VolGroup00-LogVol03 ext3 34G 29G 27G 52% /usr
/dev/mapper/VolGroup00-LogVol04 ext3 97G 89G 2.7G 98% /var
/dev/sda1 ext3 99M 27M 67M 29% /boot
tmpfs tmpfs 56G 0 56G 0% /dev/shm
/dev/mapper/VolGroup00-LogVol02 ext3 56G 9.1G   65G 13% /backup

2. Unmount the partitions that want to shrink or reduce

# umount /dev/mapper/VolGroup00-LogVol02

3. Check a Linux ext2/ext3/ext4 file system partition.

# /sbin/e2fsck -f /dev/mapper/VolGroup00-LogVol02

e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
/lost+found not found.  Create<y>? yes
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/VolGroup00-LogVol02: ***** FILE SYSTEM WAS MODIFIED *****
/dev/mapper/VolGroup00-LogVol02: 2887/20971520 files (14.9% non-contiguous), 3019764/20971520 blocks

4. Resize the partition to 30 GB

# /sbin/resize2fs -p /dev/mapper/VolGroup00-LogVol02 30G

resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/mapper/VolGroup00-LogVol02 to 7864320 (4k) blocks.
Begin pass 2 (max = 1690914)
Relocating blocks             XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 640)
Scanning inode table          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 4 (max = 201)
Updating inode references     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/mapper/VolGroup00-LogVol02 is now 7864320 blocks long.

5. Reduce the size of a logical volume upto 30 GB

# /usr/sbin/lvreduce -L 30G /dev/mapper/VolGroup00-LogVol02

  WARNING: Reducing active logical volume to 30.00 GB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
  Do you really want to reduce LogVol02? [y/n]: y
  Reducing logical volume LogVol02 to 30.00 GB
  Logical volume LogVol02 successfully resized

6. Recheck  again, Linux ext2/ext3/ext4 file system partition.

# /sbin/e2fsck -f /dev/mapper/VolGroup00-LogVol02

e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/VolGroup00-LogVol02: 2887/7864320 files (14.9% non-contiguous), 2606289/7864320 blocks

7. Resize the partition to 30 GB

# /sbin/resize2fs -p /dev/mapper/VolGroup00-LogVol02

resize2fs 1.39 (29-May-2006)
The filesystem is already 7864320 blocks long.  Nothing to do!

8. Now, Mount the partition.

# mount /dev/mapper/VolGroup00-LogVol02  /backup

9. Again, Check disk partitions size

# df -hT

Filesystem    Type Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00 ext3 34G 6.6G 26G 21% /
/dev/mapper/VolGroup00-LogVol03 ext3 34G 29G 27G 52% /usr
/dev/mapper/VolGroup00-LogVol04 ext3 97G 89G 2.7G 98% /var
/dev/sda1 ext3 99M 27M 67M 29% /boot
tmpfs tmpfs 56G 0 56G 0% /dev/shm
/dev/mapper/VolGroup00-LogVol02 ext3 30G 9.1G   19G 33% /backup

Its Done !!!

October 30, 2013 Posted by | LVM, Tips & Tricks, Unix/Linux | , , , | Leave a comment

Difference between RAID and LVM

 S.No.  RAID  LVM
 1.  RAID is used for redundancy.  LVM is a way in which you partition the hard disk logically and it contains its own advantages.
 2.  A RAID device is a physical grouping of disk devices in order to create a logical presentation of one device to an Operating System for redundancy or performance or a combination of the two.  LVM is a logical layer that that can be anipulated in order to create and, or expand a logical presentation of a disk device to an Operating System.
 3.  RAID is a way to create a redundant or striped block device with redundancy using other physical block devices.  LVM usually sits on top of RAID blocks or even standard block devices to accomplish the same result as a partitioning, however it is much more flexible than partitions. You can create multiple volumes crossing multiple physical devices, remove physical devices without loosing data, resize the volumes, create snapshots, etc
 4.  RAID is either a software or a hardware technique to create data storage redundancy across multiple block devices based on required RAID levels.  LVM is a software tool to manage large pool of storage devices making them appear as a single manageable pool of storage resource. LVM can be used to manage a large pool of what we call Just-a-bunch-of-Disk (JBOD) presenting them as a single logical volume and thereby create various partitions for software RAID.
 5.  RAID is NOT any kind of Data backup solution. Its a solution to prevent one of the SPOFs (Single Point of Failure) i.e. DISK failure. By configuring RAID you are just providing an emergency substitute for the Primary disk. It NEVER means that you have configured DATA backup.  LVM is a disk management approach that allows us to create, extend, reduce, delete or resize the volume groups or logical volumes.

October 20, 2013 Posted by | LVM, RAID, Tips & Tricks, Unix/Linux | , , , | Leave a comment

How to add multiple IP range in RHEL/CentOS

For example, if you want to add the following different ip pool ranges in the server on the Ethernet port eth0. Here are few simple steps to add the ip pool ranges in few minutes.

IP Pool Block: 192.168.10.2-6
IP Pool Block: 192.168.10.10-14
IP Pool Block: 192.168.10.18-22
IP Pool Block: 192.168.10.26-30
IP Pool Block: 192.168.10.130-134

The above example has around 5 ranges with different ip sets. You can make use of the “ifcfg-eth0-rangeX” feature to get this done simply.

1. SSH the server as root Login.

# cd /etc/sysconfig/network-scripts/

2. Create a file named ifcfg-eth0-range0

# vim ifcfg-eth0-range0

Add the following lines as below to add the first set of range (ie..192.168.10.2-6)

ONBOOT=yes
IPADDR_START=192.168.10.2
IPADDR_END=192.168.10.6
NETMASK=255.255.255.248
CLONENUM_START=1

3. Save your works and exit. Restart the network service.

# /etc/init.d/network restart

4. To add the second range you need to create another file called “ifcfg-eth0-range1” with the CLONENUM_START start with 5 (setting up the number in CLONENUM_START is very important here to avoid the ip overwritten, as the first range will use up to the eth0:4 the second range should start with eth0:5 to work properly).

ONBOOT=yes
IPADDR_START=192.168.10.10
IPADDR_END=192.168.10.14
NETMASK=255.255.255.248
CLONENUM_START=5

5. Save your works and restart the network service. You can do the same for the other ip ranges left with carefully numbering the CLONENUM_START. Use the ifconfig command to check the eth0:X number everytime you restarts. After adding all the ranges, use ping to check the ips to make sure they are added properly.

ONBOOT=yes
IPADDR_START=192.168.10.10
IPADDR_END=192.168.10.14
NETMASK=255.255.255.248
CLONENUM_START=10

6. So on …

October 10, 2013 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment

How to check CPU Utilization in Linux

# mpstat -P -ALL  (for Each CPU Utilization)

Linux 2.6.39-400.17.1.el6uek.x86_64 (unixserveradmin.com)  09/10/2013      _x86_64_        (16 CPU)

04:28:05 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
04:28:05 PM  all   80.42    0.00   18.69    0.06    0.00    0.42    0.00    0.00    0.40
04:28:05 PM    0   80.08    0.00   18.79    0.03    0.00    1.01    0.00    0.00    0.09
04:28:05 PM    1   89.24    0.00    9.67    0.36    0.00    0.02    0.00    0.00    0.71
04:28:05 PM    2   63.74    0.00   35.84    0.04    0.00    0.13    0.00    0.00    0.25
04:28:05 PM    3   87.14    0.00   12.11    0.06    0.00    0.00    0.00    0.00    0.68
04:28:05 PM    4   77.02    0.00   22.66    0.01    0.00    0.01    0.00    0.00    0.29
04:28:05 PM    5   88.26    0.00   10.43    0.04    0.00    0.00    0.00    0.00    1.27
04:28:05 PM    6   74.55    0.00   25.16    0.02    0.00    0.01    0.00    0.00    0.27
04:28:05 PM    7   91.69    0.00    7.29    0.02    0.00    0.00    0.00    0.00    0.99
04:28:05 PM    8   88.60    0.00    9.88    0.34    0.00    0.02    0.00    0.00    1.16
04:28:05 PM    9   89.59    0.00    9.89    0.42    0.00    0.02    0.00    0.00    0.09
04:28:05 PM   10   86.76    0.00   12.68    0.06    0.00    0.01    0.00    0.00    0.49
04:28:05 PM   11   87.48    0.00   12.06    0.06    0.00    0.00    0.00    0.00    0.40
04:28:05 PM   12   87.02    0.00   11.62    0.02    0.00    0.01    0.00    0.00    1.33
04:28:05 PM   13   87.14    0.00   10.64    0.03    0.00    0.00    0.00    0.00    2.18
04:28:05 PM   14   91.33    0.00    7.60    0.02    0.00    0.02    0.00    0.00    1.03
04:28:05 PM   15   91.52    0.00    7.85    0.02    0.00    0.00    0.00    0.00    0.60

# mpstat (for ALL CPU)

Linux 2.6.39-400.17.1.el6uek.x86_64 (unixserveradmin.com)  09/10/2013      _x86_64_        (16 CPU)

04:29:25 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
04:29:25 PM  all   80.45    0.00   18.70    0.06    0.00    0.42    0.00    0.00    0.37# sar (Today CPU Utilization)

# sar

Linux 2.6.39-400.17.1.el6uek.x86_64 (unixserveradmin.com)  09/10/2013      _x86_64_        (16 CPU)

12:00:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:10:01 AM     all     17.04      0.00      4.26      0.04      0.00     78.66
12:20:01 AM     all     95.24      0.00     24.05      0.00      0.00      0.00
12:30:01 AM     all     93.87      0.00     23.61      0.00      0.00      0.00
12:40:01 AM     all     16.41      0.00      4.12      0.00      0.00     79.47
12:50:01 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
01:00:01 AM     all     16.53      0.00      4.23      0.00      0.00     79.24
01:10:01 AM     all     97.52      0.00     23.47      1.36      0.00      0.00
01:20:01 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
01:30:01 AM     all      8.93      0.00      2.28      0.00      0.00     88.79
01:40:01 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
01:50:01 AM     all     93.28      0.00     23.37      0.00      0.00      0.00
02:00:02 AM     all     16.65      0.00      4.22      0.00      0.00     79.13
02:10:01 AM     all     16.82      0.00      4.31      0.00      0.00     78.87
02:20:01 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
02:30:01 AM     all     94.29      0.00     24.07      0.00      0.00      0.00
02:40:02 AM     all     92.47      0.00     23.65      0.00      0.00      0.00
02:50:01 AM     all     16.52      0.00      4.18      0.00      0.00     79.30
03:00:01 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
03:10:01 AM     all     16.42      0.00      4.20      0.02      0.00     79.37
03:20:01 AM     all     93.68      0.00     24.09      0.01      0.00      0.00
03:30:01 AM     all     16.35      0.00      4.20      0.00      0.00     79.45
03:40:01 AM     all     95.06      0.00     24.08      0.00      0.00      0.00
03:50:01 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
04:00:01 AM     all      9.07      0.00      2.30      0.00      0.00     88.64
04:10:01 AM     all     94.39      0.00     23.88      0.00      0.00      0.00
04:20:01 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
04:30:01 AM     all     93.10      0.00     23.61      0.00      0.00      0.00
04:40:01 AM     all     16.66      0.00      4.18      0.00      0.00     79.15
04:50:01 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
05:00:01 AM     all     16.73      0.00      4.23      0.00      0.00     79.04
05:10:01 AM     all     93.43      0.00     23.79      0.00      0.00      0.00
05:20:01 AM     all     16.32      0.00      4.13      0.00      0.00     79.55
05:30:02 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
05:40:01 AM     all     95.20      0.00     23.91      0.00      0.00      0.00
05:50:01 AM     all     91.35      0.00     23.30      0.00      0.00      0.00
06:00:01 AM     all     16.62      0.00      4.20      0.00      0.00     79.19
06:10:01 AM     all     93.97      0.00     23.75      0.01      0.00      0.00

06:10:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
06:20:01 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
06:30:01 AM     all     16.31      0.00      4.15      0.00      0.00     79.53
06:40:01 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
06:50:01 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
07:00:01 AM     all     16.40      0.00      4.14      0.00      0.00     79.45
07:10:01 AM     all    159.78      0.00     24.52      0.11      0.00      0.00
07:20:01 AM     all    120.22      0.00     24.24      0.02      0.00      0.00
07:30:01 AM     all     95.56      0.00     24.06      0.00      0.00      0.00
07:40:01 AM     all     92.29      0.00     23.28      0.00      0.00      0.00
07:50:01 AM     all      9.14      0.00      2.32      0.00      0.00     88.55
08:00:01 AM     all     94.16      0.00     23.39      0.00      0.00      0.00
08:10:01 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
08:20:01 AM     all     91.82      0.00     23.49      0.00      0.00      0.00
08:30:01 AM     all     93.53      0.00     24.03      0.00      0.00      0.00
08:40:01 AM     all     96.17      0.00     24.13      0.01      0.00      0.00
08:50:01 AM     all     96.25      0.00     24.65      0.00      0.00      0.00
09:00:01 AM     all     16.88      0.00      4.29      0.00      0.00     78.83
09:10:01 AM     all     16.38      0.00      4.22      0.00      0.00     79.41
09:20:01 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
09:30:01 AM     all     94.55      0.00     24.19      0.00      0.00      0.00
09:40:01 AM     all     16.73      0.00      4.26      0.00      0.00     79.00
09:50:01 AM     all     95.08      0.00     24.26      0.00      0.00      0.00
10:00:01 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
10:10:01 AM     all     17.14      0.00      4.35      0.01      0.00     78.51
10:20:01 AM     all     98.10      0.00     24.71      0.01      0.00      0.00
10:30:01 AM     all     17.01      0.00      4.30      0.00      0.00     78.69
10:40:01 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
10:50:01 AM     all     95.97      0.00     24.60      0.01      0.00      0.00
11:00:01 AM     all     94.10      0.00     23.99      0.00      0.00      0.00
11:10:01 AM     all     16.98      0.00      4.37      0.00      0.00     78.66
11:20:01 AM     all      0.00      0.00      0.00      0.00      0.00      0.00
11:30:01 AM     all     17.23      0.00      4.43      0.00      0.00     78.35
11:40:01 AM     all     96.17      0.00     24.56      0.00      0.00      0.00
11:50:01 AM     all     99.37      0.00     25.45      0.00      0.00      0.00
12:00:01 PM     all      0.00      0.00      0.00      0.00      0.00      0.00
12:10:01 PM     all     98.79      0.00     25.22      0.00      0.00      0.00
12:20:01 PM     all     97.01      0.00     24.78      0.00      0.00      0.00

12:20:01 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:30:01 PM     all     97.58      0.00     25.25      0.00      0.00      0.00
12:40:01 PM     all     17.06      0.00      4.39      0.00      0.00     78.55
12:50:01 PM     all      0.00      0.00      0.00      0.00      0.00      0.00
01:00:01 PM     all     17.50      0.00      4.51      0.02      0.00     77.97
01:10:01 PM     all     17.13      0.00      4.41      0.00      0.00     78.46
01:20:01 PM     all      0.00      0.00      0.00      0.00      0.00      0.00
01:30:01 PM     all      0.00      0.00      0.00      0.00      0.00      0.00
01:40:01 PM     all     95.01      0.00     24.27      0.01      0.00      0.00
01:50:01 PM     all     16.98      0.00      4.42      0.03      0.00     78.57
02:00:01 PM     all     16.77      0.00      4.34      0.00      0.00     78.88
02:10:01 PM     all     95.78      0.00     24.94      0.00      0.00      0.00
02:20:01 PM     all      0.00      0.00      0.00      0.00      0.00      0.00
02:30:01 PM     all     95.92      0.00     24.73      0.34      0.00      0.00
02:40:01 PM     all     16.84      0.00      4.42      0.00      0.00     78.74
02:50:01 PM     all      0.00      0.00      0.00      0.00      0.00      0.00
03:00:01 PM     all     96.14      0.00     25.38      0.00      0.00      0.00
03:10:01 PM     all     17.02      0.00      4.42      0.00      0.00     78.56
03:20:01 PM     all     94.97      0.00     25.16      0.00      0.00      0.00
03:30:01 PM     all     95.93      0.00     25.59      0.00      0.00      0.00
03:40:01 PM     all     95.26      0.00     25.50      0.00      0.00      0.00
03:50:01 PM     all      0.00      0.00      0.00      0.00      0.00      0.00
04:00:01 PM     all     17.51      0.00      4.56      0.00      0.00     77.93
04:10:01 PM     all      0.00      0.00      0.00      0.00      0.00      0.00
04:20:01 PM     all     17.12      0.00      4.57      0.00      0.00     78.31
Average:        all     74.54      0.00     18.87      0.02      0.00      6.57

# ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10 (Top 10 CPU users Utilization)

%CPU   PID USER     COMMAND
 3.1  1930 root     /usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t -f root
 2.4 10501 root     /usr/bin/java -Djava.util.logging.config.file=/usr/local/apache-tomcat-cluster_2/conf/logging.properties -Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms1536m -Xmx1536m -XX:NewSize=512m -XX:MaxNewSize=512m -XX:PermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:MaxPermSize=512m -verbose:gc -XX:+PrintClassHistogram -XX:+DisableExplicitGC -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/apache-tomcat-cluster_2/endorsed -classpath /usr/local/apache-tomcat-cluster_2/bin/bootstrap.jar:/usr/local/apache-tomcat-cluster_2/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/apache-tomcat-cluster_2 -Dcatalina.home=/usr/local/apache-tomcat-cluster_2 -Djava.io.tmpdir=/usr/local/apache-tomcat-cluster_2/temp org.apache.catalina.startup.Bootstrap start
 2.4 10382 root     /usr/bin/java -Djava.util.logging.config.file=/usr/local/apache-tomcat-cluster_1/conf/logging.properties -Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms1536m -Xmx1536m -XX:NewSize=512m -XX:MaxNewSize=512m -XX:PermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:MaxPermSize=512m -verbose:gc -XX:+PrintClassHistogram -XX:+DisableExplicitGC -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/apache-tomcat-cluster_1/endorsed -classpath /usr/local/apache-tomcat-cluster_1/bin/bootstrap.jar:/usr/local/apache-tomcat-cluster_1/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/apache-tomcat-cluster_1 -Dcatalina.home=/usr/local/apache-tomcat-cluster_1 -Djava.io.tmpdir=/usr/local/apache-tomcat-cluster_1/temp org.apache.catalina.startup.Bootstrap start
18.4  1899 root     CROND
 1.8  1931 root     /usr/sbin/postdrop -r
 156  1901 root     java -jar /root/JavaApplication12/dist/JavaApplication12.jar
 0.1  1533 apache   /usr/sbin/httpd
 0.1  1464 apache   /usr/sbin/httpd
 0.1  1277 apache   /usr/sbin/httpd

# iostat (CPU statistics & input/output statistics for devices and partitions. It can be use to find out your system’s average CPU utilization since the last reboot.)

Linux 2.6.39-400.17.1.el6uek.x86_64 (unixserveradmin.com)  09/10/2013      _x86_64_        (16 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          80.40    0.00   19.11    0.06    0.00    0.43

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               2.62        18.62       173.16  276808442 2574697924

September 10, 2013 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment

How to check Hard Disk Read-Write Speed in Linux

1. The command writes a 2.1GB file and output the result.

Check write speed:

# dd if=/dev/zero of=test bs=1048576 count=2048

2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB) copied, 6.21583 s, 345 MB/s

2. The command reads the 2.1GB file and outputs the result.

Check read speed:

# dd if=test of=/dev/null bs=1048576

2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB) copied, 0.408619 s, 5.3 GB/s

3. Now delete the test file.

# rm -rvdf test

August 30, 2013 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment

How to remove a Partition Size Larger Than 2TB

Before removing a partition, unmount any partitions on the device and turn off any swap space on the device.

1. Start parted, where /dev/mapper/mpathbp is the device on which to remove the partition :-

# parted /dev/mapper/mpathbp

2. View the current partition table to determine the minor number of the partition to remove :-

(parted) print

3. Remove the partition with the command rm. For example, to remove the partition with minor number 3 :-

(parted) rm 3

4. The changes start taking place as soon as you press Enter, so review the command before committing to it. After removing the partition, use the print command to confirm that it is removed from the partition table. You should also view the output of

# cat /proc/partitions

to make sure the kernel knows the partition is removed. The last step is to remove it from the /etc/fstab file. Find the line that declares the removed partition, and remove it from the file.

July 11, 2013 Posted by | SAN, Tips & Tricks, Unix/Linux | , , , | Leave a comment

How to create a Partition Size Larger Than 2TB

We can’t create a Linux partition larger than 2 TB using the fdisk command. The fdisk won’t create partitions larger than 2 TB. This is fine for desktop and laptop users, but on server you need a large partition. For example, you can’t create 3TB or 4TB partition size (RAID based) using the fdisk command. It will not allow you to create a partition that is greater than 2TB.

To solve this problem use GNU parted command with GPT. It supports Intel EFI/GPT partition tables. Partition Table (GPT) is a standard for the layout of the partition table on a physical hard disk. It is a part of the Extensible Firmware Interface (EFI) standard proposed by Intel as a replacement for the outdated PC BIOS, one of the few remaining relics of the original IBM PC. EFI uses GPT where BIOS uses a Master Boot Record (MBR).

Linux GPT Kernel Support :- EFI GUID Partition support works on both 32bit and 64bit platforms. You must include GPT support in kernel in order to use GPT. If you don’t include GPT support in Linux kernel, after rebooting the server, the file system will no longer be mountable or the GPT table will get corrupted. By default RHEL/ CentOS comes with GPT kernel support. However, if you are using Debian or Ubuntu Linux, you need to recompile the kernel. Set CONFIG_EFI_PARTITION to y to compile this feature.

1. Find Out Current Disk Size, using the following command :-

# fdisk -l /dev/mapper/mpathbp

Sample outputs:
Disk /dev/mapper/mpathp: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

2. Linux Create 3TB partition size, To create a partition start GNU parted as follows :-

# parted /dev/mapper/mpathbp

Output:
GNU Parted 2.3
Using /dev/mapper/mpathbp
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted)

3. Creates a new GPT disklabel i.e. partition table :-

(parted) mklabel gpt

Sample outputs:
Warning: The existing disk label on /dev/mapper/mpathbp will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted)

4. Next, set the default unit to TB, enter:

(parted) unit TB

5. To create a 3TB partition size, enter:

(parted) mkpart primary 0 0

OR

(parted) mkpart primary 0.00TB 3.00TB

6. To print the current partitions, enter:

(parted) print

Sample outputs:
Model: ATA ST33000651AS (scsi)
Disk /dev/mapper/mpathbp: 3.00TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number  Start   End     Size    File system  Name     Flags
 1      0.00TB  3.00TB  3.00TB  ext4         primary

Quit and save the changes, enter:

(parted) quit

Sample outputs:
Information: You may need to update /etc/fstab.

7. Use the mkfs.ext3 or mkfs.ext4 command to format the file system, enter :-

# mkfs.ext4 /dev/mapper/mpathbp1

8. Type the following commands to mount /dev/mapper/mpathbp1, enter :-

# mkdir /datasrv
# mount   /dev/mpathbp1   /datasrv
# df -hT

9. Edit in /etc/fstab file during Booting Process for Mounting.

# vim /etc/fstab

/dev/mapper/mpathbp1    /backup        ext4    defaults    1    0

Note :- Make sure you replace /dev/mapper/mpathbp1 with actual RAID or Disk name or Block Ethernet device such as /dev/etherd/e0.0. Do not forget to update /etc/fstab, if necessary. Also note that booting from a GPT volume requires support in your BIOS / firmware. This is not supported on non-EFI platforms. We suggest you, boot server from another disk such as IDE / SATA / SSD disk and store data on /datasrv.

July 6, 2013 Posted by | SAN, Tips & Tricks, Unix/Linux | , , , | 1 Comment

How to mount SAN Partition to HP DL580 G7 Server In Linux

Before setting up DM-Multipath on your system, ensure that your system has been updated & includes the device-mapper-multipath package.
You set up multipath with the mpathconf utility, which creates the multipath configuration file /etc/multipath.conf.

# mpathconf

a) If the /etc/multipath.conf file already exists, the mpathconf utility will edit it.
b) If the /etc/multipath.conf file does not exist, the mpathconf utility will use the /usr/share/doc/device-mapper-multipath-0.4.9/multipath.       conf file as the starting file.
c) If the /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf file does not exist the mpathconf utility will create the /etc/multipath.      conf file from scratch.

If you do not need to edit the /etc/multipath.conf file, you can set up DM-Multipath for a basic failover configuration by running the following command. This command enables the multipath configuration file and starts the multipathd daemon. If you need to edit the /etc/multipath. conf file before starting the multipathd daemon. use the following procedure to set up DM-Multipath for a basic failover configuration.

1. Run the mpathconf command with the –enable option specified:

# mpathconf –enable
# mpathconf –enable –with_multipathd y
# mpathconf –enable –find_multipaths y
# mpathconf –enable –user_friendly_names y
# /etc/init.d/multipathd reload
# service multipathd restart
#chkconfig multipathd on

Since the value of user_friendly_name is set to yes in the configuration file, the multipath devices will be created as /dev/mapper/mpathn.

If you do not set the find_multipaths configuration parameter to yes, can use the following procedure to modify the multipath configuration file to ignore the local disks when configuring multipath.

2. Determine which disks are the internal disks and mark them as the ones to blacklist. In this example, /dev/sda is the internal disk. Note that as originally configured in the default multipath configuration file, executing the multipath -v2 shows the local disk, /dev/sda, in the
multipath map.

3. Now Search the partition and format it.

# fdisk -l
# fdisk /dev/mapper/mpathbp1
# mkfs.ext4 /dev/mapper/mpathbp1
# mount /dev/mapper/mpathbp1 /backup

4. Edit in /etc/fstab file during Booting Process for Mounting.

# vim /etc/fstab

/dev/mapper/mpathbp1    /backup   ext4   defaults   1   0

5. Edit in /etc/rc.local file after Booting Process for Mounting.

# vim /etc/rc.local

mount /dev/mapper/mpathbp1 /backup

Note: If SAN Raw Partition not show properly, then add following for HP 3PAR SAN storage in /etc/multipath.conf file.

# vim /etc/multipath.conf

defaults {
    polling_interval 10
    max_fds 8192
}

devices {
    device {
        vendor “3PARdata”
        product “VV”
        no_path_retry 18
        features “0”
        hardware_handler “0”
        path_grouping_policy multibus
        getuid_callout “/lib/udev/scsi_id –whitelisted –device=/dev/%n”
        path_selector “round-robin 0”
        rr_weight uniform
        rr_min_io_rq 1
        path_checker tur
        failback immediate
        }
    }

July 1, 2013 Posted by | SAN, Tips & Tricks, Unix/Linux | , , , | Leave a comment

How to Download Oracle Latest Java JRE/JDK in linux by bypassing license using wget

Oracle has recently disabled direct download of java from their servers. So to download java, users have to visit their site via web browser and have to accept their license and terms, then users will get the download link. But if you are working of linux servers in which you can’t access the web browser, then  you should use wget command on the console. Use Below command to download java from linux terminal.

#  wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F” “http://download.oracle.com/otn-pub/java/jdk/7u25-b15/jdk-7u25-linux-x64.tar.gz&#8221;

Where :

Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F :- It is a single cookie for all that is needed to bypass license and terms

–no-cookies : – Cookies are a mechanism for maintaining server-side state.  The server sends the client a cookie using the “Set-Cookie” header, and the client responds with the same cookie upon further requests.

–no-check-certificate : – Don’t check the server certificate against the available certificate authorities.  Also don’t require the URL host name to match the common name presented by the certificate.

June 26, 2013 Posted by | Java, Tips & Tricks | , , | Leave a comment

What is the difference between MD5 and SHA

MD5: 128-bit/16-byte digest. Somewhat faster than SHA.
SHA: 160-bit/20-byte digest. More secure because stronger against brute force attacks.

MD5 was developed by Professor Rivest (1994).
SHA (actually SHA-1) was developed by NIST (1994).

The MD5 algorithm is slightly cheaper to compute, however MD5 is currently very vulnerable to collision attacks. Similarly SHA1 will most likely be very vulnerable to collision attacks in a few years since there are now some attacks, security experts consider SHA1 broken since collision attacks are feasible.

The MD5 hashing algorithm uses a hash code which is 16 bytes long whereas SHA1 uses a hash code which is 20 bytes long.

This means that MD5 executes faster but is less secure than SHA1.

However, the security of both these algorithms has been compromised in recent years.

Cryptography Research has received many inquiries about the hash collision attacks that were recently announced at the CRYPTO 2004 conference. This document attempts to address these questions.

(This document was updated on February 16, 2005 to reflect new collision results reported against the SHA-1 algorithm.)

Q: What hash functions are now broken?
A: Collisions were announced in SHA-0, MD4, MD5, HAVAL-128, and RIPEMD. Antoine Joux presented the collision in SHA-0. The collisions against MD4, MD5, HAVAL-128, and RIPEMD were found by the Chinese researcher Xiaoyun Wang with co-authors Dengguo Feng, Xuejia Lai, and Hongbo Yu. (See http://eprint.iacr.org/2004/199.pdf.) In February 2005, an (as-yet unimplemented) attack against SHA-1 was reported by Xiaoyun Wang, Lisa Yiqun Yin, and Hongbo Yu that can find collisions in SHA-1 with an estimated effort of 2^69 hash computations.

Q: What is a collision attack and a preimage attack?
A: A preimage attack would enable someone to find an input message that causes a hash function to produce a particular output. In contrast, a collision attack finds two messages with the same hash, but the attacker can’t pick what the hash will be. The attacks announced at CRYPTO 2004 are collision attacks, not preimage attacks.

Q: What is the connection between digital signatures and hash functions?
A: All major digital signature signing techniques (including DSA and RSA) involve first hashing the data then signing the hash. Raw message data is not signed because of both performance and security reasons.

Q: How might an attacker exploit a collision attack?
A: To exploit a collision attack, an adversary would typically begin by constructing two messages with the same hash where one message appears legitimate or innocuous. For example, suppose the attacker (Charlie) discovers that the message “I, Bob, agree to pay Charlie $ 5000.00 on 4/12/2005.” has the same hash as “I, Bob, agree to pay Charlie $18542841.54 on 9/27/2012.” Charlie could then try to get Bob (the victim) to digitally sign the first message (e.g., by purchasing $5000 of goods). Charlie would then claim that Bob actually signed the second message, and “prove” this assertion by showing that Bob’s signature matches the second message.

Q: What are the implications of collision attacks for code signing systems?
A: Collisions can be a problem for systems that involve signed code. In particular, a collision attack can enable adversaries to construct an innocuous program and a malicious program with the same hash. For example, a trusted compiler/verifier might accept and sign the innocuous program, which could then be substituted for the malicious one. Collision attacks do not allow tampering with arbitrary programs; this would require a preimage attack. (Note: Java accepts MD5 hashes in signatures on JAR files, e.g. see http://www.hmug.org/man/1/jarsigner.html.)

Q: What are the implications for certificate authorities, such as those issuing SSL web server certificates containing MD5 or SHA-1 hashes?
A: Collision attacks do not enable tampering with existing certificates. There is, however, a concern that an adversary might be able to construct a valid certificate request that had a corresponding hash collision with a certificate conferring greater or different powers. For example, a devastating attack would be one that enabled adversaries to obtain a legitimate server certificate with a collision to one containing a wildcard for the domain name and an expiration date far in the future. The use of unpredictable serial numbers early in the certificate data structure may prevent such attacks, but further research is required. From a cryptographic perspective, the best solution to this problem is to transition away from MD5, but this is difficult since many CAs and software programs currently support MD5.

Q: Are all hash functions broken?
A: No. The new attacks affect specific hash functions which happen to share a related class of vulnerabilities. In particular, these attacks are all based on the neutral bit technique of Biham and Chen (see http://eprint.iacr.org/2004/146.ps). There is no evidence suggesting that strong hash functions cannot be constructed.

Q: How hard would it be to find collisions in SHA-1?
A: The reported attacks require an estimated work factor of 2^69 (approximately 590 billion billion) hash computations. While this is well beyond what is currently feasible using a normal computer, this is potentially feasible for attackers who have specialized hardware. For example, with 10,000 custom ASICs that can each perform 2 billion hash operations per second, the attack would take about one year. Computing improvements predicted by Moore ‘s Law will make the attack more practical over time, e.g. making it possible for a wide-spread Internet virus to use compromised computers to mount such attacks as well. Once a collision has been found, additional collisions can be found trivially by concatenating data to the matching messages.

Q: Do these attacks break HMAC using MD5 or SHA-1?
A: No. Because of the way hash functions are used in the HMAC construction, the techniques used in these recent attacks do not apply.

Q: Do these attacks allow somebody to break tools that use MD5 or SHA-1 to check for malicious binaries?
A: Not usually, as this would require a preimage attack. It would, however, be possible for someone to construct an innocuous program and a malicious program with the same hash. If this adversary could get the innocuous version on the “good” list (e.g. by having a trusted authority sign the hash value), the malicious program would also be accepted.

Q: What is the difference between SHA-0 and SHA-1? Is SHA-0 widely used?
A: SHA-0 was initially proposed in FIPS 180 (May 1993) as hashing standard by the U.S. government, but was replaced by SHA-1 in FIPS 180-1 (April 1995). SHA-1 adds an additional circular shift operation that appears to have been specifically intended to address the weaknesses found in SHA-0. SHA-0 is not widely used and should not be used in new systems. In light of the new attacks, careful consideration should be made before using SHA-1 in new systems.

Q: Is SSL 3.0/TLS affected by these results?
A: The SSL 3.0 protocol (which was co-authored by Cryptography Research President & Chief Scientist Paul Kocher) uses MD5 and SHA-1 in a redundant fashion in the handshake protocol and also supports MD5 HMAC. Neither use is affected by these attacks. While there is also some concern that signing authorities could be affected (see the question above on certificate authorities), certificate formats and procedures are beyond the scope of the SSL/TLS protocol.

Q: Can the problem be solved by updating hash function implementations to detect the messages that produce collisions?
A: No. The attack methods are general and enable the construction of additional collisions.

June 16, 2013 Posted by | Shell Script, Tips & Tricks, Unix/Linux | , , | Leave a comment

RAID Levels

RAID_0 RAID_1RAID_0+1RAID_10RAID_5RAID_50   RAID_60RAID_6

May 12, 2013 Posted by | RAID, Tips & Tricks | , | Leave a comment

RAID Disk Space Calculator

Raid 0 (Stripe)

Raid 1 (Mirror) — 2 Drives

Raid 5 (Drives with Parity) — Minimum 3 Drives

Raid 6 (Drives with Double Parity) — Minimum 4 Drives

Raid 10 (Mirror+Stripe) or 0+1 (Stripe+Mirror) — Minimum 4 Drives

Raid 50 (Parity+Stripe) — Minimum 6 Drives

Raid 60 (Double Parity+Stripe) — Minimum 8 Drives

May 7, 2013 Posted by | RAID, Tips & Tricks | , | 2 Comments

RAID Types – 0, 1, 5, 6, 0+1, 10, 50, 60

RAID stands for Redundant Array of Independent Disks. RAID is a method of combining several hard drives into one unit. It offers fault tolerance and higher throughput levels than a single hard drive or group of independent hard drives. RAID levels 0, 1, 10 and 5 are the most popular.

The acronym RAID, originally coined at UC-Berkeley in 1987, stood for Redundant Array of Inexpensive Disks.

RAID Configurations

 RAID_0
RAID 0 splits data across drives, resulting in higher data throughput. The performance of this configuration is extremely high, but a loss of any drive in the array will result in data loss. This level is commonly referred to as striping.Minimum number of drives required: 2Performance: High

Redundancy: Low

Efficiency: High

 Advantages:

  • High performance
  • Easy to implement
  • Highly efficient (no parity overhead)

Disadvantages:

  • No redundancy
  • Limited business use cases due to no fault tolerance
 RAID_1
RAID 1 writes all data to two or more drives for 100% redundancy: if either drive fails, no data is lost. Compared to a single drive, RAID 1 tends to be faster on reads, slower on writes. This is a good entry-level redundant configuration. However, since an entire drive is a duplicate, the cost per megabyte is high. This is commonly referred to as mirroring.Minimum number of drives required: 2Performance: Average

Redundancy: High

Efficiency: Low

 Advantages:

  • Fault tolerant
  • Easy to recover data in case of drive failure
  • Easy to implement

Disadvantages:

  • Highly inefficient (100% parity overhead)
  • Not scalable (becomes very costly as number of disks increase)
 RAID_5
RAID 5 stripes data at a block level across several drives, with parity equality distributed among the drives. The parity information allows recovery from the failure of any single drive. Write performance is rather quick, but because parity data must be skipped on each drive during reads, reads are slower. The low ratio of parity to data means low redundancy overhead.Minimum number of drives required: 3Performance: Average

Redundancy: High

Efficiency: High

 Advantages:

  • Fault tolerant
  • High efficiency
  • Best choice in multi-user environments which are not write performance sensitive

Disadvantages:

  • Disk failure has a medium impact on throughput
  • Complex controller design
 RAID_6
RAID 6 is an upgrade from RAID 5: data is striped at a block level across several drives with double parity distributed among the drives. As in RAID 5, parity information allows recovery from the failure of any single drive. The double parity gives RAID 6 additional redundancy at the cost of lower write performance (read performance is the same), and redundancy overhead remains low.Minimum number of drives required: 4Performance: Average

Redundancy: High

Efficiency: High

Advantages:

  • Fault tolerant – increased redundancy over RAID 5
  • High efficiency
  • Remains a great option in multi-user environments which are not write performance sensitive

Disadvantages:

  • Write performance penalty over RAID 5
  • More expensive than RAID 5
  • Disk failure has a medium impact on throughput
  • Complex controller design
 RAID_0+1
RAID 0+1 is a mirror (RAID 1) array whose segments are striped (RAID 0) arrays. This configuration combines the security of RAID 1 with an extra performance boost from the RAID 0 striping.Minimum number of drives required: 4Performance: Very High

Redundancy: High

Efficiency: Low

Advantages:

  • Fault tolerant
  • Very high performance

Disadvantages:

  • Expensive
  • High Overhead
  • Very limited scalability
 RAID_10
RAID 10 is a striped (RAID 0) array whose segments are mirrored (RAID 1). RAID 10 is a popular configuration for environments where high performance and security are required. In terms of performance it is similar to RAID 0+1. However, it has superior fault tolerance and rebuild performance.Minimum number of drives required: 4Performance: Very High

Redundancy: Very High

Efficiency: Low

Advantages:

  • Extremely high fault tolerance – cnder certain circumstances, RAID 10 array can sustain multiple simultaneous drive failures
  • Very high performance
  • Faster rebuild performance than 0+1

Disadvantages:

  • Very expensive
  • High overhead
  • Limited scalability
 RAID_50
RAID 50 combines RAID 5 parity and stripes it as in a RAID 0 configuration. Although high in cost and complexity, performance and fault tolerance are superior to RAID 5.Minimum number of drives required: 6Performance: High

Redundancy: High

Efficiency: Average

Advantages:

  • Higher fault tolerance than RAID 5
  • Higher performance than RAID 5
  • Higher efficiency than RAID 5

Disadvantages:

  • Very expensive
  • Very complex / difficult to implement
RAID_60
RAID 60 combines RAID 6 double parity and stripes it as in a RAID 0 configuration. Although high in cost and complexity, performance and fault tolerance are superior to RAID 6.Minimum number of drives required: 8Performance: High

Redundancy: High

Efficiency: Average

Advantages:

  • Higher fault tolerance than RAID 6
  • Higher performance than RAID 6
  • Higher efficiency than RAID 6

Disadvantages:

  • Very expensive
  • Very complex / difficult to implement

May 2, 2013 Posted by | RAID, Tips & Tricks | , | Leave a comment

Service httpd status: httpd dead but subsys locked, but pid exists

I have an apache server acting as a reverse proxy for serveral websites, (which you should see that it is up and running). However, when I check the status of the apache service, I get this:

# service httpd status
httpd dead but subsys locked

================== Method-1 ==================

So I lookup the locked PIDs of apache and get:

# ipcs -s | grep apache
0x00000000 98306 apache 600 1
0x00000000 131075 apache 600 1
0x00000000 163844 apache 600 1

So I delete these resources:

# ipcs -s | grep apache | perl -e ‘while (<STDIN>) { @a=split(/\s+/);print `ipcrm sem $a[1]`}’
resource(s) deleted
resource(s) deleted
resource(s) deleted

and I delete the lock from the subsys folder:

# cd /var/lock/subsys
# rm httpd

and start apache:

# service httpd restart
Starting httpd: [ OK ]

================== Method-2 ==================

If the above is not fixing then try the following.

comment out the following module in your httpd.conf and restart apache

# vim /etc/httpd/conf/httpd.conf
LoadModule unique_id_module modules/mod_unique_id.so

# /etc/init.d/httpd restart

April 27, 2013 Posted by | Apache, Tips & Tricks | , | Leave a comment

How to rotate apache logs

/var/log/httpd/access_log.* {
compress
copytruncate
create 644 root root
rotate 30
size 100K
}

/var/log/httpd/dummy-host.example.com-access_log.* {
compress
copytruncate
create 644 root root
rotate 30
size 10M
}

/var/log/httpd/dummy-host.example.com-error_log.* {
compress
copytruncate
create 644 root root
rotate 30
size 100K
}

/var/log/httpd/error_log.* {
compress
copytruncate
create 644 root root
rotate 30
size 5K
}

/var/log/httpd/mod_jk.log.* {
compress
copytruncate
create 644 root root
rotate 30
size 5M
}

/var/log/httpd/ssl_access_log.* {
compress
copytruncate
create 644 root root
rotate 30
size 10K
}

/var/log/httpd/ssl_error_log.* {
compress
copytruncate
create 644 root root
rotate 30
size 10K
}

/var/log/httpd/ssl_request_log.* {
compress
copytruncate
create 644 root root
rotate 30
size 10K
}

daily :- rotates the catalina.out daily
rotate 7 :- keeps at most 7 log files
compress :- compresses the rotated files
size 10M :- rotates if the size of logs are bigger than 10M
copytruncate :- Truncate the original log file in place after creating a copy, instead of moving the old log file and optionally creating a new one, It can be used when some program can not be told to close its logfile and thus might continue writing (appending) to the previous log file forever. Note that there is a very small time slice between copying the file and truncating it, so some logging data might be lost. When this option is used, the create option will have no effect, as the old log file stays in place.

April 22, 2013 Posted by | Apache, Tips & Tricks, Unix/Linux | , , , | Leave a comment

How to check IDE/SATA Hard Disk Transfer Speed

how to find out how fast is the hard disk, Is it running at SATA I (150 MB/s) or SATA II (300 MB/s) speed without opening computer case or chassis, Use the hdparm command to check hard disk speed. It provides a command line interface to various hard disk ioctls supported by the stock Linux ATA/IDE/SATA device driver subsystem. Some options may work correctly only with the latest kernels (make sure you have cutting edge kernel installed). It provides more accurate result. Measure Hard Disk Data Transfer Speed, Login as the root and enter the following command:

# hdparm -tT /dev/sda

OR

# hdparm -tT /dev/hda

Sample outputs:

/dev/sda:
 Timing cached reads:   7864 MB in  2.00 seconds = 3935.41 MB/sec
 Timing buffered disk reads:  204 MB in  3.00 seconds =  67.98 MB/sec

For meaningful results, this operation should be repeated 2-3 times. This displays the speed of reading directly from the Linux buffer cache without disk access. This measurement is essentially an indication of the throughput of the processor, cache, and memory of the system under test. Here is a for loop example, to run test 3 time in a row: for i in 1 2 3; do hdparm -tT /dev/hda; done; Where,

-t :perform device read timings
-T : perform cache read timings
/dev/sda : Hard disk device file

To find out SATA hard disk speed, enter:

# hdparm -I /dev/sda | grep -i speed

Output:

  *    Gen1 signaling speed (1.5Gb/s)
*    Gen2 signaling speed (3.0Gb/s)

Above output indicate that my hard disk can use both 1.5Gb/s or 3.0Gb/s speed. Please note that your BIOS / Motherboard must have support for SATA-II.

April 17, 2013 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment

How to Reload/Take effect .bashrc and /etc/profile files without Reboot

After editing /root/.bashrc or /etc/profile, the file take effect immediately without System Reboot by using given below command.

# source /root/.bashrc

OR

# source /etc/profile

You can either logout and login again.

April 12, 2013 Posted by | Tips & Tricks, Unix/Linux | , , | 1 Comment

How to hide web server version in Tomcat

Add the following attributes to the <Connector> in Tomcat’s server.xml to hide web server version in Tomcat at line no- 73 :-

# vim apache-tomcat/conf/server.xml

<Connector port=”8080″ protocol=”HTTP/1.1″
connectionTimeout=”20000″
redirectPort=”8443″
server=”Tomcat” />

April 7, 2013 Posted by | Security, Tips & Tricks, Tomcat | , , , , | 1 Comment