Posted by: Master Will | March 5, 2015

How can I determine what is taking up so much space?

1. Use linux command
du -hscx *

2. Write shell script
------------------------------------------
#!/bin/bash

if [ "$1" == "-b" ] ;then
    shift
    export units=(b K M G T P)
    export duargs="-xbs"
    export minsize=${2:-$((256*1024**2))}
else
    export units=(K M G T P)
    export duargs="-xks"
    export minsize=${2:-$((256*1024))}
fi

humansize() {
    local _c=$1 _i=0
    while [ ${#_c} -gt 3 ] ;do
    ((_i++))
    _c=$((_c>>10))
    done
    _c=$(( ( $1*1000 ) >> ( 10*_i ) ))
    printf ${2+-v} $2 "%.2f%s" ${_c:0:${#_c}-3}.${_c:${#_c}-3} ${units[_i]}
}

export device=$(stat -c %d "${1:-.}")

rdu() {
    local _dir="$1" _spc="$2" _crt _siz _str
    while read _siz _crt;do
        if [ $_siz -gt $minsize ];then
        humansize $_siz _str
        printf "%s%12s%14s_%s\n" "$_spc" "$_str" \\ "${_crt##*/}"
        [ -d "$_crt" ] &&
        [ $(stat -c %d "$_crt") -eq $device ] &&
            rdu "$_crt" "  $_spc"
    fi
    done < <(
    find "$_dir" -mindepth 1 -maxdepth 1 -xdev \
        \( -type f -o -type d \) -printf "%D;%p\n" |
        sed -ne "s/^${device};//p" |
        tr \\n \\0 |
        xargs -0 du $duargs |
        sort -nr
    )
}

rdu "${1:-.}"
------------------------------------------
Usage:
./rdu.sh /usr 100000000
       1.53G             \_lib
       143.52M             \_i386-linux-gnu
       348.16M             \_x86_64-linux-gnu
       107.80M             \_jvm
         100.20M             \_java-6-openjdk-amd64
           100.17M             \_jre
              99.65M             \_lib
       306.63M             \_libreoffice
         271.75M             \_program
       107.98M             \_chromium
      99.57M             \_lib32
     452.47M             \_bin
       2.50G             \_share
       139.63M             \_texlive
         129.74M             \_texmf-dist
       478.36M             \_locale
       124.49M             \_icons
       878.09M             \_doc
         364.02M             \_texlive-latex-extra-doc
           359.36M             \_latex

3. Use utility named "ncdu" that download at http://dev.yorhel.nl/ncdu
Sample output
ncdu 1.7 ~ Use the arrow keys to navigate, press ? for help                                                         
--- /data ----------------------------------------------------------------------------------------------------------
  163.3GiB [##########] /docimages                                                                                  
   84.4GiB [#####     ] /data
   82.0GiB [#####     ] /sldata
   56.2GiB [###       ] /prt
   40.1GiB [##        ] /slisam
   30.8GiB [#         ] /isam
   18.3GiB [#         ] /mail
   10.2GiB [          ] /export
    3.9GiB [          ] /edi   
    1.7GiB [          ] /io     
    1.2GiB [          ] /dmt
  896.7MiB [          ] /src
  821.5MiB [          ] /upload
  691.1MiB [          ] /client
  686.8MiB [          ] /cocoon
  542.5MiB [          ] /hist
  358.1MiB [          ] /savsrc
  228.9MiB [          ] /help
  108.1MiB [          ] /savbin
  101.2MiB [          ] /dm
   40.7MiB [          ] /download
 
Posted by: Master Will | February 23, 2015

OpenVPN easy script for CentOS, Ubuntu, Debian

VPN Server:

wget git.io/vpn –no-check-certificate -O openvpn-install.sh; bash openvpn-install.sh

After installed,

then save it with .ovpn extension.

Save that file in the config directory of where you installed OpenVPN client in your local computer.

 

VPN Client:

Download windows version at http://assets.unotelly.com/downloads/apps/windows/openvpn-client.msi

Install and load .ovpn into VPN client

Done.

 

Link:

Server: https://github.com/Nyr/openvpn-install

Client: http://help.unotelly.com/support/articles/184301-openvpn-desktop-client-setup-windows-

Posted by: Master Will | October 18, 2014

How to change Charset in ORACLE

At server side:
You can change database character set by doing the following steps.

In this case SID name is fujudb. (Check at TNSNAME.ORA)

Login to oracle Database server as sys privilege

SQLPLUS> connect sys/syspassword@fujudb as sysdba;

SQLPLUS> shutdown immediate;
SQLPLUS> startup mount;

SQLPLUS> alter system enable restricted session;
SQLPLUS> alter system set job_queue_processes=0;
SQLPLUS> alter system set aq_tm_processes=0;
SQLPLUS> alter database open;
SQLPLUS> alter database ORCL character set TH8TISASCII;
OR
SQLPLUS> connect sys/syspassword@fujudb as sysdba;
SQLPLUS> update prop$ set value$ = ‘TH8TISASCII’ where name=’NLS_CHARACTERSET’;
To Check DATBASE Charset
SQLPLUS> SELECT * FROM NLS_DATABASE_PARAMETERS;
NLS_CHARACTERSET = TH8TISASCII
NLS_NCHAR_CHARACTERSET = AL16UTF16
At client side:
Edit Registry
Regedit > HKEY_LOCAL_MACHINE > Software > Oracle > Home0(KEY_OraDb10g_home1) > NLS_LANG
Change NLS_LANG => THAI_AMERICA.TH8TISASCII
Posted by: Master Will | September 15, 2014

How To Set Up vsftpd on CentOS 6

#yum install vsftpd
#vi /etc/vsftpd/vsftpd.conf
Change to:
anonymous_enable=NO
local_enable=YES
chroot_local_user=YES

Save and Exit
#service vsftpd restart
#chkconfig vsftpd on

Note: If iptables is enabled, then
#modprobe -i ip_conntrack_ftp

To make it start at boot time
#vi /etc/sysconfig/iptables-config 
IPTABLES_MODULES="nf_conntrack_ftp"
 
 
Posted by: Master Will | September 11, 2014

Installing a VPS Node with Flashcache (SolusVM and OpenVZ)

The following guide will help you install a VPS Node with flashcache using SolusVM for OpenVZ.
We will be using the net install iso for this guide. I will also use nano over vi in the guide, you can choose any text editor you wish. Everything in the guide is preformed as root.

Recommended System Requirements:

E3 or Better CPU
32GB of ram or more
4x 1TB Sata Drives on a Raid card with Sata 3 ports on a Raid 10 array.
1x SSD 120GB On a sata 3 port on your motherboard

Configure your Raid card for a raid 10 array. Please see your manufacturer website for additional information on that.

Either burn or mount the netinstall centos 6 x86_64 iso as you would normally to install the OS

NOTE: Centos 6 Net install URL: http://mirror.centos.org/centos/6/os/x86_64/

This is the standard partitioning scheme i used when creating VPS nodes and it works quite well.

Partitions:
/swap ram+2GB
/boot 200MB
/ 20-30GB
/vz rest

When installing CentOS i would recommend choosing base install over minimal. It will save you time for little things you are looking for in the future.

Once you have the OS installed run the following.

yum update -y
reboot -n

Wait for the system to download any updates it can and restart. This is to make sure everything is up to date.

Change the SSH Port:

nano /etc/ssh/sshd_config
Uncomment #Port 22 and replace 22 with any port you wish. (Do not choose a port SolusVM or any other service you install might need as it will make a conflict)
Press CTRL + X and save the changes
service sshd restart
Your ssh connection will now end and you will need to reconnect using the new port you have specified in sshd_config.

Turning off SELinux

nano /etc/selinux/config
Change the directive to disabled.
CTRL + X and save the changes.

Installing SolusVM

wget http://soluslabs.com/installers/solusvm/install
chmod 755 install
./install

Follow the steps to setup your first node as a master or a slave OpenVZ.
I recommend choosing Automatic location to make sure you get the best possible speed downloading the files.
After this has completed please make note of your output. It will contain important information such as your username/password, url:ports, Solusvm ID and Password. Please copy and paste this as you will need this information later.

Once complete reboot the server again.

reboot -n

Once logged back in make sure the OpenVZ kernel loaded

uname -r

You should recieve an output like the following:

2.6.32-042stab075.10

Install Git and Dependents:

yum -y install git dkms gcc make yum-utils kernel-devel

Download and install your kernel devel:

cd /tmp
wget http://download.openvz.org/kernel/branches/rhel6-2.6.32/042stab075.2/vzkernel-devel-2.6.32-042stab075.10.x86_64.rpm (Note: Check the url and replace the file information to match your uname -r output!)
yum -y localinstall vzkernel-devel-2.6.32-042stab075.10.x86_64.rpm

Git Clone Flashcache:

git clone https://github.com/facebook/flashcache.git

Install and Configure Flashcache (Note: Please remember to change the versions to match your uname -r output!)

cd flashcache/
make KERNEL_TREE=/usr/src/kernels/2.6.32-042stab075.10
make install KERNEL_TREE=/usr/src/kernels/2.6.32-042stab075.10
modprobe flashcache
Make sure its running: dmesg | tail

Making /vz flashcached:
umount /vz
Find your UUID for /vz: grep “/vz” /etc/fstab
flashcache_create -p back vz_cached /dev/sdb /dev/disk/by-uuid/replace-with-your-uuid
Comment out vz in fstab: nano /etc/fstab

Configuring Flashcache

Copy the config file: cp /tmp/flashcache/utils/flashcache /etc/init.d
Change the permissions: chmod 755 /etc/init.d/flashcache
nano /etc/init.d/flashcache

Change the following information:

SSD_DISK=/dev/sdb
BACKEND_DISK=/dev/disk/by-uuid/replace-with-your-uuid
CACHEDEV_NAME=vz_cached
MOUNTPOINT=/vz
FLASHCACHE_NAME=vz_cached
CTRL +X and save it.

Turn on Flashcache at boot: chkconfig flashcache on
Reboot the Server: reboot -n

Make sure everything looks good and run df-h.

Do a DD test to make sure flashcache is working.

First do a DD test in the root directory:
cd /
dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync; unlink test

Note the output

Now do a DD test in the /vz directory.
cd /vz
dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync; unlink test

Note awesomeness.

Everything is now setup as far as the base system with SolusVM OpenVZ and Flashcache!

If you have any issues or questions please post below and I will address them as best as possible.

Thank you,

 

Credit: http://www.allvpsinfo.com/discussion/6/installing-a-vps-node-with-flashcache-solusvm-and-openvz/p1

Posted by: Master Will | August 25, 2014

Extend or Resize harddisk size via lvm on centOS

1. First, need to create a new partition.

[root@server ~]# fdisk /dev/sda

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won’t be recoverable.Warning: invalid flag 0×0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n <– ENTER
Command action
e extended
p primary partition (1-4)
p <– ENTER
Partition number (1-4): 3 <– ENTER
First cylinder (1-652, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-652, default 652):
Using default value 652

Command (m for help): p

Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 652 5237158+ 83 Linux

Command (m for help): t <– ENTER
Selected partition 3 <– ENTER
Hex code (type L to list codes): 8e <– ENTER
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w <– ENTER
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

 

2. Reboot server 1 time to take affect
[root@server ~]# shutdown -r now

 

3. Create new Physical Volume using the NEW partition. (pvcreate)

————— pvdisplay ————
[root@server ~]# pvdisplay
— Physical volume —
PV Name /dev/sda2
VG Name vg_server
PV Size 14.51 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 3714
Free PE 0
Allocated PE 3714
PV UUID mnFLbX-Zps0-alJR-SZQn-8Rqo-c1rr-2fTWXO
————— pvcreate ————
[root@server ~]# pvcreate /dev/sda3
Physical volume “/dev/sda3” successfully created

[root@server ~]# pvdisplay
— Physical volume —
PV Name /dev/sda2
VG Name vg_server
PV Size 14.51 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 3714
Free PE 0
Allocated PE 3714
PV UUID mnFLbX-Zps0-alJR-SZQn-8Rqo-c1rr-2fTWXO

“/dev/sda3” is a new physical volume of “24.99 GiB”
— NEW Physical volume —
PV Name /dev/sda3
VG Name
PV Size 24.99 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID P0sEeq-zgI6-cGHI-3wwA-ysDZ-wy4W-VuFouO

 

 

4. Extend Volume Group using the NEW PV now. (vgextend)
————— vgdisplay —————
[root@server ~]# vgdisplay
— Volume group —
VG Name vg_server
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size 14.51 GiB
PE Size 4.00 MiB
Total PE 3714
Alloc PE / Size 3714 / 14.51 GiB
Free PE / Size 0 / 0
VG UUID cnv1x2-NIWJ-fsIf-HMPs-WVld-YXJ0-jcKd3V

————— vgextend —————
[root@server ~]# vgextend /dev/vg_server /dev/sda3
Volume group “vg_server” successfully extended

[root@server ~]# vgdisplay
— Volume group —
VG Name vg_server
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 7
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 2
Act PV 2
VG Size 39.50 GiB
PE Size 4.00 MiB
Total PE 10112
Alloc PE / Size 3714 / 14.51 GiB
Free PE / Size 6398 / 24.99 GiB
VG UUID cnv1x2-NIWJ-fsIf-HMPs-WVld-YXJ0-jcKd3V

 

5. You can upgrade the LVM size using lvextend command.

————— lvextend —————
[root@server ~]# lvextend -l +100%FREE /dev/vg_server/lv_home
Extending logical volume lv_home to 30.70 GiB
Logical volume lv_home successfully resized

 

6. Finally, let’s resize the file system to the new allocated space. (resize2fs)

————— resize2fs —————
[root@server ~]# resize2fs /dev/vg_server/lv_home
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_server/lv_home is mounted on /home; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/vg_server/lv_home to 8046592 (4k) blocks.
The filesystem on /dev/vg_server/lv_home is now 8046592 blocks long.
————— reboot 1 time to take affect—————

Usually, an svn cleanup fixes most issues with tortoise svn. However, I ran into an issue which caused me some grief. 
The specific error I was seeing:
Previous operation has not finished; run 'cleanup' if it was interrupted

Solution:

 Somehow, svn is stuck on the previous operation. We need to remove this operation from it’s ‘work queue’. 
The data is stored in the wc.db sqllite database in the offending folder.

1. Install sqllite (32 bit binary for windows) from http://www.sqlite.org/download.html

2. sqlite .svn/wc.db “select * from work_queue”

The SELECT should show you your offending folder/file as part of the work queue. What you need to do is delete this item from the work queue.

3. sqlite .svn/wc.db “delete from work_queue”

That’s it. Now, you can run cleanup again – and it should work. Or you can proceed directly to the task you were doing before being prompted to run cleanup (adding a new file etc.)

Also, svn.exe (a command line tool) is part of the Tortoise installer – but is unchecked for some reason. Just run the installer again, choose ‘modify’ and select the ‘command line tools’.

Posted by: Master Will | March 5, 2014

Disabling RLimitMEM directive from httdp.conf

executed that tool inWHM >> Main >> Service Configuration >> Apache Configuration >> Memory Usage Restrictions

To remove it.

cd /var/cpanel/templates/apache2
vi main.default

comment these lines

#RLimitMEM [% main.rlimitmem.item.softrlimitmem %] [% main.rlimitmem.item.maxrlimitmem %]
#RLimitCPU [% main.rlimitcpu.item.softrlimitcpu %] [% main.rlimitcpu.item.maxrlimitcpu %]

/scripts/rebuildhttpdconf
/etc/init.d/httpd restart
Posted by: Master Will | February 5, 2014

reinstall vzctl

vzctl –version
cat /etc/issue
yum remove vzctl*
cd /tmp

yum -y install parted
wget ftp://ftp.icm.edu.pl/vol/rzm1/linux-openvz/utils/ploop/1.4/ploop-lib-1.4-1.x86_64.rpm
wget ftp://ftp.icm.edu.pl/vol/rzm1/linux-openvz/utils/ploop/1.4/ploop-1.4-1.x86_64.rpm
rpm -ivh ploop*

wget http://download.openvz.org/utils/vzctl/3.3/vzctl-3.3-1.x86_64.rpm
wget http://download.openvz.org/utils/vzctl/3.3/vzctl-lib-3.3-1.x86_64.rpm
rpm -ivh vzctl-3.3-1.x86_64.rpm vzctl-lib-3.3-1.x86_64.rpm

wget http://files.soluslabs.com/solusvm/installer/v2/ve-vswap-solus.conf-sample -O /etc/vz/conf/ve-vswap-solus.conf-sample
vi /etc/vz/vz.conf

–Change line to

CONFIGFILE=”vswap-solus”

/etc/init.d/vz restart
vzctl –version

Posted by: Master Will | January 20, 2014

How to Rebuild LSI RAID

The LSI card does not automatically rebuild the mirror onto the newly replaced drive. The drive is put into the UNCONFIGURED BAD state and requires manual intervention to initiate a rebuild. With the LSI there is no way to initiate an array rebuild (or do any array maintenance for that matter) so a reboot into the LSI BIOS is necessary.

megaraid-01-drive-replaced

Even though the drive has been physically replaced, the BIOS shows that there is a “PD Missing” on backplane 252, slot 1.  By switching to the “physical view” and selecting the drive that’s shown as “Unconfigured Bad”, the drive can be changed to “unconfigured good” by marking the radio button and clicking Go.

megaraid-02-go-to-physical-view

megaraid-03-make-drive-unconfigured-good

Now that the drive is in a “good” state, it can be added into the array by marking the radio button beside Replace Missing PD and hitting Go.

megaraid-04-replace-missing-physical-disk-pd2

After that, choose to Rebuild Drive and away you go.

 

Credit: http://www.packetmischief.ca/2011/03/31/monitoring-direct-attached-storage-under-esxi/

« Newer Posts - Older Posts »

Categories