Monday, December 9, 2019

How to Delete million of file in certain directory

How to Delete million of file in certain directory.

When administrator get request for deleting files which having large number, then simple "rm" command will not work. Solution to this problem is following command.

find . -type f -name "*.bak" -exec rm -i {} \;

Above command will find files with ".bak" extension and will delete them. IF administrator want to specify any specific path then he also specify that path like below.

find /backup -type f -name "*.bak" -exec rm -i {} \;

Thursday, July 25, 2019

How to change timezone from CEST to UTC on SUSE Linux Enterprise Server

Some time Linux admin need to configure timezone for Linux host,reason may requirement from application or database team or sometime wrong timezone configuration by Linux admin.

So, Lets see how to configure timezone from CEST to UTC.


Step 1: Before changing timezone please note previous timezone details by using following command.

root@linuxhost:/root : date
Thu Jul 18 16:30:38 CEST 2019

root@linuxhost:/root : cd /etc
root@sedcacoi0060:/etc : ls -lrt /etc/localtime
lrwxrwxrwx 1 root root        33 Jul  3 08:57 localtime -> /usr/share/zoneinfo/Europe/Berlin

Step2 :

Now here we need to change time zone to UTC. Before changing this setting first note previous setting in notepad file.

Step 3:

Excute following command to change timezone to UTC.

#rm /etc/localtime
#ln -sf /usr/share/zoneinfo/UTC /etc/localtime

Step 4:

Confirm change is done or not by using following command.
#ls -lrt /etc/localtime
lrwxrwxrwx 1 root root 23 May  6 12:05 /etc/localtime -> /usr/share/zoneinfo/UTC

Also using date command admin can confirm that timezone changed from CEST to UTC.


Thu Jul 18 02:40:24 UTC 2019

Thanks !!!

Tuesday, July 23, 2019

auto mount issue on AIX hacmp cluster

Hello everyone ,

Today i am discussing on issue which i faced while umounting nfs mount on AIX hacmp node .on aix hacmp node netapp filer was mounted and we received request to umount that nfs mount permanently.

We executed "#umount"  command to perform this ticket and updated to responsible team, but after some time found that mount point auto mounting. we thought that somebody has mounted and did umount again, but that mount point mounting again.

so we decided to check configuration file /etc/ on AIX cluster node and found that there is entry for that mount point.

/etc/ entry:

/share/data -bg,intr,soft,rw  nfsServername:/vol/xxxxx_cifs_nfs_vol017/share_data

After comment

#/share/data -bg,intr,soft,rw  nfsServername:/vol/xxxxx_cifs_nfs_vol017/share_data

To sort out auto mount issue we commented nfs mount entry in /etc/ and then umounted /share/data.

***always take backup of configuration file before editing.

Thanks !!!!!!!!!!!

umount AIX nfs mount point by removing entry in /etc/filesystems

Sometime while umounting nfs mount point, AIX admin also need to remove entry in /etc/filesystems. Let see how we can do this using 2 different method.

1. Using rmnfsmnt command.
2. Using umount command and then remove entry manually from /etc/filesystems.

In first method we need to execute following command

Lets assume that nfs mount point name is "/nfs_aix", so command is like

#rmnfsmnt -f /nfs_aix -B

-f  specify mount point name
-B Remove /etc/filesystems entry for mentioned mount point.

Second method is like below

1. umount /nfs_aix
2. Take backup of /etc/filesystems
3. find nfs mount point entry /nfs_aix  in /etc/filesystems and remove that entry.
4.confirm whether entry removed from configuration file .

Thanks !!!

Tuesday, June 4, 2019

umask value modification on specific user account for Linux-unix server

While doing user administration we received one request for permanent umask value change.

First understand what is umask and what exactly this value do if admin create file or directory on UNIX and Linux system.

Answer: umask value determines final permission value for directory and file, which admin create.
so by changing this value admin can customize these permission according to security requirement.
default value of umask is 022.

How Directory and file  how umask calculated ?

Directory:  777-022 = 755    Final permission for directory after umask subtract.
File:           666-022 = 644     Final permission for File after umask subtract.

.Lets see what is the scenario............


For user oracle change umask value from 022 to 002.

