How to find RAID card firmware version / How to upgrade Firmware?

How to find RAID card firmware in Linux server?

1.Login to the server as root and run the below command to find the current firmware version for RAID card 

2. #cat /proc/driver/cciss/cciss*


root:serverA# cat /proc/driver/cciss/cciss*
cciss0: HP Smart Array E200i Controller
Board ID: 0x3211103c
Firmware Version: 1.78
IRQ: 58
Logical drives: 1
Current Q depth: 0
Current # commands on controller: 0
Max Q depth since init: 32
Max # commands on controller since init: 252
Max SG entries since init: 31
Sequential access devices: 0

cciss/c0d0:      146.77GB       RAID 1(1+0)

How to upgrade RAID card Firmware ?

For upgrade a Firmware you can download the firmware file from concern support site. Normally it will be in the format of *.scexe file. You can execute the file as 


If you have HP Smart array RAID card means you can down laod the SMART DVD ISO image file and you cna use that tool for upgrade the firmware.

1. Mount that ISO image as Virtual DVD in console

2. Reboot  the server through that image/ DVD. 

3. Once its booted thrw that DVD you will get the option to upgrade the firmware like RAID , ILO , Enclosure, Mother board. You can choose for which hardware you want to upgrade the firmware.

4.Then once its upgraded then reboot the machine and check the firmware version now.

How to Set JAVA_HOME / PATH variable in Linux

 Set Environment Variable for single / All users:

Normally Based on our requirement we need to set the PATH variable in desired config files. Below is the config files and its desired usage.

File name                           - Where / when it need to use

/etc/profile                         -  Global for many shells

/etc/bash.bashrc                 -  Global for bash only

~/.profile                            - local for many shells

~/.bashrc                           - local bash only

A. Set JAVA_HOME / PATH for a single user

$ vi ~/.bash_profile

export JAVA_HOME=/usr/java/jdkX_X_X/bin/java  //New Java version path

export PATH=$PATH:/usr/bin/:/add/new_java_path  //At the end Add the new path what you want.

Save and exit

Then run the below command to take effect

# source  ~/.bash_profile


# . ~/.bash_profile

Verify the settings:

#echo $JAVA_HOME

#echo $PATH

#which java

B. Set JAVA_HOME / PATH for all users

You need to setup global config in /etc/profile OR /etc/bash.bashrc file for all users:

# vi /etc/profile

Next setup PATH / JAVA_HOME variables as follows:

export PATH=$PATH:/usr/java/jdk?.X.X.X/bin

export JAVA_HOME=/usr/local/jdk?.X.X.X/bin

Save and exit.

Then run the below commands

# source /etc/profile


# . /etc/profile

Verify the settings:

#echo $JAVA_HOME

#echo $PATH

#which java

Replace failed Non Boot Disk in Linux : How to ?

Replacing Failed RAID Disk on Linux (Non boot disk)

This procedure can be used the disk is mirrored in RAID.

1. If the disk is hot-swappable, simply remove it. If it isn't, you'll need to schedule downtime and remove the disk.

2. Replace the failed disk and restart your machine,

3. After replacing the disk check the RAID status

# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sda1[0]
104320 blocks [2/1] [U_]

md1 : active raid1 sdb2[1] sda2[0]
522048 blocks [2/2] [UU]

md2 : active raid1 sda3[0]
4610560 blocks [2/1] [U_]

unused devices:

4. Repartition the disk, again, with sfdisk and we should end up with our partition table looking exactly the same
# sfdisk -d /dev/sda > mirror
# sfdisk /dev/sdb < mirror
The partition table should look almost identical

5. Now, just need to add back all the partitions
# mdadm -a /dev/md0 /dev/sdb1
# mdadm -a /dev/md1 /dev/sdb2
# mdadm -a /dev/md2 /dev/sdb3

6. Check the RAID details using the below command

# mdadm -D /dev/md0
# mdadm -D /dev/md1
# mdadm -D /dev/md2

Once the RAID sync is done then restart and check the status. 

Logical Volume in Linux : Interview Questions


Logical Volume in LVM: Interview Questions


#lvdisplay -v lvname


To view mirror volumes

#lvs -a -o +devices
#lvs -a -o +seg_pe_ranges --segments

lvs attributes are:

1. volume type: (m)irrored, (M)irrored without initail sync, (o)rigin, (p)vmove, (s)napshot, invalid (S)napshot, (v)irtual, mirror (i)mage
                      mirror (I)mage out-of-sync, under (c)onversion
2. permissions: (w)rite, (r)ead-only
3. allocation policy - (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere, (i)nherited
4. fixed (m)inor
5. state: (a)ctive, (s)uspended, (I)nvalid snapshot, invalid (S)uspended snapshot, mapped (d)evice present with-out tables,
             mapped device present with (i)nactive table
6. device (o)pen (mounted in other words)


#lvscan -v

Create / Extend / Reduce / Remove:

Create a Lvol

#lvcreate -L 10M -n lvol1 VGNAME  // To create plain lvol

#lvcreate -i 3 -I 32 -L 24M -n lvol1 vg01  //To create striped lvol

#lvcreate -L 10M -m1 -n lvol1 vg01  // To Create mirror lvol

Extend a Lvol

#lvextend -L 20M /dev/VolData00/lvol01

#fsadm resize /dev/VolData01/data01
#resize2fs -p /dev/mapper/VolData01-data01 [size]

Reduce Lvol

#lvreduce -L 5M /dev/VolData00/lvol01 (or)
#lvresize -L 5M /dev/VolData00/lvol01

#fsadm resize /dev/VolData01/data01 [size]
#resize2fs -p /dev/mapper/VolData01-data01 [size]

Rename / Snapshot / change attribute

# lvrename /dev/VolData00/vol_old /dev/VolData00/vol_new    //Rename

# lvcreate --size 100M --snapshot -name snap /dev/vg01/data01    //Snapshot

#lvchange -a n /dev/VolData00/vol01   //Changing attribute

PV commands in Linux - LVM interview Questions

PV related commands in Linux LVM :

Directories and Files :

## Directories
/etc/lvm                    - default lvm directory location
/etc/lvm/backup         - where the automatic backups go
/etc/lvm/cache          - persistent filter cache
/etc/lvm/archive        - where automatic archives go after a volume group change
/var/lock/lvm             - lock files to prevent metadata corruption

# Files
/etc/lvm/lvm.conf       - main lvm configuration file
$HOME/.lvm               - lvm history

Diagnostics :

#lvmdump -d

# dmsetup [info|ls|status]    

// Note: by default the lvmdump command creates a tar ball


Display :

  # pvdisplay -v
  # pvs -v
  # pvs -a

Scanning : 

#pvscan -v

Note: scans for disks for non-LVM and LVM disks

Add / Remove  / Check PV:

 # pvcreate /dev/sdb1
 # pvremove /dev/sdb1
  #pvck -v /dev/sdb1

Change physical attributes:  

## do not allow allocation of extents on this drive

#pvchange -x n /dev/sdb1

- Common Attributes that you may want to use:

      --addtag add a tag
      -x allowed to allocate extents
       -u change the uuid

Move  PV        : 

# pvmove -v /dev/sdb2 /dev/sdb3

Note: moves any used extents from this volume to another volume, in readiness to remove that volume. However you cannot use this on mirrored volumes, you must convert back to non-mirror using "lvconvert -m 0"

VG Commands in Linux - LVM interview Question


VG Related command tips in Linux

This post will help you to keep remember Volume Group - VG related commands in Linux at the time of interview Preparation.

Display Volume Group

vgdisplay -v
vgs -v
vgs -a -o +devices

vgs flags:

#PV - number of physical devices
#LV - number of configured volumes       

vgs attributes are:
1. permissions (r)|(w)
2. resi(z)eable
3. e(x)ported
4. (p)artial
5. allocation policy - (c)ontiguous, c(l)ing, (n)ormal, (a)nywhere, (i)nherited
6. (c)luster

Create VG :

vgcreate VolData00 /dev/sdb1 /dev/sdb2 /dev/sdb3
vgcreate VolData00 /dev/sdb[123]

## Use 32MB extent size

# vgcreate VGName -s 32 /dev/sdb1

Common Attributes that you may want to use:

-l  maximum logical volumes
-p maximum physical volumes
-s physical extent size (default is 4MB)
-A autobackup 

Extend / Reduce / Remove  Volume Group :

vgextend VGName /dev/sdb3

vgreduce VGName /dev/sdb3

vgreduce --removemissing --force VolData00

vgremove VGName

Change in VG :

vgchange -a n VolData00

Common Attributes that you may want to use:

-a control availability of volumes within the group
-l  maximum logical volumes
-p maximum physical volumes
-s physical extent size (default is 4MB)
-x resizable yes or no (see VG status in vxdisplay)

Check and rename Volume Group :

#vgrename VGName VGName_New   //no LV should be activate at the time of rename

#vgck VolData00       //checking consistency of Meta data

Convert / Merge / Split  Volume Group:

#vgconvert -M2 VGName  //convert one type to anothe type (lvm1 to lvm2)

#vgmerge New_Vol_Group Old_Vol_Group  /old vg will be merged to new VG

#vgsplit Old_Vol_Group New_Vol_Group [physical volumes] [-n logical volume name]

Import / Export Volume Group

#vgimport VGName

#vgexport VGName

Backup and Restore:

# vgcfgbackup VGname

# vgcfgrestore -f /var/backup/VGname_bkup VGName

Blogger Tips and TricksLatest Tips And TricksBlogger Tricks