Saturday, October 31, 2015

VGs(volume groups) are in DISABLED state

If the VGs are in DISABLED state ( check with the below commnd)

# vxprint -hvt

if VGs are in disabled state use below command

vxvol -g <diskgrp> startall


#  vxvol -g vgtstgrp startall

Thursday, October 29, 2015

umount: /mnt: device is busy. (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1))


Yupp i was faced this issue many times.

when you see this issue

step1:-
 check and see you might be in same directory. in my case i was in /mnt and i am trying to unmounting. using umount /mnt command. (#umount /mnt)
then i got the below error

[root@test mnt]# umount -f /mnt
umount: Device or resource busy
umount: /mnt: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
umount: Device or resource busy.

step2:-

if you are not in same directory and still you are getting this error means some prcoess are still holding this .

then try with -f   ( umount -f /mnt)

In some cases even -f option also wont help. Then check which process are running with fuser command.

#fuser -u /mnt  or
#fuser -m /mnt

you will get some process ID's which are running. So if you can kill those you can umount.

even it didnt help ? then you can try with "l" option.

# umount -l /mnt  ( l is lazy mount. you can check with man umount   for more options)

umount -l will work for sure.


if you still see stale error or  mount point even after lazy unmount. Then their could be chancess of issue is from NAS side. it means this server may not have permissions for this export.


X11 connection rejected because of wrong authentication.

xclock which is usually used to install some applications as GUI mode.

Below are the main packages which we have to install to work xclock

check with rpm command

# rpm -qa | grep -i xorg*

xorg-x11-drv-evdev-2.6.0-2.el6.x86_64
xorg-x11-utils-7.5-6.el6.x86_64
xorg-x11-font-utils-7.2-10.el6.x86_64
xorg-x11-xkb-utils-7.4-6.el6.x86_64
xorg-x11-server-common-1.10.6-1.el6.x86_64
xorg-x11-server-Xorg-1.10.6-1.el6.x86_64
xorg-x11-apps-7.6-6.el6.x86_64
xorg-x11-drv-ati-firmware-6.13.0-6.el6.noarch
xorg-x11-drv-vesa-2.3.0-2.0.1.el6.x86_64
xorg-x11-proto-devel-7.6-25.el6.noarch
xorg-x11-xauth-1.0.2-7.1.el6.x86_64
xorg-x11-fonts-misc-7.2-9.1.el6.noarch
xorg-x11-drv-void-1.4.0-1.el6.x86_64

>> check below config file is enlabled or not?       X11Forwarding yes   should be commentout

[root@test ~]# grep -i x11* /etc/ssh/sshd_config
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#       X11Forwarding no


>> make sure you added the right key
>> xauth list         <,,,you will get the output>>>>>>


#xauth add <add here which got xauth list output>

then it will be work. check with xclock commnd

#xclock


########################################
some more useful commands

echo $DISPLAY

export DISPLAY=localhost:10.0

#######################################

what is VERITAS main configuration file

Here is the veritas main configuration file.

# /etc/VRTSvcs/conf/config/main.cf

how to check server is in cluster or not

check with hastatus -sum  or with veritas main configiration file

# hastatus -sum

or

# cat /etc/VRTSvcs/conf/config/main.cf

based on output you can see the server is in cluster or not.

how to clear clonedisk

vxdisk set device clone=off

for example

#vxdisk set sdb clone=off          <<sdb,sda,sdc  it will vary. it depends on which device having                                                                                clonedisk>>>

Friday, October 23, 2015

AFTER REBOOT THE SYSTEM LOCAL LVM'S ARE MISSING (root file systems)

Usually we could see this issue when we reboot the server after the OS upgrade. we couldn't see the local root files systems  like /tmp /boot /var etc... or we could see from console like /dev/mapper/vg00-lvhome missing

Then you can give a try with below commands which will fix the issue.

the the below command

# mount –n –o remount,rw /

Then run the vgscan

# lvm vgscan

This should report finding the volume group vg00

Then run below command

 #mount –n –o remount,ro /

then rebooot the server again

 #reboot

after server is up you can see file systems using below command

# df -h


couldn't make OS upgrade due to lot of duplicate rpm's

yes some times couldn't make it due to lot of duplicate rpm's and dependencies.

if you could see the less packages you can remove manually. using nodeps command

# rpm -e --nodeps <pkg name>

>> If the issue is with lot  of dependencies.

Then try # yum update  --enablerepo=*

Actually yum itself means install dependencies as well. But somehow very rarely it couldn't install dependencies. it might be the reason some times new version package requires older versions. So give a try with
# yum update --enablerepo=*


its works for me.

Monday, October 19, 2015

line ** in /etc/fstab is bad

check in /etc/fstab , their should be a space issue.

for ex:-  exportfile mountpath  nfs  rw,nfsvers=4,soft 0 0

you can see above line from "rw" to "soft" their should be no space else you will get the error like line is bad in fstab.


how to check HP hardware info(chassis name, serial no )from command line


#dmidecode -t 204


you can see output as below
root@test ~]# dmidecode -t 204