Solution : answer to this request is simply edit .profile using vi editor and add line umask 0002 and save file. After saving file log out and log in to user account to make these changes effective or reload .profile using any one below mentioned command.

Reload .profile using using any one command from following list.

1. oracle#/home/oracle: . $HOME/.profile . .profile

After reload of .profile if admin execute "umask" command he will see changed umask value from 022 to 002. This method is useful in situation where this value need to persistent.


Wednesday, March 13, 2019

How to configure and change SMTP server on AIX

Hello everyone, todays I am going to share how AIX admin can modify existing SMTP server configuration.
When AIX admin do AIX LPAR migration from one DATA Center to other and after migration SMTP mail server will be different. So this different mail server need to be changed in   ""  file else mail alert for application will not generated or it will stuck. 

For AIX LPAR we did migration and after migration, we did post check and handover to development/application team, but after handover, they complaining that they not receiving mail alert on their team mail ID from migrated AIX after doing analysis we found that mail server configuration missed and that need to be corrected. After replacing Mail Server with correct name, everything worked fine and team receiving mail.

Steps, which we followed for SMPT server change
Step1 : vi /etc/ -> /etc/mail/   // in /etc you will find this file

Step 2: Find word “smart relay” in this configuration file like below    //old SMTP server

Replace old SMTP name with suitable new SMTP server which suits current environment after AIX LPAR migration    //new SMTP server

Step 3:
Stop sendmail service  and start it using following commands.
#stopsrc -s sendmail
# startsrc -s sendmail -a "-bd -q30m"

-bd   Start sendmail process at background as daemon.
-q30m   process mail queue every 30 minutes.


Tuesday, March 12, 2019

mount.nfs Remote I/O error

Yesterday when i exported /aix/share  from AIX 7.1 to Linux client with NFS version 3 and when tried to mount on SUSE Linux 12 client with following command got error “mount.NFS: Remote I/O error”
root# mount aixNFSserver:/aix/share /linux/share
“mount.NFS: Remote I/O error”

First, I did not got why this error occurred, because everything was ok from NFS server side. Permission, client hostname entry in /etc/exports file on NFS server was correct. Then i thought that it is looking like I/O error for file system, which I exported, but on NFS server, shared file system is ok and not showing any error related I/O. After I checked that what is default NFS version for SUSE Linux 12 and found that it is NFS version 4 and observed that there are some mount option was used for mounting AIX NFS share to SUSE Linux.

Observation found:
Source NFS server:  AIX 7.1
Version: NFS V3.
Target Linux client: SUSE Linux 12.
Default NFS Version: NFS Version 4.
Found /etc/fstab entry for NFS mount with following option for other mount which already mounted from AIX to Linux.

aixNFSserver2:/aix/soft /linux/soft nfs     defaults,nfsvers=3,rw,intr 0 0

After this observation, I did entry for /aix/share like below and executed mount command and guess what it was successful

aixNFSserver:/aix/share /linux/share nfs    defaults,nfsvers=3,rw,intr 0 0

Option and their meaning
intr : Allows NFS requests to be interrupted if the server goes down or cannot be reached.
nfsvers= option specifies which version of nfs protocol should use, If admin not choose any version NFS will use highest supported version

What was the reason that causing previously mount failure with error “mount.NFS: Remote I/O error” ??

Previously we did not specified NFS version while mounting share we directly executing mount command like below.

root# mount aixNFSserver:/aix/share /linux/share

 And we didn’t specified mount option “nfsvers=3” because default NFS version of SUSE 12 is NFSv4 and exported NFS version from AIX NFS server is NFSv3. While mounting we didn’t mention any NFS version so at Linux side NFS chossed highest supported NFS version and that was NFS v4 and this causing Remote I/O error while mounting.

Also we can specify mount option while executing mount command. In below example shown how to specify mount option while mounting NFS share from AIX to Suse Linux to avoid error "mount.NFS: Remote I/O error"

#mount –t nfs aixNFSserver:/aix/share /linux/share –o nfsvers=3


First make entry in /etc/fstab like below and then execute command #mount –a.
aixNFSserver:/aix/share /linux/share nfs    defaults,nfsvers=3,rw,intr 0 0

Finally we conclude that if we specify correct nfs version while mounting NFS share we can avoid error mount.NFS: Remote I/O error.

Thanks !!!!!