Archive

Archive for the ‘Uncategorized’ Category

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 10.10.10.10 “dd of=/dev/guestos/kvm2520_img”

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

 

 

Categories: Uncategorized Tags:

Mount windows/linux disk using kpartx

May 10th, 2017 No comments

This post will guide you through how to access the contents of the virtual disk (LVM disk) directly so that you don’t need to boot the VM or when VM is not booting and you want to recover the data(windows or linux)

 

[[email protected] ~]# lvdisplay | grep centos
LV Path /dev/VolGroup/centos
LV Name centos

We need to create device maps from this LVM device’s partition tables.

kpartx -av /dev/VolGroup/centos

add map VolGroup-centos1 (253:8): 0 9912042 linear /dev/VolGroup/centos 63
add map VolGroup-centos2 (253:9): 0 562275 linear /dev/VolGroup/centos 9912105
add map VolGroup-centos : 0 562212 linear 253:9 9912168

Now we can mount the image and grab any files we may need.

mkdir /mnt/centos

mount /dev/mapper/vbox-centos1 /mnt/centos

Once we are done accessing our files, we can go ahead and unmount the partition and delete the partition mappings.

umount /mnt/centos

kpartx -d /dev/VolGroup/centos

 

 

 

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 | vps1.insurancedxb.com | 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 | vps1.insurancedxb.com | 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:

[r1soft]
name=R1Soft Repository Server
baseurl=http://repo.r1soft.com/yum/stable/$basearch/
enabled=1
gpgcheck=0

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.

https://ioping.googlecode.com/files/ioping-0.6.tar.gz

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

 

Examples

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
^C
— . (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

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

 

Hard disk Performance Information

# hdparm -tT /dev/hda

/dev/hdd:
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

/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

/dev/sda:
setting fs readahead to 2048
readahead = 2048 (on)

For sdb drive

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

/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/domain.com | awk ‘{print $1}’ | sort | uniq -c | sort -n

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

13832 65.51.111.143
19112 66.250.68.289
208262 157.55.16.77

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

Editing

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

Exiting

: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

Search/Replace

/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:

Change Theme Without Login To WordPress Admin Area

January 31st, 2013 No comments

Change Theme Without Login To WordPress Admin Area

Check the database name from wp-config.php file.

Backup the database using the following command from shell.

Cpanel

 mysqldump database_name > database_name.sql

Plesk

mysqldump –opt -uadmin -p`cat /etc/psa/.psa.shadow` database_name > database_name.sql

Now, login to phpmyadmin and select the database_name.

In the database click on table wp_options .

In wp_options click on Sql tab .

Execute the following queries for finding out the current theme enabled for wordpress site.

SELECT *
FROM wp_options
WHERE option_name = ‘template’
OR option_name = ‘stylesheet’
OR option_name = ‘current_theme’;

Now, execute the following query for changing the theme for wordpress site.

UPDATE wp_options SET option_value = ‘default’ WHERE option_name = ‘template’;

UPDATE wp_options SET option_value = ‘default’ WHERE option_name = ‘stylesheet’;

UPDATE wp_options SET option_value = ‘default’ WHERE option_name = ‘current_theme’;

Replace default with theme name.

Check the theme again by running below command.

SELECT *
FROM wp_options
WHERE option_name = ‘template’
OR option_name = ‘stylesheet’
OR option_name = ‘current_theme’;

 

Categories: Uncategorized Tags: