Friday, March 20, 2015

How to configure network on RHEL7

Steps to configure network on RHEL7

Monday, March 16, 2015

showmount command - get nfs share



# more showmount.ksh
#!/bin/ksh
server=`echo $1 | cut -f1 -d':'`
fs=`echo $1 | cut -f2 -d':'`
showmount -e $server | grep "$fs"
#

Some tips

Some tips

Friday, March 13, 2015

How To install/repair grub on RHEL 6

How To install grub.
If you have corrputed grub, you can install it using the follwing instructions.

Pre-requisite
1. Access to OS boot image or CD.
2. Access to console if virtual environment.

Steps
1. Boot your system using your boot (1st cd/DVD/Image) image.
2. Boot your system and go to rescue mode

linux rescue


Note: Make sure you have same version of OS copy that of the installed OS.
3. Just follow the prompt.



The rescue environment will try to find the Linux installation and mount it under /mnt/sysimage.

Your root fs is mounted at /mnt/sysimage and cd to it.
# cd chroot /mnt/sysimage

if you know your disk, just run the grub install command.

grub-install /dev/sda

exit from the prmpt and boot the system.

9. System will Reboot !!! enjoy

How to install grub


Sunday, March 8, 2015

RHEL7 - How to assign ip address


How to assign static ip to RHEL 7 host.

Note: Network Manager is installed by default.

To verify the status of Network Manager service:

$ systemctl status NetworkManager.service
under Active section, you will see active (running)


Find out the active interface managed by Network Manager
$ nmcli dev status

You will find the output with status.


Assigning static IP without Network Manager

Go to network config location
# cd /etc/sysconfig/network-scripts
# vi ifcfg-interface

Now change the following parameter
BOOTPROTO=static
IPADDR=192.168.10.120
NETMASK=255.255.255.0
NM_CONTROLLED=no
ONBOOT=yes

wq!
other stuff,  you can leave as it is not you can remove all reference to ipv6

Restart netwok service
# systemctl restart network.service

Verify if ip is assigned
# ip add


Using Network Manager to set up ip address

nmtui (Network Manager Text User Interface) can be used to configure on terminal window.

# yum search NetworkManager
# yum install NetworkManager-tui

find your interface and use nmtui to configure it.
# nmtui edit interface
it infact allow you to make changes to /etc/sysconfig/network-scripts/ifcfg.interface file.

make changes based on your requirement options.
and restart your service
# systemctl restart network.service


Please remember to add gateway info either on ifcfg-interface or /etc/sysconfig/network file

Find the size of the disk that is part of ASM disk

