Friday, May 6, 2011

Install Grub On Second disk RAID 1

Hi just share with you guys, how to repair your Grub and your Raid, if your SDA1 is broken under the software raid, the os is CentOS 5.4


If you machine is totally can't boot up, please bring the CentOS installer disk.


boot: linux rescue --> go in to rescue mode


chroot /mnt/sysimage --> mount your disk


To check the GRUB :


cat /boot/grub/device.map

grub-install --recheck /dev/sdb
grub-install /dev/sdb





hopper:~# grub
grub> device (hd0) /dev/sdb
grub> root (hd0,0)
 Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd0)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  15 sectors are embedded.
succeeded
 Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
Done.

grub> quit



sfdisk -d /dev/sda > sda.table -> to copy your partition table



sfdisk /dev/sda < sda.table -> to restore your partition table


Now take a look your md driver first.
#cat /proc/mdstat




Personalities : [raid1]
md0 : active raid1 sdb2[2](F) sda2[0]
      4192896 blocks [2/1] [U_]
    
md2 : active raid1 sdb3[2](F) sda3[0]
      479998016 blocks [2/1] [U_]
    
md1 : active raid1 sdb1[2](F) sda1[0]
      4192832 blocks [2/1] [U_]

The result on the top is explain that sdb is broken.

mdadm --create --verbose /dev/md0 --level=1 /dev/sda1 /dev/sdb2
mdadm --detail --scan >> /etc/mdadm.conf
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
mdadm --fail /dev/md0 /dev/sda1
mdadm /dev/md0 --fail /dev/sda1 --remove /dev/sda1
mdadm --add /dev/md0 /dev/sdb1



Regards,
феникс

Sunday, December 12, 2010

How to Update Bash Version on MAC

Hi,

Another post, just share some experience. Forthose whom a bit extreme users. Here how to update your bash version. Here we go...

This is all what you need:
1. Apple XCode, you can download by yourself from apple website.
2. Bash 4.1

This is how to do
01. tar -xzvf bash-4.1.tar.gz
02. 'su -' or 'sudo -s' -> you must have root previlage
03. cd bash-4.1
04. ./configure && make && make install
05. chsh -s /usr/local/bin/bash user_name
06. sudo bash -c "echo /usr/local/bin/bash >> /private/etc/shells"
07. Close your terminal & open it again
08. type in 'help' it should have the bash version on the top if it's already 4.1
09. 'su -' or 'sudo -s'
10. cd /bin
11. mv bash bash_old
12. ln -s /usr/local/bin/bash bash

Enjoy your new Bash..

Regards,
феникс

Saturday, November 27, 2010

Gnome on OpenBSD 4.8

Hi,

Everyone comes another update this one is just how to enable GNOME on your OpenBSD 4.8

OpenBSD Repositories

1. Make your live easier, by installing nano
# pkg_add -r http://ftp.openbsd.org/pub/OpenBSD/4.8/packages/i386/nano-2.2.4.tgz
# echo 'set nowrap' > /root/.nanorc

Do on your user also
$ echo 'set nowarp' > /home/your_username/.nanorc

