linux

linux

Selasa, 27 Agustus 2013

rdiff-backup on slackware

rdiff-backup is tool for backup data :
in slackware do this following

http://rdiff-backup.nongnu.org/

download from  slackbuild :
http://slackbuilds.org/repository/14.0/system/rdiff-backup/

rdiff-bacup need libsync and you can download from :
http://slackbuilds.org/repository/14.0/libraries/librsync/

librsync-0.9.7.tar.gz
librsync.tar.gz

tar -xzvf librsync.tar.gz
mv librsync-0.9.7.tar.gz  librsync/
cd librsync

check your os with uname -a  ( i486  or x86_64 )
edit librsync.SlackBuild use nano or another editor :
#ARCH=${ARCH:-i486}        ---- > if you use i486
ARCH=${ARCH:-x86_64}      ------> if you use x86_64

baru : ./librsync.SlackBuild

cd /tmp
installpkg librsync-0.9.7-x86_64-1_SBo.tgz

rdiff-backup.SlackBuild
rdiff-backup-1.2.8.tar.gz

tar -xzvf rdiff-backup-1.2.8.tar.gz
cd rdiff-backup-1.2.8
python setup.py install

backup folder to another forder :
rdiff-backup  /opt/db/data  /mnt/backup/data/

restore :
rdiff-backup -r 2012-11-29T21:42:43+07:00 192.168.168.70::/home/ttk/test/backupaja /home/ttk/test/backupres

for more example and detail see at :
http://rdiff-backup.nongnu.org/

Rabu, 30 Mei 2012

route windows

To display the entire contents of the IP routing table, type:

route print

To display the routes in the IP routing table that begin with 10., type:

route print 10.*

To add a default route with the default gateway address of 192.168.12.1, type:

route add 0.0.0.0 mask 0.0.0.0 192.168.55.1
To add a route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0 and the next hop address of 10.27.0.1, type:

route add 10.41.0.0 mask 255.255.0.0 10.27.0.1

To add a persistent route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0 and the next hop address of 10.27.0.1, type:

route -p add 10.41.0.0 mask 255.255.0.0 10.27.0.1

To add a route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0, the next hop address of 10.27.0.1, and the cost metric of 7, type:

route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 metric 7

To add a route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0, the next hop address of 10.27.0.1, and using the interface index 0x3, type:

route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 if 0x3

To delete the route to the destination 10.41.0.0 with the subnet mask of 255.255.0.0, type:

route delete 10.41.0.0 mask 255.255.0.0

To delete all routes in the IP routing table that begin with 10., type:

route delete 10.*

To change the next hop address of the route with the destination of 10.41.0.0 and the subnet mask of 255.255.0.0 from 10.27.0.1 to 10.27.0.25, type:

route change 10.41.0.0 mask 255.255.0.0 10.27.0.25
-------------
-f : Clears the routing table of all entries that are not host routes (routes with a netmask of 255.255.255.255),
     the loopback network route (routes with a destination of 127.0.0.0 and a netmask of 255.0.0.0),
     or a multicast route (routes with a destination of 224.0.0.0 and a netmask of 240.0.0.0).
     If this is used in conjunction with one of the commands (such as add, change, or delete), the table is cleared prior to running the command.

-p : When used with the add command, the specified route is added to the registry
     and is used to initialize the IP routing table whenever the TCP/IP protocol is started.
     By default, added routes are not preserved when the TCP/IP protocol is started.
     When used with the print command, the list of persistent routes is displayed. This parameter is ignored for all other commands.
     Persistent routes are stored in the registry location HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes.
-----------------------
To enable TCP/IP forwarding, follow these steps:

   1. Start Registry Editor (Regedit.exe).
   2. In Registry Editor, locate the following registry key:
      HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
   3. Set the following registry value:
      Value Name: IPEnableRouter
      Value type: REG_DWORD
      Value Data: 1
      A value of 1 enables TCP/IP forwarding for all network connections that are installed and used by this computer.
   4. Quit Registry Editor.

Senin, 07 Mei 2012

IP scanner for linux

NMAP

for scan ip on the network just use nmap
if you want to know the up ip on our network just type :
nmap -sP 192.168.1.0/24

this will show  :
Host gw1.ipos.net (192.168.1.1) is up (0.00014s latency).    
MAC Address: 00:0C:42:BC:4D:9A (Routerboard.com)            
Host hplj1200.ipos.net (192.168.1.5) is up (0.0019s latency).
MAC Address: 00:11:0A:ED:52:43 (Hewlett Packard)            
Host hplj2200.ipos.net (192.168.1.6) is up (0.0020s latency).
MAC Address: 00:11:0A:ED:52:B9 (Hewlett Packard)            
Host hpljc4500.ipos.net (192.168.1.7) is up (0.00035s latency).
MAC Address: 08:00:37:97:B2:22 (Fuji-xerox CO.)             
Host 192.168.1.9 is up (0.0011s latency).                   
MAC Address: 00:1A:4B:1F:EB:0A (Hewlett Packard)            
Host 192.168.1.10 is up (0.00079s latency).            


for more simple use :
nmap -sP 192.168.1.0/24 | grep Host 


this will show :
Host gw1.ipos.net (192.168.1.1) is up (0.00012s latency).       
Host hplj1200.ipos.net (192.168.1.5) is up (0.0019s latency).   
Host hplj2200.ipos.net (192.168.1.6) is up (0.0019s latency).   
Host hpljc4500.ipos.net (192.168.1.7) is up (0.00044s latency).
Host 192.168.1.9 is up (0.0011s latency).                       
Host 192.168.1.10 is up (0.00098s latency).                     
Host 192.168.1.11 is up (0.0015s latency).                      
Host 192.168.1.12 is up (0.00024s latency).                     
Host 192.168.1.13 is up (0.00081s latency).                     
Host 192.168.1.15 is up (0.00046s latency). 



for range ip 192.168.1.50 - 192.168.1.57 just type :

nmap -sP 192.168.1.50-57 | grep Host


this will show
Host januar.ipos.net (192.168.1.50) is up (0.00014s latency).
Host 192.168.1.51 is up (0.00042s latency).
Host 192.168.1.53 is up (0.00022s latency).
Host 192.168.1.56 is up (0.00055s latency).

Rabu, 18 April 2012

openvpn-2.2.2 with slackware 13.37 and 13.0

here bellow my simple openvpn client and master with tap
openvpn-2.2.2
slackware 13.37(master) and slackware 13.0(client)

ip  server               :192.168.1.234
ip openvpn server : 11.11.11.1
ip client                 :192.168.1.191
ip openvpn client  : 11.11.11.203

for the first download openvpn on http://openvpn.net/index.php/download.html
you can choose source Tarbal openvpn-2.2.2.tar.gz

follow the BOLD TEXT

copy this source to client
configure and install both server and client

modprobe tun

tar -xvf openvpn-2.2.2.tar.gz
cd openvpn-2.2.2
 ./configure
make
make install
-------------------------------------------------------------------------------------------------
==========================================

for server
==========================================
-----------------------------------------------------------------------------------------------

cp -a /yourpath/openvpn-2.2.2/easy-rsa  /etc/openvpn/
cp /yourpath/openvpn-2.2.2/sample-config-files/server.conf /etc/openvpn/

create keys :

cd /etc/openvpn/easy-rsa/2.0
source ./vars
-------------------------------------------------------------------------------------

