Archive for the ‘Uncategorized’ Category

command to activate VG on LVM?

February 10th, 2018 No comments

Command to activate VG on LVM?

When you create a volume group, by default, it is activated. Sometimes you may need to activate it manually to make the kernel aware of volume groups.

To activate,

# vhchage -ay my_vg_name

To De-activate,

# vgchnage -an my_vg_name

A command to activate the VG in a cluster?

To activate exclusively on one node,

# vgchange -aey my_vg_name

To deactivate exclusively on one node,

# vgchange -aen my_vg_name

To activate only on the local node,

# vgchange -aly my_vg_name
To deactivate only on the local node,
# vgchange -aln my_vg_name



How to get mail statistics from your postfix mail logs

January 21st, 2018 No comments

How to get mail statistics from your postfix mail logs


Its an amazing tool and will provide you the following details

  • Total number of:
    • Messages received, delivered, forwarded, deferred, bounced and rejected
    • Bytes in messages received and delivered
    • Sending and Recipient Hosts/Domains
    • Senders and Recipients
    • Optional SMTPD totals for number of connections, number of hosts/domains connecting, average connect time and total connect time
  • Per-Day Traffic Summary (for multi-day logs)
  • Per-Hour Traffic (daily average for multi-day logs)
  • Optional Per-Hour and Per-Day SMTPD connection summaries
  • Sorted in descending order:
    • Recipient Hosts/Domains by message count, including:
      • Number of messages sent to recipient host/domain
      • Number of bytes in messages
      • Number of defers
      • Average delivery delay
      • Maximum delivery delay
    • Sending Hosts/Domains by message and byte count
    • Optional Hosts/Domains SMTPD connection summary
    • Senders by message count
    • Recipients by message count
    • Senders by message size
    • Recipients by message size

    with an option to limit these reports to the top nn.

  • A Semi-Detailed Summary of:
    • Messages deferred
    • Messages bounced
    • Messages rejected
  • Summaries of warnings, fatal errors, and panics
  • Summary of master daemon messages

Installation :-

Installation is very simple , just download the package and unzip

  •  wget
  •  tar -zxf pflogsumm-1.1.5.tar.gz
  • chown root:root pflogsumm-1.1.5


Generate the statistics  :-

cat /var/log/maillog | ./
( The above command will generate a detailed statistics as follows )


Grand Totals

118 received
319 delivered
1 forwarded
6 deferred (1597 deferrals)
18 bounced
20 rejected (5%)
0 reject warnings
0 held
0 discarded (0%)

5452k bytes received
277987k bytes delivered
76 senders
49 sending hosts/domains
128 recipients
37 recipient hosts/domains

Per-Day Traffic Summary
date received delivered deferred bounced rejected
Jan 13 2018 51 251 476 14 9
Jan 14 2018 17 16 522 2 5
Jan 15 2018 43 45 527 2 6
Jan 16 2018 7 7 72

Per-Hour Traffic Daily Average
time received delivered deferred bounced rejected
0000-0100 0 1 19 0 0
0100-0200 1 1 13 0 0
0200-0300 1 1 13 0 0
0300-0400 1 1 19 0 0
0400-0500 1 1 14 0 0
0500-0600 0 0 7 0 0
0600-0700 1 1 13 0 0
0700-0800 1 1 13 0 0
0800-0900 0 0 7 0 0
0900-1000 2 2 14 0 1
1000-1100 5 51 32 3 0
1100-1200 1 1 33 0 0
1200-1300 1 4 14 0 0
1300-1400 2 2 20 0 0
1400-1500 2 2 20 0 0
1500-1600 4 4 14 0 0
1600-1700 1 1 20 0 0
1700-1800 2 2 20 0 1
1800-1900 1 2 14 1 0
1900-2000 1 1 13 0 2
2000-2100 1 1 19 0 0
2100-2200 1 1 19 0 0
2200-2300 1 1 13 0 0
2300-2400 1 1 19 0 1

Categories: Plesk, Uncategorized Tags:

How to extend disk space in windows 2012

May 10th, 2017 No comments

How to extend disk space in windows 2012

