Linux
Steps followed to troubleshoot NFS4
Below are few commands which are frequently used to troubleshoot NFS or io troubleshooting
check port 2049 and 111
# nmap -p 2049 <nfs_server_ip> -Pn
# nc -vz <nfs_server_ip> 2049
# nfsiostat /techbluff
# nfsstat -m
To get nfsstats of directory and cache every 10 seconds
# nfsiostat 10 -d
..
Change in grub values
First copy grub file before making changes
# cp /etc/default/grub /etc/default/grub-`date +%FT%H%M`
Now do required changes in /etc/default/grub
# vim /etc/default/grub
For Example
GRUB_TIMEOUT = 40
After making changes compile grub using grub2-mkconfig
# grub2-mkconfig /boot/grub2/grub.cfg
# date
Sun Mar 19 15:39:28 XXX 2023
# touch te-`date +%FT%H%M`
# -rw-r--r-- ..
How to clean sss clean cache
Search ldap users using below commands
# ldapsearch -x -LL uid="<username>"
# getent passwd <username>
Try to ping or reach the ldap servers(url) which are configured in /etc/ldap.conf
# nc -vzw2 ldapserver.techldapuserrs.com 389
Check if ports are open using nmap
# nmap -p 389 ldapserver.techldapuserrs.com -PN
Do TCP check with traceroute
# traceroute ..
Find physical cable connection to Network slot
There are various tools to find the network cable link of network card connected to a server, however in linux all are files and the connection status can also able be determined by simple cat command. /sys/class which say more
# ls -l /sys/class/net/
lrwxrwxrwx 1 root root 0 Aug 11 ..
Leave last few lines and delete all
How do I delete a huge file except last n lines of a file?
vi editor has a feature called "ex", By using it you can delete all lines of a file except n lines from a file
Create a file with n lines
# for i in $(seq 1 2500); do ..
Using nscd command to flush dns cache
The nscd caches are saved to disk on RedHat system, they are located in /var/db/nscd
# ls /var/db/nscd/
group hosts netgroup passwd services
When you stop or restart nscd these files just stay there and restarting really wont clear or flush your ..
Covert Kilobytes to Megabytes or gigabytes of disk
To find the disk size
# fdisk -s /dev/sdb
62914560
In the above command the disk space will be printed in KB. But I had the requirement to print the values in MB or GB for multiple servers.
To print diskspace in Megabytes or MB
# echo ..
Covert Kilobytes to Megabytes or gigabytes through terminal
When I tried to run size of my memory, I executed below command and found the result in KB
# grep 'MemTotal' /proc/meminfo
I can also run free -m or free -g to read the output in MB or GB. But when I have list of values in ..
Running rhq agent as a Daemon or init.d Service
Normally the agent should be started as a background daemon process. On Windows, this runs as a service. On Linux and Unix
systems, the agent starts at boot time from init.d
Register rhq-agent-wrapper.sh with chkconfig.
# /sbin/chkconfig --add rhq-agent-wrapper.sh
Enable the agent service to run at boot time and have it ..
Change ownership for symbolic link
The chown command changes the user ID and/or the group ID of the specified files. Symbolic links named by arguments are silently left unchanged unless -h is used.
Changing the owner of a symbolic link needs special attention. When you use chown the regular way to change the owner of a ..
Installing Ansible Playbook
Great things about Ansible is that you dont need to install an Ansible client on the servers you are managing. You only need to install Ansible on your local machine or on a master server that can connect to the managed servers via SSH. Ansible works by configuring client machines ..
Format disk using dd command
When you want to clean the disk or format the disk dd command will be very handy to use it.
Format disk using dd command
# dd if=/dev/zero of=/dev/sdb
# dd if=/dev/null of=/dev/sdd bs=4096 count=1
This command will clean or wipe the data of your existing disk. Use this command ..
Mount partition with ntfs file system and read write access
Today when I want to mount my external harddisk I felt uneasy since my Redhat linux does not support nfts partiton. NTFS3G is an open source cross-platform, stable, GPL licensed, POSIX, NTFS R/W driver used in Linux. It provides safe handling of Windows NTFS file systems. To proceed with mounting ..
Yum only download not to install
How to yum download a package without installing?
Install downloadonly plugin for download option
# yum install yum-utils
# yum install yum-plugin-downloadonly
How to yum download a package?
# yum install --downloadonly --downloaddir=<directory> <package>
Example:
# yum install --downloadonly --downloaddir=./ kmod-VirtualBox-3.19.5-200.fc21.x86_64.x86_64
To download already installed packages
# yumdownloader <package>
..
How to find block size of partition
How do I find block size of an partition on Linux?
# tune2fs -l /dev/sda1 | grep -i 'block size'
Block size: 1024
How do I find block size of a filesystem on Linux?
# ..