Linux Real Time Scenarios and issues with their solutions

Scenario:1 On one of my Production SuSE Linux (VMware Virtual Server ) , Storage team has extended partition (RDM disk ) from their end. Now how to rescan that partition and extend without rebooting from the Linux ?

Solution : In My case 8th disk on Controller-1 was extended by the Storage Team.So first rescan it. Using the below Command :

[root@linuxtechi ~]# echo 1 > /sys/class/scsi_device/device/rescan

In the above command replace the device info according to your setup.

[root@linuxtechi ~]# echo "1" > /sys/class/scsi_device/0\:0\:8\:0/device/rescan

Now resize the PV using the pvresize Command.

[root@linuxtechi ~]# pvresize /dev/dm-7

Check the size of Volume Group using vgs command and it should display the new extended size. Using lvextend command we can now easily extend or increase the size of lvm partition.

Scenario:2 On one of my Linux Server, Oracle database was not running because of tmpfs . Oracle Team wants to extend the tmfs file system size from 2 GB to 4GB.

Solution: tmpfs is a RAM based temporary file system which is generally mounted on /dev/shm. To to extend the tmfs file system use below steps :

Step:1 Check tmfs file system size.

[root@linuxtechi ~]# df -h /dev/shm/
Filesystem Size Used Avail Use% Mounted on
tmpfs      2.0G 148K 2.0G   1% /dev/shm
[root@linuxtechi ~]#

Step:2 Edit the /etc/fstab file.

Change the size as shown below :

tmpfs /dev/shm tmpfs size=4g 0 0

Step:3 remount the file system using mount command

[root@linuxtechi ~]# mount -o remount tmpfs

Step:4 Now check the tmfs file system

[root@linuxtechi ~]# df -h /dev/shm/
 Filesystem Size Used Avail Use% Mounted on
 tmpfs       4.0G 148K 4.0G  1% /dev/shm
[root@linuxtechi ~]#

Scenario:3 How to check which disks are used for Oracle ASM in Linux ?

Solution : To display the Oracle ASM disk, use below command :

root@linuxtechi:~# oracleasm listdisks

To Query a particular disk, use below command

root@linuxtechi:~# oracleasm querydisk -d /dev/sdq1

Scenario:4 In one of my Linux box , NAS share was mounted on the directory under /archive2015. Space of the NAS share was 150 GB and used size is 137 GB but when we try to create any file or directory we were getting “Disk Quota Exceed” error.

Solution: As it was NAS file system so from the OS perspective we can’t set quota on this. So in my case i contact to Storage team , ask them to check quota limit ( soft quota & Hard quota ). From the Storage Team we got the confirmation that quota limit is set ( Soft quota = 85 % & Hard Quota = 100 % ) and Grace period of 7 Days is also set.

So in our case soft quota limit was reached and no one has reduce the space utilization for 7 Days, so on 8th day Soft Quota limit becomes Hard Quota that’s why we are getting Disk Quota exceed error.

Scenario:5 For same file system df and du command shows different disk usage.

Solution: This could be because of open file deletion, i.e when someone delete a log file that is being used or open by other process if we try to delete this file then file name will be deleted buts it’s inode and data will not be deleted.

with the help “lsof” command we can determine the deleted files of /var that are still open :

$ lsof /var | egrep "^COMMAND|deleted"

So to release the space , we can kill the command with its PID using kill command.

Scenario:6 While installing VMware tools on Suse Linux Servers if you get below errors

Can't locate object method "milestone" via package "Bootloader::Library" at /sbin/update-bootloader line 214.
There was an error generating the initrd (255)
ERROR: "/sbin/mkinitrd -k vmlinuz-3.0.101-0.29-default -i
initrd-3.0.101-0.29-default" exited with non-zero status.

Your system currently may not have a functioning init image and may not boot
properly. DO NOT REBOOT! Please ensure that you have enough free space
available in your /boot directory and run this configuration script again.

Execution aborted.

Solution :

#  zypper install perl-Bootloader

And then try to install vmware tools using script and hope installation will be completed.

Scenario:7 How to sync  the entire Directory Structure from Source to  remote Destination Directory?

Solution : # Using rsync command we can sync the entire directory structure from source to destination.

# rsync -a -f”+ */” -f”- *” /<Source-Directory>   root@<Server_Name>:/<Destination_Directory>

Scenario:8 How to Change  default Docker Root Directory on CentOS 7 / RHEL 7?

Solution: Edit the file “/usr/lib/systemd/system/docker.service” and add the following line

ExecStart=/usr/bin/dockerd -g /storage/docker --storage-driver=overlay

Specify the folder path after -g option , in my case i putting as  ‘/storage/docker’

Reload daemon and restart docker service

# systemctl daemon-reload
# systemctl restart docker

Verify docker root directory with ‘docker info’ command

# docker info

Scenario:9 How to find how many CPU core are used by a process in Linux server?

Solution: In Linux like systems we have a command line tool called “taskset“, which can print the cpu cores associated to particular process,

Syntax: # taskset -c -p <pid_number>

~# taskset -c -p 23431
pid 23431's current affinity list: 0-23
~#

Kindly share your real time scenarios and issues with their solution at [email protected]

8 thoughts on “Linux Real Time Scenarios and issues with their solutions”

Leave a Comment