Search This Blog

Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Tuesday, April 2, 2013

Extend Volume Group and increase Logical Volume size + Resize Partition ( STEP BY STEP)

10 STEPS to add 10GB to LVM



1. Add size to the Virtual Disk in vmware. 
***for example let's add 10GB to filesystem*** REBOOT Guest after adding.(If needed)

2.Check if you got free space on physical disk.
[root@localhost ~]# sfdisk -s
/dev/sda: 20031488

3. Space need to be assigned to /dev/sda check whick sda partitions you already have and create a new one:
[root@localhost ~]# ls -al /dev/sda*
brw-rw---- 1 root disk 8, 0 Apr 1 2013 /dev/sda
brw-rw---- 1 root disk 8, 1 Apr 1 2013 /dev/sda1
brw-rw---- 1 root disk 8, 2 Apr 1 2013 /dev/sda2

We create new partition /dev/sda3:
[root@localhost ~]# fdisk /dev/sda
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (1306-1697, default 1306): Enter
Using default value 1306
Last cylinder or +size or +sizeM or +sizeK (1306-1697, default 1697): Enter
Using default value 1697
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
***REBOOT***

4. Check if new partition exists:
[root@localhost ~]# ls -al /dev/sda*
brw-rw---- 1 root disk 8, 0 Apr 1 2013 /dev/sda
brw-rw---- 1 root disk 8, 1 Apr 1 2013 /dev/sda1
brw-rw---- 1 root disk 8, 2 Apr 1 2013 /dev/sda2
brw-rw---- 1 root disk 8, 2 Apr 1 2013 /dev/sda3

5. Create a physical volume for LVM:
[root@localhost ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created

6. Assign the physical volume to the Volume Group:
[root@localhost ~]# vgextend VolGroup00 /dev/sda3
Volume group "VolGroup00" successfully extended

7. Check if you got free space on Volume Group:
[root@localhost ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup00
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               10.88 GB
  PE Size               32.00 MB
  Total PE              956
  Alloc PE / Size       956 / 10.88 GB
  Free  PE / Size       97 / 10.1 GB
  VG UUID               a8rsVw-ACdV-K5aP-uG7l-Nfvq-Wn9i-E36JE5

8. Extend volume:
[root@localhost /]# lvextend -L+10G /dev/VolGroup00/LogVol00
Rounding up size to full physical extent 10 GB
Extending logical volume LogVol00 to 20.88 GB
Logical volume LogVol00 successfully resized

9.Resize FileSystem:

[root@localhost ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.35 (28-Feb-2004)
/dev/VolGroup00/LogVol00 is mounted; can't resize a mounted filesystem!

Cannot use resize2fs as it is online. Use ext2online instead. 

[root@localhost ~]# ext2online /dev/VolGroup00/LogVol00
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b

10. Check if you resize success:
[root@localhost ~]# df -hl
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       21G   10.2G  9.6G  57% /
/dev/sda1              99M   13M   81M  14% /boot
tmpfs                1006M     0 1006M   0% /dev/shm

That's All. :)

Tuesday, June 5, 2012

phpinfo - how to create info file?

PHP Info


This file can help you to identify which php modules/extensions installed and enabled on your server.
This solution very simple.
Step 1.
Connect to the server through SSH and be sure you have root credentials.
Navigate to public_html directory.
cd /home/websiteuser/public_html
Step 2.
Create file.
nano phpinfo.php
Copy to the file code below:


<?php  
phpinfo(); 
?> 
Save and quit from file editor.
Step 3.
Let's check file permissions and owner.

root@server [/home/ websiteuser/public_html]# ls -l | grep phpinfo
-rw-------  1 root  root      24 Jun  5 13:34 phpinfo.php

As you see, owner of this file root, because we created this file under user root.
Change ownership:
chown websiteuser.websiteuser phpinfo.php
Change permissions:
chmod 644 phpinfo.php

Step 4.
Browse to this file from browser.
http://websiteuser.com/phpinfo.php

Now you see information page of apache & php. All modules and extensions.

eNj0Y!


Wednesday, May 16, 2012

mod_deflate configuration. Error playing .swf (flash)

Apache v2 module Deflate.

Today I stuck on something very strange.
Server whom I worked on it, run's WHM and on one of the websites, I saw follow issue:
Main page running .swf files, I mean flash. When I open the website in google chrome and internet explorer,  I see blank grey page while in FIREFOX it works fine.

               What is the problem here?

First I checked which modules installed on this server by httpd –l command.
Afterwards, I dug from network something interesting and I tried to resolve this issue. So better  Keep it for your self.
On this server installed mod_delflate.

Quote from WIKI:
"mod_deflate is an optional module for the Apache HTTP Server, Apache v2 only. Based on Deflate lossless data compression algorithm that uses a combination of the LZ77 algorithm and Huffman coding.This module provides the DEFLATE output filter that allows output from Apache HTTP server to be compressed before being sent to the client over the network.It also provides a filter for decompressing (inflating, uncompressing) a gzip compressed response body.The mod_deflate module does not have a lower bound for file size, so it attempts to compress files that are too small to benefit from compression. This results in files smaller than approximately 120 bytes becoming larger when processed by mod_deflate"
To resolve this problem, you need to edit  /usr/local/apache/conf/includes/post_virtualhost_global.conf
Add SWF extension to  "Don't compress images"
Here is my example:

<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
<IfModule mod_setenvif.c>
# Netscape 4.x has some problems…
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won’t work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don’t compress images
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png|swf)$ no-gzip dont-vary
</IfModule>
<IfModule mod_headers.c>
# Make sure proxies don’t deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
</IfModule>

Exit from editor, save and restart httpd.
/etc/init.d/httpd restart
Refresh your website, it's should be ok.
eNj0y!

Tuesday, May 15, 2012

mySQL dump - Import/Export database

How to import sql dump file to mySQL database?

Connect to the server ssh and run following commands.
Import DB:

cd ~
mysql -u database_user -p yourdatabase_db < restore_db.sql
type your mysql password.
Check if all tables exist:
mysql -u database_user -p
type your mysql password again.
show databases;
connect yourdatabase_db
show tables;
Check if all tables exist.

Export DB:
cd ~
mysqldump -u database_user  -p yourdatabase_db > filename.sql
type your mysql password.
ls -l
check if filename.sql exist.




Installation of ConfigServer Security (csf) - cPanel

Installation and configuration of ConfigServer Security(csf & lfd) - for cPanel

csf installation:

1) Login to WHM and navigate to EasyApache.
2) For perfect installation and working of CSF and your websites, you will need to enable next modules and extensions before starting install it.

Must be enabled:

Ident
Imagemap
Mime Magic
Bz2
Curl
Curlwrappers
Exif
GD
Magic Quotes
Mbregex
Mbstring
Mcrypt
Mysql
PDO
TTF
Tidy
XSL
Zip

For finish installation choose "Save and build" and wait few minutes until you get complete message.
Next steps:
Connect to your server via ssh and run next commands to install csf:

cd ~
tar -xzf csf.tgz
cd csf
sh install.sh

That's all, csf is installed successfully . To configure csf and lfd go to /etc/csf/ directory and open with your favorite editor next files:
cd /etc/csf
vi csf.conf
White list: csf.allow
Black list:  csf.deny
To add a specific IP to black list edit csf.deny and add IP Address.
For example:
vi csf.deny
167.XXX.XX.XXX # (too many wrong authentication)
All logs of csf located in /var/logs/lfd.log
To start/stop/restart csf, run from command line /etc/init.d/csf start
Also you can configure it through WHM -> Plugins -> ConfigServer Security & Firewall.
eNj0y!




Tuesday, May 8, 2012

How to enable error printing in magento?


"There has been an error processing your request

Exception printing is disabled by default for security reasons.

Error log record number: XXXXXXXXXXXX"


Solution:

Via file manager:
First of all, go to your root directory.
public_html/errors
Copy local.xml.sample to local.xml

Via SSH:
cd /home/webUser/public_html/errors
cp local.xml.sample local.xml

Refresh your website.