Category Archives: Operating Systems

Operating Systems general commands and issue fixes cover in Linux , Windows, Solaris, Unix , HP-UX etc.

Map EBS Storage with Linux EC2 instance in AWS

Map EBS Storage with Linux EC2 instance in AWS

In this blog, we are going to configure the EBS Storage to the redhat linux EC2 instance in Amazon web services.

Following are the steps

1. Create an EC2 instance of Redhat linux from AWS Console.

2. Create addition volume of EBS storage from AWS Console.

3. Attach the EC2 instance with EBS volume from EBS tab by right click on EBS Storage which is created in step 2.
Note: Both EC2 instance and EBS volume should be in same availability zone.

4. Open the putty session with private key.

5. Now first step is to check the disk present as shown below before attached the new EBS volume in step 3

-- command executed before step 3 it show only one volume
[ec2-user@ip-172-31-7-21 ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 10G 0 disk
├─xvda1 202:1 0 1M 0 part
└─xvda2 202:2 0 10G 0 part /

6. After step 3 executed, command show the volume is attached

[ec2-user@ip-172-31-7-21 ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 10G 0 disk
├─xvda1 202:1 0 1M 0 part
└─xvda2 202:2 0 10G 0 part /
xvdf 202:80 0 1G 0 disk

7. Switch to root user

sudo su -

8. Check the file system type which need to be formatted and already existed/used by Linux system

[root@ip-172-31-7-21 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 10G 0 disk
├─xvda1 202:1 0 1M 0 part
└─xvda2 202:2 0 10G 0 part /
xvdf 202:80 0 1G 0 disk
[root@ip-172-31-7-21 ~]#
[root@ip-172-31-7-21 ~]# file -s /dev/xvda
/dev/xvda: x86 boot sector; partition 1: ID=0xee, active, starthead 0, startsector 1, 20971519 sectors, code offset 0x63
[root@ip-172-31-7-21 ~]#
[root@ip-172-31-7-21 ~]# file -s /dev/xvda1
/dev/xvda1: data
[root@ip-172-31-7-21 ~]# file -s /dev/xvda2
/dev/xvda2: SGI XFS filesystem data (blksz 4096, inosz 512, v2 dirs)
[root@ip-172-31-7-21 ~]#

Note: It show that linux system is using XFS filesystem.

8. Make a file system XFS as shown below example:

[root@ip-172-31-7-21 data1]# mkfs.xfs /dev/xvdf
meta-data=/dev/xvdf isize=512 agcount=4, agsize=65536 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=262144, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0

Note: You can make other filesystem also like ext4 of one partition

[root@ip-172-31-7-21 ~]# mkfs -t ext4 /dev/xvdg
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376

Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

9. Mount the device to a new folder

mkdir /data1
mount /dev/xvdf /data1

10. Now check the lsblk command for output

[root@ip-172-31-7-21 data1]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 10G 0 disk
├─xvda1 202:1 0 1M 0 part
└─xvda2 202:2 0 10G 0 part /
xvdf 202:80 0 1G 0 disk /data1

11. You can check with df -Th command for file format:

[root@ip-172-31-7-21 data2]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/xvda2 xfs 10G 925M 9.1G 10% /
devtmpfs devtmpfs 474M 0 474M 0% /dev
tmpfs tmpfs 496M 0 496M 0% /dev/shm
tmpfs tmpfs 496M 13M 483M 3% /run
tmpfs tmpfs 496M 0 496M 0% /sys/fs/cgroup
tmpfs tmpfs 100M 0 100M 0% /run/user/1000
tmpfs tmpfs 100M 0 100M 0% /run/user/0
/dev/xvdf xfs 976M 2.6M 907M 1% /data1

12. For make change permanent add entry in /etc/fstab file.
vi /etc/fstab

# /etc/fstab
# Created by anaconda on Fri Mar 23 17:41:14 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=50a9826b-3a50-44d0-ad12-28f2056e9927 / xfs defaults 0 0
/dev/xvdf /data1 xfs defaults 0 0

13. Check the entry is good

mount -a
Example:
[root@ip-172-31-7-21 data2]# mount -a
[root@ip-172-31-7-21 data2]#

Note: If you type wrong name like /dev/svdf then you got following message
[root@ip-172-31-7-21 data2]# mount -a
mount: special device /dev/svdg does not exist

14. Now your drive is ready to use.

For Unmount the drive

[root@ip-172-31-7-21 data2]# umount /data1
[root@ip-172-31-7-21 data2]#

Advertisements

Taskkill Error Access denied

Taskkill Error Access denied

1. Open the Command prompt window with Administrator right.

First check Command prompt is open with administrator right with right click on it.
(RUN AS ADMINISTRATOR)

2. Check with the process user from which it’s running.

tasklist /V

-- Output in Excel Sheet
tasklist /V /FO CSV > E:\output.csv

Output Sample:
--------------
"oracle.exe","10124","Services","0","404,584 K","Unknown","NT AUTHORITY\SYSTEM","0:18:22","N/A"
"conhost.exe","7716","Services","0","500 K","Unknown","NT AUTHORITY\SYSTEM","0:00:00","N/A"

3. Try to kill it.

C:\Users\e3019447>taskkill /F /PID 10124
ERROR: The process with PID 10124 could not be terminated.
Reason: Access is denied.

C:\Windows\system32>TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /PID 10124
SUCCESS: The process with PID 10124 has been terminated.

OR

TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM oracle.exe

OR

wmic process where name='oracle.exe’ delete

Different Syntax provided by Microsoft to use the Commands:

TASKKILL Commands : TASKKILL /?

TASKKILL /IM notepad.exe
TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
TASKKILL /F /IM cmd.exe /T
TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*"
TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM oracle.exe
TASKKILL /S system /U AMERIFIRST\tron /FI "USERNAME ne NT*" /IM oracle.exe
TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*"

TASKLIST Commands: TASKLIST /?

TASKLIST /M notepad.exe
TASKLIST /V /FO CSV
TASKLIST /SVC /FO LIST
TASKLIST /M wbem*
TASKLIST /S system /FO LIST
TASKLIST /S system /U domain\username /FO CSV /NH
TASKLIST /S system /U username /P password /FO TABLE /NH
TASKLIST /FI "USERNAME ne NT AUTHORITY\SYSTEM" /FI "STATUS eq running"

Configure yum manually on Oracle Linux Platform from Media

Configure yum manually on Oracle Linux Platform from Media

I am using Oracle Virtual box in which i installed oracle Linux platform.

Following are steps to configure yum manually through Media or ISO image:

Step 1: Transfer the complete iso image of Linux to you local drive.
Note: I am using linux 7.4 so making naming conventions as 7.4 for all folder below. So change according to your need.

mkdir /ISOs
cp /media/USB_Sticks/Linux7-4.iso /ISOs

Step 2. Create Folder for the mounting the DVD image on it:

mkdir -p /var/OSimage/OL7.4_x86_64

mount -o loop,ro /ISOs/Linux7-4.iso /var/OSimage/OL7.4_x86_64

Yum1

Step 3: On Restart, we need to fire command again in step 2. Avoid it make an entry in /etc/fstab

vi /etc/fstab
-- Insert entry into file /etc/fstab
/ISOs/Linux7-4.iso /var/OSimage/OL7.4_x86_64 iso9660 loop,ro 0 0

Step 4: In /etc/yum.repos.d directory, edit the existing file present public-yum-ol74.repo and disable all entries by setting enabled=0.

vi public-yum-ol74.repo
-- Make all the enabled parameter to value 0

Step 5: Create the new entries in a new repository file

For example, /etc/yum.repos.d/OL74.repo

-- Create new file
vi /etc/yum.repos.d/OL74.repo

-- Insert following entries in file and take care of fist parameter [OL74] as naming of the file name.
[OL74]
name=Oracle Linux 7.4 x86_64
baseurl=file:///var/OSimage/OL7.4_x86_64
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY
gpgcheck=1
enabled=1

Step 6: Clean up the yum cache from the system.

yum clean all

yum-clean-all

Step 7: Check yum to access the repository.

yum repolist

yum-repolist

Step 8: Verify yum is working properly.

yum list
yum install gcc

DWM process consuming CPU in windows

DWM Process consuming CPU in Windows Platform

Desktop Window Manager (dwm.exe) is a compositing window manager that renders all those pretty effects in Windows: transparent windows, live taskbar thumbnails, Flip3D, and even high resolution monitor support.

On Working on the Windows Server, I found that dwm.exe process is consuming lot of CPU and made the system in hanged State.

On checking the net regarding it. It show one service name Desktop Window Manger need to be disable but i tested on my machine first before doing on porduction Server in Windows 7, Desktop Window Manager is present in the Service list. On stop the service, it refresh the monitor display but does not have much effect in resolution.

But when tried on Windows 2012 Server, Service is not present

For Windows 7 disable steps as follows
1. Click the Start button to open the Start menu.
2. In the Windows Search box, type services and click the Services link.
3. In the Services window, search and double-click Desktop Windows Manager.
4. In the Desktop Windows Manager window, Right click to disable the service.
5. If you want this process never to start when Windows loads, change the Startup type option from Automatic to Disabled.

On Windows 2012, Service is not present you need to apply bug fix as follows:

https://support.microsoft.com/en-us/help/2852483/memory-leak-occurs-in-the-dwm-exe-process-on-a-remote-desktop-computer

Find the port used by process in windows

Find the port used by which process in windows

Faced one issue during configuring listener with netca utility. Its show me that port – 1521 is already in used. But when i checked the listener services is not running. Then i took backup of network folder and drop the listener on window platform. But again when try to reconfigure listener throw same error.

Then I checked with windows commands to find which application is using 1521.

1. From command prompt administrator windows run following command:

netca

Show all running process

Check only for 1521 port:

netstat -aon | find "1521"

E:\patch_backup\deinstall>netstat -aon | find "1521"
Proto Local Address Foreign Address State Process
TCP 0.0.0.0:1521 0.0.0.0:0 LISTENING 2612
TCP 127.0.0.1:1521 127.0.0.10:57934 ESTABLISHED 2612
TCP 127.0.0.1:1521 127.0.0.10:57935 ESTABLISHED 2612
TCP 127.0.0.1:1521 127.0.0.10:57938 ESTABLISHED 2612

Means:
a : List all connections and listening ports.
O : List the owning process ID
n : List addresses and port numbers.

2. Verify the listener is running from which process id

tasklist /m ora*

Image Name PID Modules
========================= ======== ============================================
TNSLSNR.EXE 2612 oransgr11.dll, oran11.dll, oranl11.dll,
orantcp11.dll, oracore11.dll, oranls11.dll,
oraunls11.dll, orauts.dll,


3. Kill the task if needed

taskkill /PID 2612 /F

 

explorer.exe is using active file in windows

explorer.exe is using active file in windows

For explorer.exe is the program of windows for which is your desktop windows contains like folders, path ,start button. If explorer.exe is causing problem if you are doing any activity such as it used/lock any file then you need to stop it using by following methods:

Solution 1:
If you have all username / password for it then you logoff the system and re login it again. Then explorer will leave your locked file.

Solution 2:
you do not have username/password and using command prompt. you need to check your file who is locked from tasklist command. you got the process id from it and then you kill the process id by taskkill command as follows:


tasklist /m ocl*

Image Name     PID     Modules
============   =====   ========
explorer.exe   3136    oci.dll
vmtoolsd.exe   36108   oci.dll

You can kill the process id from command prompt

taskkill /pid 3136 /F
SUCCESS: The process with PID 3136 has been terminated.

When you kill it all your start button and explorer window is gone from screen. After that check you file is not using by any other process:

tasklist /m oci*
INFO: No tasks are running which match the specified criteria.

And to again start the explorer.exe process. you type explorer.exe on command prompt for start explorer.exe program.
Note: Sometime windows command prompt does not find the command. so, go to location c:\windows then type explorer.exe

C:\windows> explorer.exe

It will start the whole process and you get all yours windows back.
 
Example with snapshot
 
1. Check the explorer.exe file with tasklist command.

2.jpg

2. Kill the task with pid number, it will hide the start button from windows.

3

3. you will type the explorer.exe then it will show you again start button

4.JPG

 

ddlhost.exe is active file on windows

ddlhost.exe is active file on windows

We need to find out the which services is using the ddlhost.exe

Issue faced:
On application upgrade my application is hanged due to one of my application file is accessed by ddlhost.exe.

tasklist /m oci*

E:\13423278>tasklist /m oci*

Image Name    PID    Modules
============  =====  ==========
explorer.exe  3136   oci.dll
vmtoolsd.exe  36108  oci.dll
dllhost.exe   8836   oci.dll

E:\application>taskkill /pid 8836 /F
SUCCESS: The process with PID 8836 has been terminated.

E:\13423278>tasklist /m oci*