Handle 0xCC00, DMI type 204, 11 bytes
HP ProLiant System/Rack Locator
       
        Enclosure Name: *****
        Enclosure Model: ********
        Enclosure Serial: *******
        Enclosure Bays: *******
       

Thursday, October 15, 2015

while running yum update Error: database is locked



try with yum clean

# yum clean all

how to send wall message to all logined users



login to server

wall "type your text message here "          

(or)

wall -n " type your text message here"    

chown: WARNING: Circular directory structure. This almost certainly means that you have a corrupted file system.


check the mount directory. it might be the new one. and their's no files in that directory and you might using -R. try with  without -R
#chown owner:group <directory>    < use this >
#chown -R owner:group <directory>    < when thier is no files in that mount direcotary you might get above error.> so try with without -R

Thursday, October 8, 2015

NEVER CRY IN YOUR LIFE


INPUT/OUTPUT ERROR FILESYSTEM IS UNMOUNTED ?

#############  INPUT/OUTPUT ERROR FILESYSTEM IS UNMOUNTED

> when you see df -h output as input/ouptput error.
> you need to deport and import the disk group. then it will be in good state.
> Before deport the diskgroup you need to unmount the all the filesystems.

#umount -a -t vxfs    << it means all type of veritas filesystems will be unmounted.
or #umount <fs name>

then deport the diskgrooup

check for diskgroup

#vxdisk list
#vxdg deport diskgroup
#vxdg import diskgroup
then mount  the filesystems
#mount -a

still if you see the issue  reboot is only the option

# reboot
or
#shutdown -r now

HOW TO DELETE ALL FILES AND DIRECTORIES IN A FOLDER


HOW TO DELETE ALL FILES AND DIRECTORIES IN A FOLDER

suppose you need to delete all files under /data/ramesh

using * we can delete all the files and directories

[root@tstvm ramesh]# ls -lrt
total 28
-rw-r--r--. 1 root root    0 Jul 17 07:57 ramesh
-rw-r--r--. 1 root root    0 Jul 17 07:57 b
-rw-r--r--. 1 root root    0 Jul 17 07:57 a
drwxr-xr-x. 2 root root 4096 Jul 17 07:58 kishore
drwxr-xr-x. 2 root root 4096 Jul 17 07:58 sam
drwxr-xr-x. 2 root root 4096 Jul 17 07:58 sai
drwxr-xr-x. 2 root root 4096 Jul 17 07:59 ram
drwxr-xr-x. 2 root root 4096 Jul 17 07:59 logs
drwxr-xr-x. 2 root root 4096 Jul 17 07:59 data
drwxr-xr-x. 2 root root 4096 Jul 17 07:59 apple
[root@tstvm ramesh]# rm -rf *
[root@tstvm ramesh]# ls
[root@tstvm ramesh]# ls -lrt
total 0
[root@tstvm ramesh]#
[root@tstvm ramesh]# pwd
/data/ramesh
[root@tstvm ramesh]#






How To Create a Group ? and Delete ?


Suppose if you want  add group called "technotes" and "linuxtech"
#groupadd linuxtech
#groupadd technotes

 linuxtech and technotes group enteris should be in /etc/group  




How to Delete ?
Syntax:- groupdel <groupname >





HOW TO CHANGE USER PASSWORD

syntax :- passwd <username>

suppose if you wanna change password for kishore

#passwd kishore

< then it will promt you to enter new passwd  then after it will prompt you retypepaswd



Below you can see its showing as only root can change .what does that mean ?

That mean only root can specify the username and delete . Suppose your trying to change the password for your userid you dont need specify the username . just change using passwd command as below .




Below you can see error " BAD PASSWORD: it is based on a dictionary word "   . Does this really error ?

Answer is no . its just warning stating paswwd is not secure as you might gave regular names . Always try to use atleast 6-8 characters including lower/upper case with numeric number .




HOW TO ADD USER



suppose if you wanna add users   sai and kishore.

Syntax :-  useradd <username>





HOW TO CHECK USER IS EXISTED OR NOT?



Using id command you will know either user is created on this server. In below example you can see  Sai,Kishore and Linuxtechnotes users existed .