# lvs
# fdisk -l
# multipath -ll | more
# multipath -ll | grep -A 1 ASMDISK
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}'
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}'
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}' | sed -e 's/[features=1//'
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}' | sed -e 's/[features=1//'
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}' | sed -e 's/\[features=1//'
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}' | sed -e 's/\[features=1//' | grep ASM
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}' | sed -e 's/\[features=1//' | grep ASM
# multipath -ll | grep -A 1 ASMDISK | awk '/ASMDISK/ {print $1} /size=/ {print substr($0,1,11)}' | awk '/ASMDISK/ {l1=$0; getline; print l1 " " $0}'  | sort
ASMDISK01 [size=101G]
ASMDISK02 [size=101G]
ASMDISK02 [size=101G]
ASMDISK04 [size=101G]
ASMDISK05 [size=101G]
ASMDISK06 [size=101G]
ASMDISK07 [size=101G]
ASMDISK08 [size=101G]
ASMDISK09 [size=101G]
ASMDISK10 [size=101G]
ASMDISK19 [size=101G]
ASMDISK21 [size=101G]



# ls -l /dev/mapper
# multipath -ll
# multipath -ll  | grep -A 1 3600

# multipath -ll  | grep -A 1 3600
SANDISK03 (360060160ccd02600481caca40112e011) dm-2 DGC,VRAID
[size=100G][features=1 queue_if_no_path][hwhandler=1 emc][rw]
--
SANDISK02 (360060160ccd02600491caca40112e011) dm-0 DGC,VRAID
[size=100G][features=1 queue_if_no_path][hwhandler=1 emc][rw]
--
SANDISK01 (360060160ccd026004a1caca40112e011) dm-1 DGC,VRAID
[size=100G][features=1 queue_if_no_path][hwhandler=1 emc][rw]

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/cciss/c0d0p3      20G  5.4G   14G  30% /
/dev/mapper/system-oraclelv
                       34G  208M   32G   1% /opt/oracle
/dev/mapper/system-datalv
                      4.9G  885M  3.8G  19% /data
/dev/mapper/system-data_oraclelv
                       20G  7.4G   12G  40% /data/oracle
/dev/mapper/sanvg-oradblv1
                      249G  115G  121G  49% /data/oradata1
/dev/mapper/sanvg-oradblv2
                       47G  181M   44G   1% /data/oralog1

# pvs -o +devices
  PV                     VG     Fmt  Attr PSize   PFree    Devices
  /dev/cciss/c0d0p5      system lvm2 a--   84.44G    7.44G /dev/cciss/c0d0p5(0)
  /dev/cciss/c0d0p5      system lvm2 a--   84.44G    7.44G /dev/cciss/c0d0p5(384)
  /dev/cciss/c0d0p5      system lvm2 a--   84.44G    7.44G /dev/cciss/c0d0p5(1504)
  /dev/cciss/c0d0p5      system lvm2 a--   84.44G    7.44G /dev/cciss/c0d0p5(1664)
  /dev/cciss/c0d0p5      system lvm2 a--   84.44G    7.44G /dev/cciss/c0d0p5(1824)
  /dev/cciss/c0d0p5      system lvm2 a--   84.44G    7.44G
  /dev/mpath/SANDISK01p1 sanvg  lvm2 a--  100.00G       0  /dev/mpath/SANDISK01p1(0)
  /dev/mpath/SANDISK02p1 sanvg  lvm2 a--  100.00G       0  /dev/mpath/SANDISK02p1(0)
  /dev/mpath/SANDISK03p1 sanvg  lvm2 a--  100.00G 1012.00M /dev/mpath/SANDISK03p1(0)
  /dev/mpath/SANDISK03p1 sanvg  lvm2 a--  100.00G 1012.00M /dev/mpath/SANDISK03p1(13314)
  /dev/mpath/SANDISK03p1 sanvg  lvm2 a--  100.00G 1012.00M

# vgs -o +devices
  VG     #PV #LV #SN Attr   VSize   VFree    Devices
  sanvg    3   2   0 wz--n- 299.99G 1012.00M /dev/mpath/SANDISK01p1(0)
  sanvg    3   2   0 wz--n- 299.99G 1012.00M /dev/mpath/SANDISK02p1(0)
  sanvg    3   2   0 wz--n- 299.99G 1012.00M /dev/mpath/SANDISK03p1(0)
  sanvg    3   2   0 wz--n- 299.99G 1012.00M /dev/mpath/SANDISK03p1(13314)
  system   1   5   0 wz--n-  84.44G    7.44G /dev/cciss/c0d0p5(0)
  system   1   5   0 wz--n-  84.44G    7.44G /dev/cciss/c0d0p5(384)
  system   1   5   0 wz--n-  84.44G    7.44G /dev/cciss/c0d0p5(1504)
  system   1   5   0 wz--n-  84.44G    7.44G /dev/cciss/c0d0p5(1664)
  system   1   5   0 wz--n-  84.44G    7.44G /dev/cciss/c0d0p5(1824)

# lvs -o +devices
  LV            VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert Devices
  oradblv1      sanvg  -wi-ao 252.00G                                       /dev/mpath/SANDISK01p1(0)
  oradblv1      sanvg  -wi-ao 252.00G                                       /dev/mpath/SANDISK02p1(0)
  oradblv1      sanvg  -wi-ao 252.00G                                       /dev/mpath/SANDISK03p1(0)
  oradblv2      sanvg  -wi-ao  47.00G                                       /dev/mpath/SANDISK03p1(13314)
  data_oraclelv system -wi-ao  20.00G                                       /dev/cciss/c0d0p5(1824)
  datalv        system -wi-ao   5.00G                                       /dev/cciss/c0d0p5(1504)
  optlv         system -wi-ao  12.00G                                       /dev/cciss/c0d0p5(0)
  oraclelv      system -wi-ao  35.00G                                       /dev/cciss/c0d0p5(384)
  tmplv         system -wi-ao   5.00G                                       /dev/cciss/c0d0p5(1664)