Login to windows. Click on Start run and type cmd.

In windows command prompt.

run diskpart.exe

DISKPART prompt will come.

diskpart >list volume

Above command will show list of volumes.

Select volume volume number

It will select the volume which you want to extend.

extend filesystem

It will extend filesystem size.

Once done. Close the command prompt and refresh windows explorer. If still it is showing old space then try rebooting the server.


Categories: Uncategorized Tags:

dd command to migrate VPS on linux platform

May 10th, 2017 No comments

dd command to migrate VPS on linux platform.

First create new vps with same configuration on another node. It doesn’t matter new vps is having os or not or you can choose any OS.

Once same configuration VPS setup done then use below command to migrate VPS.

dd if=/dev/guestos/kvm2351_img | ssh “dd of=/dev/guestos/kvm2520_img”

Once migration is completed then try starting VPS on new node.



Categories: Uncategorized Tags:

Kill restore process in new cpanel

October 14th, 2014 No comments

Kill restore process in new cpanel


In new cpanel/WHM when we try to kill restore process it is still showing in WHM >> restore full backup. Below are the steps to remove that process from WHM.

You can manually mark the transfer as completed using the following instructions:

Ensure the transfer is no longer running by clicking on the “View” option under “Sessions in Progress” for this transfer. In the new window, there will be a line that looks like this:

You may close this window and view the transfer on the command line: /usr/local/cpanel/bin/view_transfer 1071601843quick20141013154952IAZhRro

Access your server via SSH and run that command (the transfer name will be different on your server):

/usr/local/cpanel/bin/view_transfer 1071601843quick20141013154952IAZhRro

As an example, you might see output like this:

Transfer running with pid: paused
[795 ][MASTER ]: Start Session
[795 ][MASTER ]: Version: 1.9

You will note that the master PID for this transfer is xxx. If the process still exists, and the transfer has failed, then you can kill that process:

kill -9 xxx

The next step requires you to change the entry for this transfer in the whmxfer.sessions table in MySQL. Find the entry with the session ID for your migration. In the example we have been using, it’s ‘ 1071601843quick20141013154952IAZhRro .’ It will look like this:

mysql -e “select * from whmxfer.sessions where sessionid=’1071601843quick20141013152137YIVT7Ze'”
| sessionid | initiator | pid | version | target_host | source_host | state | starttime | endtime |
| 1071601843quick20141013152137YIVT7Ze | quickrestore | 21295 | 1.9 | | localhost | 50 | 2014-10-13 08:21:37 | NULL |

You will need to change the ‘state’ field to 100, and change the ‘endtime’ field from NULL to a time after the ‘starttime’ field:

mysql -e “update whmxfer.sessions set state=’100′, endtime=’2014-10-14 09:37:52′ where sessionid=’1071601843quick20141013152137YIVT7Ze'”

If you check it again then you will notice that process ended.

| sessionid | initiator | pid | version | target_host | source_host | state | starttime | endtime |
| 1071601843quick20141013152137YIVT7Ze | quickrestore | 21295 | 1.9 | | localhost | 100 | 2014-10-13 08:21:37 | 2014-10-14 09:37:52 |

The transfer should then no longer appear under “Sessions in Progress.”

You can reconfirm the same by login into WHM.

Categories: CPanel / WHM, Uncategorized Tags:

Idera backup agent configuration

June 4th, 2014 No comments

How to configure Idera backup agent


Installing Agent Using YUM

First, create a YUM .repo file with the R1Soft repository information.

Open the new file with a text editor such as vi or nano:

# cd /etc/yum.repos.d

vi r1soft.repo

Insert the following text into the file and save the file:

name=R1Soft Repository Server

Once done run below command.

yum clean all

Now install cdp agent

yum install r1soft-cdp-enterprise-agent
yum install kernel-devel kernel-headers
yum upgrade kernel

install r1soft kernel binaries

r1soft-setup –no-binary

Restart r1soft agent after binaries are done.

Check connectivity

r1soft-setup –test-connection

Insert key using below command

serverbackup-setup –get-key http://IP