Below you can see its showing  users linux and technotes not existed .



HOW TO CHECK USER LAST PASSWORD CHANGE AND EXPIRE DATE



using chage -l we can know the details
#chage -l



REBOOT/SHUTDOWN THE SERVER

HOW TO REBOOT THE LINUX SERVER

here are 2 ways to reboot the server

#reboot
#shutdown -r now


HOW TO SHUTDOWN/HALT THE SERVER

#shutdown -h now

HOW TO CHECK SERVER UPTIME( LAST BOOTED TIME)

#uptime

SERVER IS IN HUNG STATE AND NOT ABLE TO LOGIN.



>> If you are not able to login a server.First check from console,

>>From console end if server is running fine then it should be network issue.

>> Even from console if you see server is in hung state  LIKE  blank screen ,that  means server got hung.

>> Then the  only way is you need to reboot the sever. reboot will fix the issue.

SERVER IS IN HUNG STATE AND NOT ABLE TO LOGIN.



>> If you are not able to login a server.First check from console,

>>From console end if server is running fine then it should be network issue.

>> Even from console if you see server is in hung state  LIKE  blank screen ,that  means server got hung.

>> Then the  only way is you need to reboot the sever. reboot will fix the issue.

How To Differentiate b/w Files and Directories ?



[root@localhost linuxtechnotes]# ls -lrt
total 24
-rw-rw-r--. 1 linuxtechnotes linuxtechnotes    0 Dec 19 21:38 linuxtechnotes
-rw-rw-r--. 1 linuxtechnotes linuxtechnotes    0 Dec 19 21:43 linux1
-rw-rw-r--. 1 linuxtechnotes linuxtechnotes    0 Dec 19 21:43 linux3
-rw-rw-r--. 1 linuxtechnotes linuxtechnotes    0 Dec 19 21:43 linux2
-rw-rw-r--. 1 linuxtechnotes linuxtechnotes   37 Dec 19 21:45 file1
-rw-rw-r--. 1 linuxtechnotes linuxtechnotes   52 Dec 19 21:47 file2
-rw-r--r--. 1 linuxtechnotes linuxtechnotes   19 Dec 21 19:28 redhat
drwxr-xr-x. 2 linuxtechnotes linuxtechnotes 4096 Dec 21 21:44 tech
drwxr-xr-x. 3 linuxtechnotes linuxtechnotes 4096 Dec 21 21:44 data
drwxr-xr-x. 2 linuxtechnotes linuxtechnotes 4096 Dec 21 21:50 linuxtechnote
[root@localhost linuxtechnotes]#




From the above list you can see files  start with  'd' means  DIRECTORY
                                                 '-' means  FILE

So from the above example  tech,data,linuxtechnote .... are directories  and linux1,linux2,linux3 and linuxtechnotes are files .


TO CHECK FILE PERMISSOINS USE ls -l or ls -ld
TO CHECK DIRECTORY PERMISSONS USE ls -ld  << you cant check direcotry permissons with ls -l >>



HOW TO KNOW SERVER IS PHYSICAL OR VMWARE ?


If you see out put as VMware virtual - it means virtual server

If you see output as Proliant BL*** - it means physical server

Below are the commands with examples

#dmidecode -s system-name-product
or
#dmidecode | grep -i product

examples:-
1)if its physical
# dmidecode -s system-product-name
ProLiant BL******
or
#dmidecode | grep -i product
  Product Name: ProLiant BL***
  String 2: Product ID: 1*****

2) IF its virtual server

#dmidecode -s system-product-name
VMware Virtual Platform

or
#dmidecode | grep -i product
  Product Name: VMware Virtual Platform
  Product Name: *****

HOW TO CAPTURE TCP DUMPS

>> using tcpdump you can capture all the interfaces
#tcpdump

>> if you wanna capture perticular interface

#ifconfig     << to check interfacess>>
# tcpdump -i eth0   <<give whatever interface you wanna capture eth0 or eth1......>>

using only tcpdump command you need to hit cancel. So if you usr "-c " option then it will take howmany packets you mentioned.
example
#tcpdump -c 20    << it will capture only 20 packets only>>

>> if you wanna capture 20 packets on interface eth0
#tcpdump -c 20 -i eth0

>> if you wanna capture 20 packets on eth0 interface with saved file on /tmp then you can use below command

# tcpdump -w /tmp/dump.pcap -c 20 -i eth0

-w for save on /tmp/  with dump.pcap file

-c for capture 20 packets

-i for capture on eth0 interface

here other things you need to remember if you have to view the captured file either you need wireshark tool or from command line using "r" option you can. see for example below

# cat dump.pcap    <<< you cant understand anything>>>
#tcpdump -r dump.pcap  << you can see now clearly>>


if you want capture for perticular interface and port

# tcpdump -i eth0 port 22

HOW TO GIVE SUDO ACCESS TO USER RUN TCPDUMP

make a backup of /etc/sudoers file

cp /etc/sudoers /tmp/sudoers.date

Then edit the /etc/sudoers file  here we can edit in 2 ways

1:- vi sudoers
or
2:- visudo

visudo is the recomandded to edit the sudoers file
here you go

# visudo
add below enterie  ( " suppose you need to give sudo access to ramesh" ) here what you need to add

ramesh ALL=(root) NOPASSWD: /usr/sbin/tcpdump

:wq!

Now user can run tcpdumps using below command

#sudo tcpdump**********************

HOW TO GIVE SUDO ROOT ACCESS TO USER


make a backup of /etc/sudoers file

cp /etc/sudoers /tmp/sudoers.date

Then edit the /etc/sudoers file  here we can edit in 2 ways

1:- vi /etc/sudoers
or
2:- visudo

visudo is the recomandded to edit the sudoers file
here you go

# visudo
add below enterie  ( " suppose you need to give sudo access to ramesh" ) here what you need to add

ramesh ALL=(root) NOPASSWD: ALL

:wq!

to get root access login with your user id then do

#sudo su -

will get root access

HOW TO CHECK/CHANGE FILE PERMISSIONS AND OWNERSHIP


Suppose you need to check /data Directory permissions

#ls -ld <dirname>

If you need to change owner and group    << for example you need to set linuxtechnotes as both owner and  group>>

#chown  linuxtechnotes:linuxtechnotes  /data


What if you want just change user permissions  to kishore ?



What if you want just change group permissoins to sai ?


What if you want change owner and group to linuxtechnotes to /data and all files under /data aswell ?


HOW TO CREATE A DIRECTORY


Syntax:-  mkdir <dirname>
example  #mkdir tech

Here another thing you need to know that is, if you need to create Directory including sub-directory then you need to use -p

#mkdir -p <dirname/subdirname>
example :- mkdir -p data/storage




VI EDITOR BASIC COMMANDS



Vim is a text editor that is upwards compatible to Vi.  It can be used to edit all kinds of plain text.  It is especially useful for editing programs.


"vi" to edit the file

"i" for insert mode

"esc" for back to normal mode

":q!" for quit the file with out saving the edited data

"shift+g" to go last line

"shift+a" to go to end of the line

"dd" to delete the entire line

"u" for undo

"yy/cursor right click" for paste

"left click on content" for copy

":wq!" for save and quit the file

" :set number " to set up the serial number for lines "

" :set nonu " to remove the serial number"

"o" to go fresh down line with insert mode

"O" to go fresh up line with insert mode

"j" down arrow

"l" right arrow

"h" left arrow

"k" up arrow



BASIC COMMANDS SHOULD LEARN AS UNIX/LINUX ADMIN


ls : list the files
touch :- to create the file system.

cat :- to view the content of the file

vi :- to edit/add the content in file.

for examples

Below you can see how you can list the files,create file "redhat" and add content  as "this is redhat file " and how can you cat redhat file.






Please see below for some more ls commands with examples  :-

ls List the  Files / directories 
ls –a List All files and directories including hidden Files 
ls -l List All information about files/directories
ls –ld List Directory Information 
ls -lt List Last Modified Time Using 
ls –r List files with reverse order
ls –ltr Order Files Based on Last Modified Time (In Reverse Order) Using
ls –R List  Files Recursively Using 
ls –lh List  files in KB, MB, etc
ls –m LIst  files with comma separation
ls –i Display File inode Number Using 
ls –q Hide Control Characters Using
ls –n Display File UID and GID Using 







You may want to know

how to differentiate b/w file and Directory ?

Tuesday, October 6, 2015

rsync warning: some files vanished before they could be transferred (code 24) at main.c(1039) [sender=3.0.6]

Does it really a issue in server/ rsync command which you used ?

Nope. Their is nothing to worry about the server/command rsync syntax which you used .

First lets understand on how rsync works ?

when ever we send rsync job  to copy a some set of files first it will catch up all the available cache and will start do copy process . So above error could be cause  that when we ran rsync command these files were available in cache but when its trying to copy them those are not available in server. so you can check that these files must not be available in source path. which must deleted by a application like any automation jobs which they usually do or some user might  have deleted as he suspected those are no longer needed .

To make it simple their is nothing wrong with rsync syntax. its simply warning saying this file was not available now in source path .