2. Using root previlages, add this to your machine
# pkg_add -r http://ftp.openbsd.org/pub/OpenBSD/4.8/packages/i386/gdm-2.20.11p1.tgz
# pkg_add -r http://ftp.openbsd.org/pub/OpenBSD/4.8/packages/i386/metacity-2.30.1p1.tgz
# pkg_add -r http://ftp.openbsd.org/pub/OpenBSD/4.8/packages/i386/gnome-panel-2.30.2p2.tgz
# pkg_add -r http://ftp.openbsd.org/pub/OpenBSD/4.8/packages/i386/nautilus-2.30.1p2.tgz
# pkg_add -r http://ftp.openbsd.org/pub/OpenBSD/4.8/packages/i386/gnome-terminal-2.30.2p0.tgz
# pkg_add -r http://ftp.openbsd.org/pub/OpenBSD/4.8/packages/i386/gnome-themes-2.30.2.tgz
# pkg_add -r http://ftp.openbsd.org/pub/OpenBSD/4.8/packages/i386/gnome-themes-extras-2.22.0p8.tgz
# pkg_add -r http://ftp.openbsd.org/pub/OpenBSD/4.8/packages/i386/gnome-utils-2.30.0p0.tgz
# pkg_add -r http://ftp.openbsd.org/pub/OpenBSD/4.8/packages/i386/gnome-control-center-2.30.1p0.tgz
# pkg_add -r http://ftp.openbsd.org/pub/OpenBSD/4.8/packages/i386/gnome-settings-daemon-2.30.2p1.tgz
# pkg_add -r http://ftp.openbsd.org/pub/OpenBSD/4.8/packages/i386/gnome-menus-2.30.2p0.tgz

3. Assume you already download the files in the top, do this
# nano /etc/rc.local

add this the following lines in the bottom

-----------------------------------------------------


if [ -x /usr/local/sbin/gdm ]; then
echo -n ' gdm'; (sleep 5; /usr/local/sbin/gdm) &
fi
----------------------------------

# echo 'exec gnome-session' > /root/.xinitrc
# chmod +x /root/.xinitrc

under your user account do the same thing

$ echo 'exec gnome-session' > /home/your_username/.xinitrc

$ chmod +x /home/your_username/.xinitrc

4. Next do this to make it works
# nano /etc/rc.conf.local

add this following lines in the bottom


-----------------------------------------------------

gnome_enable=YES
gdm_enable=YES
----------------------------------



5. Enjoy your Gnome.

Regards,
феникс

Wednesday, July 28, 2010

How To Make Realtek RTL8191SE Work on Slackware

Realtek RTL8191SE is figured below :


  • What you need is the realtek driver. You can download it form Realtek Driver for Linux.
  • Uncompress it.
  • tar -xzvf filename.tar.gz
  • Go to the directory
  • Just simple make and make install
After this you will notice the wifi not up, you need to init 6

After reboot your machine, you can type in
# iwconfig  --> you should see RTL8191SE as your wlan0
# ifconfig wlan0 up -> It will bring up your wifi card
# iwlist wlan0 scan -> Scan network around you.
# iwconfig essid "NetworkName" key "YourKey" -> Join your network
# dhcpcp -d -> got DHCP address.

That's all, will share another thing later :)

Regards,
феникс


Monday, June 7, 2010

Enable local / remote error messages for classic ASP under IIS7

By default ASP error messages are hidden behind a really useful 500 message under IIS7.
You can go into the GUI -> Your site -> ASP -> Debugging Properties -> Send Errors to Browser -> True
but that doesn’t seem to help you remotely. You need to do this (remember, don’t do this on a production server):
Start -> Accessories -> Right Click Command Prompt and then Run as Administrator, then do the following:
  • CD C:\Windows\System32\Inetsrv

  • appcmd set config -section:asp -scriptErrorSentToBrowser:true

  • appcmd set config -section:system.webServer/httpErrors -errorMode:Detailed



  • Regards,
    феникс

    Thursday, May 13, 2010

    Make Macbook White Early 2009 on 64 Bit

    Hi,

    All this is my experience to change Macbook White Early 2009 to load using 64Bit Kernel, under Snow Leopard 10.6.3.

    Below is the Mac specification :

    Model  Early 2009
    Release Date  21st Jan 2009
    Model Numbers  MB881*/A
     Machine Model MacBook5,2
     Display 13.3" glossy widescreen LCD, 1280 x 800 pixel resolution
    FSB  1066 MHz
     Processor 2.0 GHz Intel Core 2 Duo (P7350)
    Memory  2 GB (two 1 GB) 667 MHz PC2-5300
    Expandable to 4 GB
    Graphics  nVidia GeForce 9400M using 256 MB RAM
     HardDrive 120 GB
    Optional 160 GB, 250 GB, or 320 GB
     AirPort Exteme Integrated 802.11a/b/g and draft-n (n enabled)
    Internal Slot-Loading  4× DVD+R DL writes, 8× DVD±R read, 4× DVD±RW writes, 24× CD-R, and 10x CD-RW recording
    OS  Mac OS X v10.5.4
    Weight  5.0 lb/2.3 kg
     Dimension 1.08 x 12.78 x 8.92 in/27.5 x 325 x 227 mm

    First do this thing to check whether the Mac is supported or not :
    $ ioreg -p IODeviceTree -w0 -l | grep firmware-abi
    $ | |   "firmware-abi" = <"EFI64">


    If you get "EFI 64". It's mean your MacBook is supported.

    $sudo -s  --> make you come a root BE CAREFULL!!!

    #cd /User/yourusername/Downloads/
    #cp boot64.efi /System/Library/CoreServices/
    #cd /System/Library/CoreServices/
    #chown root:wheel boot64.efi
    #chflags uchg boot64.efi

    #bless --folder /System/Library/CoreServices --file /System/Library/CoreServices/boot64.efi

    After it's done, still under root go to :

    #vi /Library/Preferences/SystemConfiguration/com.apple.Boot.plist

    press 'i' then add this 'arch=x86_64'.

    Kernel Flags
    arch=x86_64



    Press 'esc' and the type ':wq' then restart the machine immediately 'shutdown -r now'. It will take quite long time for the first loading.






    If the Mac comes withe problem before you go in, then just insert your installation disk then open terminal. Type in :


    sudo bless --folder /Volumes/VolumesNames/System/Library/CoreServices --file /Volumes/VolumesNames/System/Library/CoreServices/boot.efi


    Restart the machine after that it will works normal.


    File you need to dowload:


    1. boot64.efi files
    2. HexEdit Just in case do you needed.


    Regards,
    феникс

    Sunday, April 4, 2010

    DRBD Server with OpenVZ

    Installing DRBD with OpenVZ (CentOS 5.3) by 林观生

    ==========================================================

    20GB for /

    40GB for /vz

    260GB for drbd device -> don’t do anything just put as a software raid.



    Install CentOS 5.3 as an usual

    turn off the iptables and selinux

    #turn off firewall

    chkconfig iptables off



    #update the OS

    yum -y update



    #restart first so will bootup wih the kernel if they have kernel update

    shutdown -r now



    #crontab

    yum -y install vixie-cron ntp

    /usr/sbin/ntpdate sg.pool.ntp.org

    crontab -e

    30 03 * * * /usr/sbin/ntpdate sg.pool.ntp.org



    #OpenVZ

    cd /etc/yum.repos.d

    wget http://download.openvz.org/openvz.repo

    rpm —import http://download.openvz.org/RPM-GPG-Key-OpenVZ

    yum search ovzkernel

    yum install ovzkernel.i686

    yum install ovzkernel-devel.i686





    vi /boot/grub/grub.conf (Edit File)

    —-



    default 0



    title OpenVZ (See Kernel which countain stab)




    —-



    vi /etc/sysctl.conf (Edit File)

    —-

    # packet forwarding enabled and proxy arp disabled

    net.ipv4.ipforward = 1

    net.ipv4.conf.default.proxyarp = 0





    # Controls source route verification

    net.ipv4.conf.default.rpfilter = 1




    # Do not accept source routing

    net.ipv4.conf.default.acceptsourceroute = 0




    # Controls the System Request debugging functionality of the kernel

    kernel.sysrq = 1




    # we do not want all our interfaces to send redirects

    net.ipv4.conf.default.sendredirects = 1


    net.ipv4.conf.all.sendredirects = 0




    # Controls whether core dumps will append the PID to the core filename.

    # Useful for debugging multi-threaded applications.

    kernel.coreusespid = 1

    —-



    yum -y install vzctl vzquota



    Reboot the machine, use the new kernel (Contain OpenVZ)

    shutdown -r now





    vi /etc/fstab






    /dev/md1 /vz.orig ext3 defaults 1 2







    Install HeartBeat

    ==========================================================

    yum search heartbeat

    yum -y install heartbeat.i386 heartbeat-devel.i386

    yum -y install heartbeat



    Create 3 files on both side

    —————————————————————————————-



    1)vi ha.cf (Create File)

    —————-

    logfile /var/log/ha-log

    logfacility local0

    uselogd yes


    node server1

    node server2

    keepalive 2

    deadtime 10

    initdead 120

    udpport 694

    bcast eth1

    autofailback yes

    respawn hacluster /usr/lib/heartbeat/ipfail

    —————-



    2)vi haresources (Create File

    ————————-

    server1 192.168.1.155 \

    drbddisk::r0 Filesystem::/dev/drbd0::/vz::ext3 \

    openvz

    ————————-



    3) vi authkeys (Create File)

    —————-

    auth 1

    1 crc

    —————-



    chmod 600 /etc/ha.d/authkeys



    /etc/init.d/heartbeat start



    #put as the startup

    chkconfig —add heartbeat

    chkconfig heartbeat on

    chkconfig —list | grep ‘heartbeat’



    ++++++++++++++++++++++++++++++++

    heartbeat 0:off 1:off 2:on 3:on 4:on 5:on 6:off

    ++++++++++++++++++++++++++++++++



    #Do ifconfig command should be show like this

    ….

    eth0:0 Link encap:Ethernet HWaddr 00:1A:92:1C:C4:E8

    inet addr:192.168.1.199 Bcast:192.168.1.255 Mask:255.255.255.0

    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

    Interrupt:169

    …..



    #Turn down one machine make it sure the floating IP is moved.





    Install DRBD

    ==========================================================

    search DRBD Pakcage

    yum search drbd



    #If you want configure the kernel header manual don’t install the kmod

    yum -y install drbd82.i686 kmod-drbd82.i686



    #restart the machine

    shutdown -r now



    mdadm —create -l 1 -n 2 /dev/md2 /dev/sda3 /dev/sdb3



    vi /etc/drbd.conf (Edit File)



    —————————————————————————————————————

    global {

    usage-count yes;

    }

    common {

    protocol C;

    syncer { rate 100M; } --&gt; Put in this rate or it will take quite long time.

    }

    resource r0 {

    device /dev/drbd0;

    disk /dev/md2;

    meta-disk internal;

    on server1 {

    address 15.5.19.87:7789;

    }

    on server2 {

    address 15.5.19.88:7789;

    }

    }

    ——————————————————————————————————————



    #add DRBD to metadata

    drbdadm create-md r0

    drbdadm attach r0

    drbdadm syncer r0

    drbdadm connect r0

    cat /proc/drbd



    ==========================================================

    +version: 8.2.6 (api:88/proto:86-88) ++GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by pavel@xemulnb.sw.ru, 2008-09-30 17:46:13 ++ 0: cs:Connected st:Primary/Secondary ds:Inconsistent/Inconsistent C r—- ++ ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 oos:0 +

    ==========================================================

    #do this on your primary machine (Master)

    drbdadm — —overwrite-data-of-peer primary r0



    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    |version: 8.2.6 (api:88/proto:86-88) ||GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by pavel@xemulnb.sw.ru, 2008-09-30 17:46:13 || 0: cs:SyncTarget st:Secondary/Primary ds:Inconsistent/UpToDate C r—- || ns:0 nr:75266976 dw:75259232 dr:0 al:0 bm:4592 lo:243 pe:472 ua:242 ap:0 oos:170495532 || [=====>…………..] sync’ed: 30.7% (166499/239994)M || finish: 0:35:38 speed: 79,604 (58,520) K/sec |

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++





    Configure DRBD that it can works with OpenVZ

    ===========================================================

    #turn off the VZ service —> will be turn it on bt the script

    chkconfig vz off



    /etc/init.d/drbd status



    #make sure the drbd drive mounted to vz directory.

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    |version: 8.2.6 (api:88/proto:86-88) || GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by pavel@xemulnb.sw.ru, 2008-09-30 17:46:13 ||m:res cs st ds p mounted fstype ||0:r0 Connected Primary/Secondary UpToDate/UpToDate C /vz ext3 |

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



    mv /etc/vz /etc/vz.orig

    mv /etc/sysconfig/vz-scripts /etc/sysconfig/vz-scripts.orig

    mv /var/vzquota /var/vzquota.orig

    ln -s /vz/cluster/etc/vz /etc/vz

    ln -s /vz/cluster/etc/sysconfig/vz-scripts /etc/sysconfig/vz-scripts

    ln -s /vz/cluster/var/vzquota /var/vzquota



    #do this only in primary

    cp -a /vz.orig/* /vz/

    mkdir -p /vz/cluster/etc

    mkdir -p /vz/cluster/etc/sysconfig

    mkdir -p /vz/cluster/var

    cp -a /etc/vz.orig /vz/cluster/etc/vz/

    cp -a /etc/sysconfig/vz-scripts.orig /vz/cluster/etc/sysconfig/vz-scripts

    cp -a /var/vzquota.orig /vz/cluster/var/vzquota



    #do this on both side



    mkdir /root/live-switchover

    ln -s /root/live-switchover/openvz /etc/init.d/



    #Copy the 4 script to /root/live-switchover & put chmod 755 to all files.



    restart the machine



    ^
    ^ DRBD works…



    Install OpenVZ

    ==========================================================

    vzsplit -n 1 -f vps.1

    cd /vz/template/cache/

    wget http://download.openvz.org/contrib/template/precreated/centos-5-i386-default.tar.gz



    vzctl create 1001 —ostemplate centos-5-i386-default —config vps.1

    vzctl set 1001 —onboot yes —save

    vzctl set 1001 —hostname server11.netdns.net —save

    vzctl set 1001 —ipadd 20x.xxx.xxx.xxx —save

    vzctl set 1001 —nameserver 208.67.220.220 —save



    #manual config use this file

    vi /etc/vz/conf/1001.conf



    # highest upper limit

    vzctl set 1001 —kmemsize 2147483647:2147483647 —save

    vzctl set 1001 —lockedpages 2147483647:2147483647 —save

    vzctl set 1001 —privvmpages 2147483647:2147483647 —save

    vzctl set 1001 —shmpages 2147483647:2147483647 —save

    vzctl set 1001 —numproc 2147483647:2147483647 —save

    vzctl set 1001 —numtcpsock 2147483647:2147483647 —save

    vzctl set 1001 —numflock 2147483647:2147483647 —save

    vzctl set 1001 —numpty 2147483647:2147483647 —save

    vzctl set 1001 —numsiginfo 2147483647:2147483647 —save

    vzctl set 1001 —tcpsndbuf 2147483647:2147483647 —save

    vzctl set 1001 —tcprcvbuf 2147483647:2147483647 —save

    vzctl set 1001 —othersockbuf 2147483647:2147483647 —save

    vzctl set 1001 —dgramrcvbuf 2147483647:2147483647 —save

    vzctl set 1001 —numothersock 2147483647:2147483647 —save

    vzctl set 1001 —dcachesize 2147483647:2147483647 —save

    vzctl set 1001 —numfile 2147483647:2147483647 —save

    vzctl set 1001 —numiptent 2147483647:2147483647 —save

    vzctl set 1001 —diskspace 1423360000:1433600000 —save

    vzctl set 1001 —diskinodes 1390000000:1400000000 —save





    # start VPS

    vzctl start 1001



    # chk status

    vzctl status 1001



    # vzctl exec allows executing any commands in the Virtual Private Server context.

    vzctl exec 1001 ping localhost



    Regards,

    феникс