Restart the server. Once server is online check cdp-agent is running or not. If not then start that service.

Sometimes you will face connectivity issue at that check port is opened on server firewall. Default port is 1167

iptables -I INPUT -p tcp –dport 1167 -j ACCEPT

Save iptables and restart it and test it again.

Front end task done. Now backend  task

Login to backend admin panel of r1soft

Click on servers.

Add server It will ask for server name VM hostname, IP address things insert it and click on create button.

Then click on Users.

username: customer-name >> password >> email

then click on server tab add the new server you created for the customer. Give full control. No volumes.

Then click on disks safes.

name same as servers name :  on server drop down arrow search for the servers you added earlier, volume pick volume1. click on Limits. Put recovery points and archive to 3.

Quota on disk size : soft 48 hard quota 50. Click on create.

Policy make the policy to backup weekly, merge weekly, disk verification weekly, exclude files you don’t want to backup to avoid using all disk space.

then when finish give client his R1SOFT credentials.






Categories: Installation, Uncategorized Tags:

How to install ioping in linux server

September 9th, 2013 No comments

How to install ioping in linux server

This tool lets you monitor I/O latency in real time. It shows disk latency in the same way as ping shows network latency.

Login to SSH.

Go to the folder where you want to download it.

cd /usr/local/src

Download the installation file.

Extract that file using below command.

tar -xzvf ioping-0.6.tar.gz

Go inside that folder.

cd ioping-0.6

compile it using below command.

make ioping



Show disk I/O latency using the default values and the current directory, until interrupted

$ ioping .
4096 bytes from . (ext4 /dev/sda3): request=1 time=0.5 ms
4096 bytes from . (ext4 /dev/sda3): request=2 time=0.4 ms
4096 bytes from . (ext4 /dev/sda3): request=3 time=0.5 ms
4096 bytes from . (ext4 /dev/sda3): request=4 time=12.7 ms
4096 bytes from . (ext4 /dev/sda3): request=5 time=0.4 ms
— . (ext4 /dev/sda3) ioping statistics —
5 requests completed in 4794.0 ms, 364 iops, 1.4 mb/s
min/avg/max/mdev = 0.2/2.8/12.7/5.0 ms

Measure disk seek rate (iops)

ioping -R /dev/sda

— /dev/sda (device 465.8 Gb) ioping statistics —
186 requests completed in 3004.6 ms, 62 iops, 0.2 mb/s
min/avg/max/mdev = 6.4/16.0/26.8/4.7 ms

Measure disk sequential speed (mb/s)

ioping -RL /dev/sda

— /dev/sda (device 465.8 Gb) ioping statistics —
837 requests completed in 3004.1 ms, 292 iops, 72.9 mb/s
min/avg/max/mdev = 2.0/3.4/28.9/2.0 ms

For VPS’s also it will work.

4096 bytes from / (simfs /dev/simfs): request=1 time=8.2 ms
4096 bytes from / (simfs /dev/simfs): request=2 time=0.2 ms
4096 bytes from / (simfs /dev/simfs): request=3 time=0.2 ms
4096 bytes from / (simfs /dev/simfs): request=4 time=0.2 ms
4096 bytes from / (simfs /dev/simfs): request=5 time=0.2 ms


Categories: Installation, Uncategorized Tags:

How to tweak linux server harddisk using hdparm

August 24th, 2013 No comments

Tune your hard disk for high performance Using hdparm

First of all you have to install hdparm in linux.

apt-get install hdparm

#hdparm /dev/sda

readonly = 0 (off)
readahead = 120 (on)
geometry = 8850/255/63, sectors = 142182912, start = 0


Hard disk Performance Information

# hdparm -tT /dev/hda

Timing cached reads: 496 MB in 2.00 seconds = 247.42 MB/sec
Timing buffered disk reads: 60 MB in 3.03 seconds = 19.81 MB/sec


Hard drive set to low, slow settings

# hdparm -cuda /dev/hda

IO_support = 0 (default 16-bit)
unmaskirq = 0 (off)
using_dma = 0 (off)
readahead = 256 (on)

Use below tweaks to increase disk read write performance.

For sda drive

~]# hdparm -a 2048 /dev/sda

setting fs readahead to 2048
readahead = 2048 (on)

For sdb drive

[[email protected] ~]# hdparm -a 2048 /dev/sdb

setting fs readahead to 2048
readahead = 2048 (on)


]# echo “anticipatory” > /sys/block/sdb/queue/scheduler

]# echo “anticipatory” > /sys/block/sda/queue/scheduler



Categories: Tweaks, Uncategorized Tags:

DDOS attack check

August 3rd, 2013 No comments

DDOS attack

Whenever the load in the server increases due to a particular user in the server. Check the following:

You can check the user in top.

Find the domain owned by the user:

grep username /etc/userdomains

use the following command after you get the domain name:

less /usr/local/apache/domlogs/ | awk ‘{print $1}’ | sort | uniq -c | sort -n

This will give the ip and number of connections in the descending order. For example:


In the above case we can see too many connections from those ips. This is surely abnormal. Immediately block such ips in the server using csf or block that ips in hosts.deny.



Categories: Uncategorized Tags:

vi and vim cheat sheet for Linux

April 10th, 2013 No comments

vi and vim cheat sheet for Linux


Cursor movement

h – move left
j – move down
k – move up
l – move right
w – jump by start of words (punctuation considered words)
W – jump by words (spaces separate words)
e – jump to end of words (punctuation considered words)
E – jump to end of words (no punctuation)
b – jump backward by words (punctuation considered words)
B – jump backward by words (no punctuation)
0 – (zero) start of line
^ – first non-blank character of line
$ – end of line
G – Go To command (prefix with number – 5G goes to line 5)
Note: Prefix a cursor movement command with a number to repeat it. For example, 4j moves down 4 lines.


Insert Mode – Inserting/Appending text

i – start insert mode at cursor
I – insert at the beginning of the line
a – append after the cursor
A – append at the end of the line
o – open (append) blank line below current line (no need to press return)
O – open blank line above current line
ea – append at end of word
Esc – exit insert mode


r – replace a single character (does not use insert mode)
J – join line below to the current one
cc – change (replace) an entire line
cw – change (replace) to the end of word
c$ – change (replace) to the end of line
s – delete character at cursor and subsitute text
S – delete line at cursor and substitute text (same as cc)
xp – transpose two letters (delete and paste, technically)
u – undo
. – repeat last command

Marking text (visual mode)

v – start visual mode, mark lines, then do command (such as y-yank)
V – start Linewise visual mode
o – move to other end of marked area
Ctrl+v – start visual block mode
O – move to Other corner of block
aw – mark a word
ab – a () block (with braces)
aB – a {} block (with brackets)
ib – inner () block
iB – inner {} block
Esc – exit visual mode

Visual commands

> – shift right
< – shift left
y – yank (copy) marked text
d – delete marked text
~ – switch case

Cut and Paste

yy – yank (copy) a line
2yy – yank 2 lines
yw – yank word
y$ – yank to end of line
p – put (paste) the clipboard after cursor
P – put (paste) before cursor
dd – delete (cut) a line
dw – delete (cut) the current word
x – delete (cut) current character


:w – write (save) the file, but don’t exit
:wq – write (save) and quit
:q – quit (fails if anything has changed)
:q! – quit and throw away changes


/pattern – search for pattern
?pattern – search backward for pattern
n – repeat search in same direction
N – repeat search in opposite direction
:%s/old/new/g – replace all old with new throughout file
:%s/old/new/gc – replace all old with new throughout file with confirmations

Working with multiple files

:e filename – Edit a file in a new buffer
:bnext (or :bn) – go to next buffer
:bprev (of :bp) – go to previous buffer
:bd – delete a buffer (close a file)
:sp filename – Open a file in a new buffer and split window
ctrl+ws – Split windows
ctrl+ww – switch between windows
ctrl+wq – Quit a window
ctrl+wv – Split windows vertically
Another good vim commands cheatsheet and a vi introduction using the “cheat sheet” method


Categories: Uncategorized Tags:
%d bloggers like this: