Posts

Attach disk volume in Azure on CentOS VM

  # lsblk -o NAME,HCTL,SIZE,MOUNTPOINT | grep -i "sd" sd a     2:0:0:0       30G   |- sd a1               1M   `- sd a2               30G / sd b     3:0:1:0       80G   `- sd b1               80G /mnt/resource sd c     5:0:0:0     512G   If you are attaching a new disk, you need to partition the disk: The parted utility can be used to partition and to format a data disk. The following example uses parted on /dev/sdc, which is where the first data disk will typically be on most VMs. Replace sdc with the correct option for your disk. We are also formatting it using the xfs filesystem. # parted /dev/sdc --script mklabel gpt mkpart xfspart xfs 0% 100% # mkfs.xfs /dev/sdc # partprobe /dev/sdc The above partprobe command will make sure the kernel is aware of the new partition and filesystem. Failure to use partprobe can cause the blkid or lslbk commands to not return the UUID for the new filesystem immediately. Use mount to then mount the filesystem: # mkdir /datadrive # mount /dev

Find out the open ports in an instance

  Below command will list out ports which are already defined in the linux machine: $ semanage port -l | grep http_port_t http_port_t                    tcp      80, 81, 443, 488, 8008, 8009, 8443, 9000 pegasus_http_port_t            tcp      5988 If you wish to add a new port to the list, run the below command: $ semanage port -l | grep http_port_t -p tcp 7001 http_port_t                    tcp      7001, 80, 81, 443, 488, 8008, 8009, 8443, 9000 pegasus_http_port_t            tcp      5988 Check if firewall rules are enabled: $ service iptables status Table: filter Chain INPUT (policy ACCEPT) num  target     prot opt source               destination 1    DROP       tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:80 2    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:80 Chain FORWARD (policy ACCEPT) num  target     prot opt source               destination Chain OUTPUT (policy ACCEPT) num  target     prot opt source               destination If you wish

Expand Boot volume on / partition in OCI

By default, only 38gb is assigned to / partition in Oracle cloud Instance, though boot volume can be assigned to bigger volume at the time of instance creation.   To get the all assigned volume on / partition, you need to install growpart and extend the partition using below commands: # sudo yum -y install cloud-utils-growpart gdisk # sudo growpart /dev/sda 3 # lsblk You need to reboot the instance to take this effect on the instance.

Packet loss or dropping Internet connection

The  Maximum Transmission Unit   (MTU)  feature is an advanced configuration that allows you to determine the largest data size permitted on your connection.  Generally, if your MTU is too large for the connection, your computer will experience packet loss, RDP issue or dropping Internet connection. To determine the correct MTU size for your network, you’ll have to do a specific ping test on the destination you’re trying to go to like using another computer or a web address. Once you get the correct MTU value, you can change it on your server using the below steps: On Windows: C:\Windows\system32> netsh netsh> interface ipv4 netsh interface ipv4> show subinterface    MTU  MediaSenseState   Bytes In  Bytes Out  Interface ------  ---------------  ---------  ---------  ------------- 4123495            1          0      81224  Loopback Pseudo-Interface 1   1500                1  11252355840  6937787731  Local Area Connection 7 netsh interface ipv4> set subin

Errors with Shinken application

Error:   Poller is dead but pid file exist Reason 1: Poller is not able to write in log file /var/log/shinken/pollerd.log Solution:    - Remove /var/run/shinken/pollerd.pid                     - Change permission for /var/log/shinken/pollerd.log                       i.e. chmod 775 /var/log/shinken/pollerd.log                     - Restart shinken shinken ,celery and uwsgi. Reason 2: Sometime poller is not able to access localhost:port Solution:    - Replace local with 127.0.0.1 in poller-master.cfg                     - Restart shinken shinken ,celery and uwsgi. Error:  Broker is dead but pid file exist Reason:  Broker is dead but still port is used by broker in somewhere in background Solution:     - Search process which is using port 7772                         i.e. lsof -n -i :7772 | grep LISTEN                      - Kill the process.

SVN: File remains in conflict

This error occurs when you didn't update the SVN and try to commit changes or, someone has made changes to this file that are conflicting with your changes. There are two ways to handle this situation. Either, you can revert back the changes you want to commit and then, update the SVN and after that make the changes again and commit. The other way is, you need to resolve the conflicted files one by one. You can keep all the conflicted files in a folder and resolved it at once. >> Revert the changes steps: svn revert . -R svn up >> Resolve the conflicted files: svn resolved <file_name>

Unable to Connect to SSL Services due to PKIX Path Building Failed

Symptom: Connection is refused when attempted to access applications that are encrypted with SSL. Error: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Diagnosis: Use SSLPoke to verify the connectivity (you will have to download SSLPoke.class using the following link: https://confluence.atlassian.com/kb/files/779355358/779355357/1/1441897666313/SSLPoke.class) # /apps/java/latest/bin/java -classpath /apps/java/latest SSLPoke <hostname> <Port> # /apps/java/latest/bin/java -classpath /apps/java/latest -Djavax.net.ssl.trustStore=/apps/java/latest/lib/security/cacerts SSLPoke <hostname> <Port> # curl -X POST -d @Test.xml https://<endpoint url> -H "Content-Type:application/xml" **add some xml code in Test.xml If the above command is showing "Successfully

Hung Puppet process on Linux

Kill Hung Puppet process . kill -9 `ps -ef |grep "puppet agent: applying configurat" |grep -ve grep |awk '{print $2}'` /etc/init.d/puppet restart ps -ef |grep -i puppet | grep -v grep

What is IP: 0.0.0.0

In the context of a route entry, it usually means the default route. In the context of servers, 0.0.0.0 means all IPv4 addresses on the local machine. If a host has two IP addresses, 192.168.1.1 and 10.1.2.1, and a server running on the host listens on 0.0.0.0, it will be reachable at both of those IPs.

Linux based file systems become read-only

On a Linux server, when it loses connectivity to underlying storage (even briefly), the server doesn’t typically crash. It keeps running, but switches all the storage to read-only. Most of the OS and applications are running in RAM, so you don’t necessarily see any issues right away. The main issue we see is the OS and applications hold things in the disk-write queues. When you force the reboot after the storage outage, the kernel gets out-of-whack because that disk queue couldn’t clear properly and now doesn’t match the disks. So, we have to reboot and log in with root password under maintenance mode and force a disk check on the root and app file-systems. Once that is done, the host comes back online without issue.