root@HO-pgpool:/etc/openvpn/easy-rsa/2.0# source ./vars
NOTE: If you run ./clean-all, I will be doing a rm -rf on /etc/openvpn/easy-rsa/2.0/keys
---------------------------------------------------------------------------------------------------
./clean-all
./build-ca
----------------------------------------------------------------------------------------------------
root@HO-pgpool:/etc/openvpn/easy-rsa/2.0# ./build-ca
Generating a 1024 bit RSA private key
.............++++++
....................++++++
writing new private key to 'ca.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [US]:
State or Province Name (full name) [CA]:
Locality Name (eg, city) [SanFrancisco]:
Organization Name (eg, company) [Fort-Funston]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [changeme]:
Name [changeme]:servervpn
Email Address [mail@host.domain]:
----------------------------------------------------------------------------------------------------
./build-key-server servervpn
----------------------------------------------------------------------------------------------------
root@HO-pgpool:/etc/openvpn/easy-rsa/2.0# ./build-key-server servervpn
Generating a 1024 bit RSA private key
..........++++++
......................................................++++++
writing new private key to 'servervpn.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [US]:
State or Province Name (full name) [CA]:
Locality Name (eg, city) [SanFrancisco]:
Organization Name (eg, company) [Fort-Funston]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [servervpn]:
Name [changeme]:
Email Address [mail@host.domain]:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Using configuration from /etc/openvpn/easy-rsa/2.0/openssl-0.9.8.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName           :PRINTABLE:'US'
stateOrProvinceName   :PRINTABLE:'CA'
localityName          :PRINTABLE:'SanFrancisco'
organizationName      :PRINTABLE:'Fort-Funston'
organizationalUnitName:PRINTABLE:'changeme'
commonName            :PRINTABLE:'servervpn'
name                  :PRINTABLE:'changeme'
emailAddress          :IA5STRING:'mail@host.domain'
Certificate is to be certified until Apr 16 07:46:46 2022 GMT (3650 days)
Sign the certificate? [y/n]:y


1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
-------------------------------------------------------------------------------------------------------
./build-key branch1
-------------------------------------------------------------------------------------------------------
root@HO-pgpool:/etc/openvpn/easy-rsa/2.0#  ./build-key branch1
Generating a 1024 bit RSA private key
.......++++++
..++++++
writing new private key to 'branch1.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [US]:
State or Province Name (full name) [CA]:
Locality Name (eg, city) [SanFrancisco]:
Organization Name (eg, company) [Fort-Funston]:
Organizational Unit Name (eg, section) [changeme]:
Common Name (eg, your name or your server's hostname) [branch1]:
Name [changeme]:
Email Address [mail@host.domain]:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Using configuration from /etc/openvpn/easy-rsa/2.0/openssl-0.9.8.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName           :PRINTABLE:'US'
stateOrProvinceName   :PRINTABLE:'CA'
localityName          :PRINTABLE:'SanFrancisco'
organizationName      :PRINTABLE:'Fort-Funston'
organizationalUnitName:PRINTABLE:'changeme'
commonName            :PRINTABLE:'branch1'
name                  :PRINTABLE:'changeme'
emailAddress          :IA5STRING:'mail@host.domain'
Certificate is to be certified until Apr 16 07:50:56 2022 GMT (3650 days)
Sign the certificate? [y/n]:y


1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
-------------------------------------------------------------------------------------------------------
./build-dh

--------------------------------------------------------------------------------------------------------
root@HO-pgpool:/etc/openvpn/easy-rsa/2.0# ./build-dh
Generating DH parameters, 1024 bit long safe prime, generator 2
This is going to take a long time
..+....................................................
.+...........................................+.........
............++*++*++*
----------------------------------------------------
root@HO-pgpool:/etc/openvpn/easy-rsa/2.0# ls keys/
01.pem       branch1.csr  ca.key      index.txt.attr      serial         servervpn.csr
02.pem       branch1.key  dh1024.pem  index.txt.attr.old  serial.old     servervpn.key
branch1.crt  ca.crt       index.txt   index.txt.old       servervpn.crt
----------------------------------------------------------------------------------------------------
cd keys
mkdir /etc/openvpn/keys
cp ca.crt dh1024.pem servervpn.crt servervpn.key /etc/openvpn/keys/
cd /etc/openvpn/

create server.conf

nano server.conf
----------------------------------------------------------------------------------------------------------
local 192.168.1.234
port 1194
proto tcp-server
dev tap
ca ca.crt
cert servervpn.crt
key servervpn.key  # This file should be kept secret
dh dh1024.pem
mode server
tls-server
ifconfig 11.11.11.1 255.255.255.0
ifconfig-pool 11.11.11.200 11.11.11.254 255.255.255.0
#push "ifconfig 10.11.204.201 255.255.255.0"
#push "route 192.168.168.0 255.255.255.0 10.11.204.1"
#push "route 192.168.188.0 255.255.255.0 10.11.204.1"
#push "route 192.168.77.0 255.255.255.0 10.11.204.1"
push "route 0.0.0.0 0.0.0.0 11.11.11.1"

client-config-dir /etc/openvpn/ccd
keepalive 10 120
cipher BF-CBC        # Blowfish (default)
comp-lzo
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
log-append  /var/log/openvpn.log

verb 3
;mute 20
--------------------------------------------------------------------------------------------------------


create stater file executable

nano stater.sh
----------------------------------------------------------------------------------------------------
#!/bin/sh
/usr/sbin/openvpn --cd /etc/openvpn/keys --daemon --config /etc/openvpn/server.conf
-----------------------------------------------------------------------------------------------------

chmod a+x stater.sh

create ccd directory
mkdir /etc/openvpn/ccd
cd ccd
nano branch1
-----------------------------------------------------------------------------------------------------
ifconfig-push 11.11.11.203 255.255.255.0
-----------------------------------------------------------------------------------------------------

with file branch1 will give ip client 11.11.11.203

running the vpn server
./stater.sh

you can check with
ifconfig
you will find tap0 the vpn ip
-----------------------------------------------------------------------------------------------------
root@HO-pgpool:/etc/openvpn# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:16:e6:5f:75:ee
          inet addr:192.168.1.234  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::216:e6ff:fe5f:75ee/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:47417 errors:0 dropped:727 overruns:0 frame:0
          TX packets:5610 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7341469 (7.0 MiB)  TX bytes:1589473 (1.5 MiB)
          Interrupt:23 Base address:0xe000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1032 (1.0 KiB)  TX bytes:1032 (1.0 KiB)

tap0      Link encap:Ethernet  HWaddr c6:2a:36:10:d5:1a
          inet addr:11.11.11.1  Bcast:11.11.11.255  Mask:255.255.255.0
          inet6 addr: fe80::c42a:36ff:fe10:d51a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 B)  TX bytes:238 (238.0 B)
---------------------------------------------------------------------------------------------------
scp branch1.crt  branch1.key ca.crt 192.168.1.191:/etc/openvpn/keys/
root@192.168.1.191's password:
branch1.crt                                              100% 4012     3.9KB/s   00:00
branch1.key                                              100%  887     0.9KB/s   00:00
ca.crt                                                   100% 1387     1.4KB/s   00:00
----------------------------------------------------------------------------------------------------
===========================================
             for client
===========================================
---------------------------------------------------------------------------------------------------
modprobe tun
cd /etc/openvpn/

create stater

nano stater.sh
----------------------------------------------------------------------------------------------------
#!/bin/sh
/usr/sbin/openvpn --cd /etc/openvpn/keys --daemon --config /etc/openvpn/client.conf
--------------------------------------------------------------------------------------------------------

chmod a+x stater.sh
create client.conf

nano client.conf
-------------------------------------------------------------------------------------------------------
client
dev tap
proto tcp
remote 192.168.1.234
resolv-retry infinite
nobind
persist-key
persist-tun

ca ca.crt
cert branch1.crt
key branch1.key

comp-lzo
verb 3

mute 20

log-append /var/log/openvpncli.log
------------------------------------------------------------------------------------------------------


run the vpnclient
./stater.sh

and see the tap with ifconfig
ifconfig
------------------------------------------------------------------------------------------------------
root@<o000o>:/etc/openvpn# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:16:e6:df:58:de
          inet addr:192.168.1.191  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::216:e6ff:fedf:58de/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:66215295 errors:0 dropped:0 overruns:0 frame:0
          TX packets:43617824 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:16847421334 (15.6 GiB)  TX bytes:5671321099 (5.2 GiB)
          Interrupt:25 Base address:0xe000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1111 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1111 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:110499 (107.9 KiB)  TX bytes:110499 (107.9 KiB)

tap0      Link encap:Ethernet  HWaddr ce:2a:d0:9a:99:26
          inet addr:11.11.11.203  Bcast:11.11.11.255  Mask:255.255.255.0
          inet6 addr: fe80::cc2a:d0ff:fe9a:9926/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 B)  TX bytes:168 (168.0 B)
------------------------------------------------------------------------------------------------------
test connction to vpn server with ping
ping 11.11.11.203

root@<o000o>:/etc/openvpn# ping 11.11.11.203
PING 11.11.11.203 (11.11.11.203) 56(84) bytes of data.
64 bytes from 11.11.11.203: icmp_seq=1 ttl=64 time=0.023 ms
64 bytes from 11.11.11.203: icmp_seq=2 ttl=64 time=0.013 ms
64 bytes from 11.11.11.203: icmp_seq=3 ttl=64 time=0.013 ms
64 bytes from 11.11.11.203: icmp_seq=4 ttl=64 time=0.014 ms
64 bytes from 11.11.11.203: icmp_seq=5 ttl=64 time=0.014 ms
^C
--- 11.11.11.203 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.013/0.015/0.023/0.005 ms
----------------------------------------------------------------------------------------------
if you can not find the tap please see log at :
/var/log/syslog
/var/log/openvpn.log

ping with real ip
ping 192.168.88.21 -I eth0


==============================================
Multi client or add new client
==============================================


you can create connection with many client
example :branch2 branch3 branch4  ...

just create again the client keys on server
cd /etc/openvpn/easy-rsa/2.0/
source ./vars
( do not ./clean-all )
./build-key branch2
./build-key branch3
. . .
 
and add file branch2 branch3 ... on /etc/openvpn/ccd/ directory ( on server )
nano branch2
-----------------------------------------------------------------------------------------------------
ifconfig-push 11.11.11.203 255.255.255.0
-----------------------------------------------------------------------------------------------------
nano branch3
-----------------------------------------------------------------------------------------------------
ifconfig-push 11.11.11.204 255.255.255.0
-----------------------------------------------------------------------------------------------------
and then create client again for branch2 and branch3

this configuration work on my  openvpn

enjoy your vpn
happy slackware........

othersite :

http://www.techrepublic.com/blog/opensource/how-to-set-up-an-openvpn-server/1873

http://xmalakaji.wordpress.com/2010/09/04/konfigurasi-openvpn-di-slackware/
http://www2.essex.ac.uk/cs/openvpn/windows7/setup-windows7.htm

http://www.fiberworks.com/Support/OpenVPN/tabid/171/language/en-US/Default.aspx

http://nikinuryadin.wordpress.com/2010/04/16/step-by-step-setting-up-openvpn-in-debian-with-routing-tun-connection/

Rabu, 04 April 2012

nslookup

this for testing domain has been resolve by dns server

 check with www.who.is

root@<o000o>:~# nslookup
> server 202.158.20.1  Default server: 202.158.20.1
Address: 202.158.20.1#53
> apps.ipotindonesia.com
Server:         202.158.20.1
Address:        202.158.20.1#53

** server can't find apps.ipotindonesia.com.test1.ipc.net: REFUSED
>
>
> server 202.59.169.226
Default server: 202.59.169.226
Address: 202.59.169.226#53
> apps.ipotindonesia.com
Server:         202.59.169.226
Address:        202.59.169.226#53

Name:   apps.ipotindonesia.com
Address: 180.150.245.161
>
> server 202.158.40.1
Default server: 202.158.40.1
Address: 202.158.40.1#53
> apps.ipotindonesia.com
Server:         202.158.40.1
Address:        202.158.40.1#53

** server can't find apps.ipotindonesia.com.test1.ipc.net: REFUSED

Senin, 26 Maret 2012

RAID SOFTWARE LINUX

Hemmm...This is only my note.....
create raid software in linux  with mdadm
with this mdadm i can create raid 0,1,10,and 5

prepare the disks,
command for create :
mdadm --create /dev/md0 --verbose --level=[level] --raid-devices=[number of disk] [member disk]
example:
mdadm --create /dev/md0 --verbose --level=raid1 --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm --create /dev/md0 --verbose --level=raid5 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1

command for state raid :
cat /proc/mdstat
mdadm --detail /dev/md0

example :
root@totok:~# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]
md0 : active raid1 nbd1[1] nbd0[0]
1999936 blocks [2/2] [UU]
[=======>.............] resync = 38.7% (777152/1999936) finish=0.3min speed=59780K/sec

root@totok:/mnt# mdadm --detail /dev/md0
Version : 0.90
Creation Time : Sun Oct 31 19:53:26 2010
Raid Level : raid5
Array Size : 5860535808 (5589.04 GiB 6001.19 GB)
Used Dev Size : 1953511936 (1863.01 GiB 2000.40 GB)
Raid Devices : 4
Total Devices : 4
Preferred Minor : 0
Persistence : Superblock is persistent

Update Time : Sun Mar 27 21:18:45 2011
State : clean
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0

Layout : left-symmetric
Chunk Size : 64K

UUID : 829aacd2:bf52a9d7:f190e036:dc0a4837
Events : 0.36

Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 8 17 1 active sync /dev/sdb1
2 8 33 2 active sync /dev/sdc1
3 8 49 3 active sync /dev/sdd1

 if one memberdisk on the array RAID is fail we can add the new member disk:
mdadm /dev/md0 -a /dev/sda1

this for boot loader  using lilo and grub :
===================
For LILO configuration:
 - When asked about LILO, choose the "simple" setup.
 - When asked about additional "append=" parameters, RAID 0 and
   RAID 5 users should type in "root=/dev/md0", to ensure that the proper
   array is mounted on / at bootup.
 - When asked about where to install LILO, choose MBR.
    Start by switching into your actual installation directory:
 - chroot /mnt

Let's make sure LILO boots from the RAID arrays properly.  Using your
favorite editor (vim/nano/pico), edit /etc/lilo.conf:
 - add a new line (add it anywhere, but don't indent it):
     raid-extra-boot = mbr-only
 - You will need to change the following line:
     boot = <something>
   RAID 0 and RAID 5 users, change it to:
     boot = /dev/md2
   RAID 1 users, change it to:
     boot = /dev/md0
 
 - Save the file and exit your editor.
 - run "lilo".
for Grub :
http://slackbuilds.org/repository/13.1/system/grub2/
download :ftp://alpha.gnu.org/gnu/grub/grub-1.98.tar.gz
          http://slackbuilds.org/slackbuilds/13.1/system/grub2.tar.gz

tar -xvf grub2.tar.gz
mv grub-1.98.tar.gz grub2/
cd grub2
./grub2.SlackBuild
cd /tmp
installpkg grub2-1.98-x86_64-2_SBo.tgz
cat /proc/mdstat
grub-install /dev/md0

berikut ini  pilihan bisa 2 cara :
1.grub-mkconfig -o /boot/grub/grub.cfg
  hasilnya masih kosong...
2.copy grub.cfg
  cp /usr/doc/grub2-1.98/grub.cfg /boot/grub2/
 
saya pilih yang no 2.
edit file grub.cfg jadi :
---------------------------------------------------------------
#
# Sample GRUB configuration file
#

# Boot automatically after 30 secs.
set timeout=10

# By default, boot the first entry.
set default=0

# Fallback to the second entry.
set fallback=1


# For booting GNU/Linux
menuentry "linuxslac_serever" {
        set root='(md0)'
        linux /boot/vmlinuz root=/dev/md0
        initrd
}

# Change the colors.
menuentry "Change the colors" {
        set menu_color_normal=light-green/brown
        set menu_color_highlight=red/blue
}

RAID 10
if you using raid 10 and the raid member are /dev/sda1,/dev/sdb1,/dev/sdc1,/dev/sdd1

for testting
if the fist fisical hdd remove from server the os still running and you can attach the new harddisk on server and then
check for new hdd with fdisk -l | grep dev
and compare with mdadm --detail /dev/md0
for new hdd
fdisk /dev/sdd  create for type is fd ( linux raid autodetect )

and then mdadm /dev/md0 -a /dev/sdd1

and you can see the /dev/md0 rebuild
if the system still rebuilding and you restart the server if the first hdd on bios is new hdd the system would not boot,
for boot up the system you must change the first bios for other old hdd.
when the system up the /dev/md0 will re-building from 0 % ( cat /proc/mdstat )

note : after replace with new disk you must type grub-install /dev/md0 to write
grub.conf to new disk