Saturday, 30 September 2017

// // Leave a Comment

XFS Filesystem has duplicate UUID problem


XFS Filesystem has duplicate UUID problem


If you are unable to mount XFS filesystem with classical wrong fs type, bad superblock etc. error and you see the following message in kernel logs (dmesg) :

XFS: Filesystem sdb6 has duplicate UUID - can't mount. you can still mount the filesystem with nouuid options as below:mount -o nouuid /dev/sdb6 disk-6

But on every mount, you have to provide nouuid option. So, for exact solution you have to generate a new UUID for this partition with xfs_admin utility:

xfs_admin -U generate /dev/sdb6
Clearing log and setting UUID writing all SBs new UUID = 01fbb5f2-1ee0-4cce-94fc-024efb3cd3a4

after this, you can mount this XFS partition regularly.
Read More

Wednesday, 27 September 2017

// // Leave a Comment

com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting to connect

com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting to connect


This error could be due to multiple reason. You can debug it by trying the following ways:

  1. Check if mongod is running
    check if the mongo process is actually running or not using "ps aux | grep mongo" or "sudo service mongod status". If the process isn't running start it.
  2. Check on which port the process is running.
    run command "sudo netstat -tlupn" and check its running on which port. Generally the port is 27017 but it could be some other port as well and you might be connecting to wrong port from application/client.
  3. Try doing a "telnet" to mongo from the application server or the client if you are able to connect to mongo shell.
    "sudo telnet <mongo-server-ip> port" == "telnet 192.168.1.2 27017"
  4. Check if mongo process is bind to which IP. Is it bind to 0.0.0.0 (anywhere) or to 127.0.0.1 (localhost).
    "sudo netstat -tlupn | grep 27017"
  5. There could be a possibility if you have started a mongo server from the data of a replicaset and your standalone replicaset hasn't been initialised, in this case as well you will get this error.
    In that case you can delete local db and initiate the replicaset to make it standalone primary.
    >use local
    > db.dropDatabase();
    { "dropped" : "local", "ok" : 1 }
    > rs.initiate()
    >myrepl:PRMIARY
Read More
// // Leave a Comment

How To Reset "root" User Password In MySQL

If you have forgotten root user password then don't worry, you can still reset it and get your data. Below gist have the minimal steps to recover/reset "root" user password:




Read More

Saturday, 26 August 2017

// // 2 comments

User Management In Linux


Read More

Thursday, 8 June 2017

// // 1 comment

Tab Completion Is Not Working In "oh-my-zsh" theme

Tab Suggestions are not working in oh-my-zsh theme


After installing oh-my-zsh theme, sometimes Tab completion do not works. If this is the case with you, follow the below steps:

  1. First open the oh-my-zsh.sh file in editor.
    vim ~/.oh-my-zsh/oh-my-zsh.sh
  2. Now find the 14th line in this file with below content:
    :${ZSH_DISABLE_COMPFIX:=true}
  3. Change the value to false from true, like below and save the file.
    :${ZSH_DISABLE_COMPFIX:=false}
  4. Now execute below command:
    source ~/.zshrc
  5. Restart your terminal, you must seen some directories that are not secure. Secure them using below command:
    sudo chmod 755 <insecure_directory_name>
  6. Again open the oh-my-zsh.sh file, and turn the value to true from false and save the file.
    :${ZSH_DISABLE_COMPFIX:=true}
  7. execute below command again:
    source ~/.zshrc
Now, your problem is solved. Tab suggestions are working normal.

If after logout from zsh and again login into it, causes the same problem then keep the value false only in 14th line of oh-my-zsh.sh and source the .zshrc file. Your problem will be solved permanently.
Read More

Tuesday, 6 June 2017

// // Leave a Comment

The filesystem is already 78642683 (4k) blocks long. Nothing to do! | resize2fs

Error | The filesystem is already 78642683 (4k) blocks long. Nothing to do!


If you are getting this error while running resize2fs command in linux for ext4 volume, run growpart command and then run resize2fs command as shown below:


sudo growpart /dev/xvda 1
sudo resize2fs /dev/xvda1

Read More

Monday, 5 June 2017

// // Leave a Comment

aws cli Command To list Instances With Particular Tag

Command To list AWS Instances With Particular Tag

AWS CLI Command To List Instance Having Particular Tag


AWS CLI provides to list instances on the basis of various filters and you can get specific details about the instances based on those filters. If you haven't setup aws-cli, here is a tutorial to install and configure aws-cli.
Below is the command to list only instance-id of all the instances having a Tag "Monitor" with value "True".

aws ec2 describe-instances --filters Name=tag:Monitor,Values=True --query 
'Reservations[].Instances[].[InstanceId]' --output text

Here we are only listing the Instance-Id, But you may also list other information like Private IP address as shown below:

aws ec2 describe-instances --filters Name=tag:Monitor,Values=True --query 
'Reservations[].Instances[].[InstanceId,PrivateIpAddress]' --output text

We have also specified output to be in text format, which will display two columnar data, one column for InstanceId and other for PrivateIpAddress. If you don't want columnar type output want the output then just remove the "--output text" from the command:


aws ec2 describe-instances --filters Name=tag:Monitor,Values=True --query 
'Reservations[].Instances[].[InstanceId,PrivateIpAddress]'

Read More