存档

作者存档

mount Soft RAID when restart system

2006年8月9日 没有评论

In the morning, I rebooted my computer, and found soft raid 0 made yesterday had been unavailable.Even I tried the steps like yesterday doing, but the RAID still could not be rebuild.

Later,More tell me using the following command to remount the RAID:
# mdadm -A /dev/md0 /dev/hdb /dev/hdc
and then check the /proc/mdstat, yes, not only the RAID was found but also, all the date on the RAID are still here!

RAID has two forms, striping and partity.In fact,RAID 0 was not really RAID because it isn’t redundant. RAID has good write and read performance. There are two important parameters: Strip, and chunk size. Strip means the whole array’s transfer rate per second, which is always used by hardware controllers. Chunk size,belong to Linux kernel, is the single disk’s rate.

RAID1 is mirroing, good read performance nearly twice of the single one, but not good at writing performance for writing data to two disks at time.RAID 2,RAID3 are useless, and RAID 4 just like RAID 5,which has one dedicated disk to save paritition information.

分类: 科技 标签:

Make soft RAID on linux and create big file

2006年8月8日 没有评论

For we want to test big file transation in NFS, Spring gave me two IDE harddisk and ask me to install them in my computer which os is centos4.3. There were some trouble during the recognizing harddisk, only two IDE harddisks could be found, the other one disappeared even I changed the jumps. I feel a litter disappointed but not gave up. I put the “disappear” harddisk in the primary IDE connectors, it was recognize rightly! What’s wrong?

I looked at the mainboard carefully, then found that this board has four IDE connectors:Primary IDE,Slave IDE, Primary RAID IDE and Slave RAID IDE,I just put the third harddisk in the Slave RAID IDE slot! After changed the cable to slave IDE slot, everything is ok. The system found three harddisk as I wanted.

How to make soft RAID on linux?
First I downloaded RAID tools(raidtools), and edited the /etc/raidtab file as the following:
[root@localhost ~]# vi /etc/raidtab
raiddev /dev/md0
raid-level 0
nr-raid-disks 2
chunk-size 32
persistent-superblock 1
device /dev/hdb
raid-disk 0
device /dev/hdc
raid-disk 1
and then issued the “mdraid /dev/md0”, note, “/dev/md0” had been created when installed the “raidtools” package.It failed with some error messages which said /dev/hdb had been part of RAID? Why? My second IDE harddisk was just taken in the computer! Later, More explained that perhaps the system created /dev/hdb automaticlly when I installed the Centos 4.3. I’m still confused with what he said.

Other way to make soft RAID was the “mdadm” program, downloaded from Internet,and installed it.Then I used the following steps to create soft RAID 0 successfully:
# cat /proc/partitions Checking HD partitions
# cat /proc/mdstat Checking RAID stat
# ls /dev/mapper
# dmsetup lower level logical volume management
# dmsetup table
# dmsetup remove pdc_jbaiadif remove /dev/hdb
# mdadm -C /dev/md0 –lever 0 -n /dev/hdb /dev/hdc (After issuing this step, there was still error saying /dev/hdb had been used as RAID, so I planed to stop RAID first)
# mdadm /dev/md0 –stop
Then,create RAID again:
# mdadm -C /dev/md0 –lever 0 -n /dev/hdb /dev/hdc
OK, the RAID 0 was created successfully.

How to create very large file by “dd” command?
Since I made RAID 0 to merge two harddisk’s capacies together(150G), I wanted to create a big file as large as 150G.
First, format the RAID partition and mount it to /mnt:
# mkfs /dev/md0
# mount /dev/md0 /mnt
Second, using “dd” command to create file:
# dd if=/dev/urandom of=targetfile_name
A large file would be created when full of the /mnt capacity.

分类: 科技 标签:

Good bye, Shenzhen

2006年7月30日 没有评论

Good bye, Shenzhen.
I’ll always return.

分类: 生活 标签:

New season

2006年7月29日 没有评论

I’ve resighed from Powerleader at Tuesday, July 27th 2006 and will start my new seaon on Linux development. In my PL days when put all my heart on Brandon,Sapello,and Star Lake, I am very appreciated to all my friends, both including Powerleader and Intel TMEs. I believe that I could not forget all your kindness and great support.

Former Powerleader friends: James, Chris, Yan, Gary(the best striker who kept the highest goal recorder of PL history, key player), Dave(Du Du)
Current Powerleader friends: Alan, Wang Yu, Chris(Xie Wenyu), Juliet, Wu Kang, Tiger, Zhu Lin,Zhang Kai, Yin Zhenxian, Zhang Yeping, Huang Xiaoyong, Luis (Xu Zhencheng),Qiao XiangYun(a very kind brother), Chen Junlian, Wang Ling, Nancy(Liang Xiaolei), Gao Hongfei, Ouyang Meiwang, Zephuros(Feng Qi)
Intel TMEs: Lily(Luo Xiaojing), Sun Peng, Yue Pengfei, Zhang Jianguo
Intel Support team: Cai Qing, Jiang Lei, Shen Yong, Zhao Qing

especial thanks to my best friends: Cheng Feng and Zhao Yu, you brothers always encourage me and help me to find myself when I was lost. It’s very lucky I have you two good brothers in Shenzhen.

Wish all of you well.

Now,it’s a new begining, new season starts. Go forward with no hesitance. I plan to use two years devoting on Linux. Forza!!!

分类: 生活 标签:

stty -echo

2006年5月17日 没有评论

stty,change and print terminal line settings.

stty -echo

It always use “-echo” parameter when input some characters could not seen by others, for example, password. We should echo the text for security reasons.

If the “stty -echo” command is executed, every typed characters were hidden, but the causing result displays as normal. How to dismiss this echo setting? Use a variable to keep the stty setting before echo typed character action.

# STTYSAVED=`stty -g`

-g:print all current settings in a stty-readable form

later, we could back to the former configuration for stty, # stty $STTYSAVED

every setting was recovered. We could see the typed characters again.

分类: 科技 标签:

exit and echo $?

2006年5月13日 没有评论

exit is very useful to debug the program, its syntax is : # exit n, Here n is a number between 0-255, if it is bigger than 255, for example, 256, the value retuned by issuing”echo $? ” will be evaluted in the following equation: n-255-1
That says, when n is 266, the returned result is 256-255-1 = 0 which is also the value of “$?”

eg:

# !/bin/bash
# ifexit
echo “Please input a number: ”
# input the testing number
read NUMB
# if statement
if [ “$NUMB” -eq “1” ]
then
echo “$NUMB = 1”
elif [ “$NUMB” -eq “2” ]
then
exit 222
else
exit 278
fi

Input | Output
—————————–
2 222
3 278-256=22

分类: 科技 标签:

Condition test

2006年5月10日 没有评论

test: is used for testing string, file and number.
expr: command testing and output the result

test
1.file testing: # test condition
or # [ condition ] (the are two space characters in each side of “condition” strings)
file testing have the following condition expressions:
-d: directory, to check if the directory exists or not
-f: general file
-L:this “L” is upcase,means link.
-r: readable
-w: is able to write
-x: is able to execute
-s: check the files length is bigger than 0, and NOT Null
-u: if there is suid been set.

logical expression:
-a: AND
-o: OR
!: NOT
for example: # [ -w test1.txt -a -w test2.txt ]
Pay attention here, # [ -w test1.txt ] -a [ -w test2.txt ] is wrong because only one pair [] could be used.

2.string testing
syntax: # test “string”
# test string_operator “string”
# test “string” string operator “string”
# [ string_operator string ]
# [ “string” string_operator “string”]
these string operators would be: ” = ” ,” != ” , “-z”, “-n”
-z: NULL
-n: NOT NULL
for example, to see if the EDITOR was NULL or not:
# [-z $EDITOR]
# echo $?
Is the EDITOR “vi”?
#[ $EDITOR = “vi” ]
# echo $?

# [ $TEST1 = $TEST2 ]
# echo $?

# [ $TEST1 != $TEST2 ]
# echo $?

3.numeric testing
syntax: # test “number” numeric_operator “number”
or # [ “number” numeric_operator “number” ]
The following operator are used here:
-eq: ==
-ne: !=
-gt:>
-lt:< -ge:>=

Expr: evaluation expressions
syntax: expr argument operator argument
Note,there must be two space characters in each side of “operator”, and when using “*”, the back slash should be added as “*”

分类: 科技 标签:

Vmware workstation 5.5 Installation

2006年5月10日 没有评论

I downloaded vmware workstation 5.5 from its official site, and then register for a evaluation lisence. Why I install vmware is I had to write some product whitepaper documents in Microsoft formation, since the openoffice of mandriva could not start up.

First, run “./vmware-install.pl”, there were some errors which said the source code package must be installed. OK, I found the souce code file in the 3rd Mandriva CD.and issued the following steps:

Locate kernel source in CD3 and then install it:
[root@phillip main3]# ls | grep kernel
kernel-source-2.6-2.6.12-12mdk.i586.rpm
[root@phillip main3]# rpm -ivh kernel-source-2.6-2.6.12-12mdk.i586.rpm
Preparing… ####################################[100%]
1:kernel-source-2.6 ###################################[100%]

Check the package:
[root@phillip main3]# rpm -qa kernel-source-2.6-2.6.12-12mdk.i586.rpm

Here I want to make sure that the package should have already been installed:
[root@phillip main3]# rpm -Uvh kernel-source-2.6-2.6.12-12mdk.i586.rpm
Preparing… #####################################[100%]
package kernel-source-2.6-2.6.12-12mdk is already installed

Check again:
[root@phillip main3]# rpm -qi kernel-source
package kernel-source is not installed
[root@phillip main3]# rpm -qa | grep kernel
kernel-source-2.6-2.6.12-12mdk
kernel-smp-2.6.12.12mdk-1-1mdk
How could “-i” make such result? Because “-i” means install, but here no package was identified.

Locate the kernel source directory:
[root@phillip main3]# cd /usr/src/
[root@phillip src]# ls
linux@ linux-2.6.12-12mdk/ RPM/
[root@phillip src]# file linux
linux/ linux-2.6.12-12mdk/
[root@phillip src]# file linux
linux: symbolic link to `linux-2.6.12-12mdk’
It means “linux” is the soft link of ” linux-2.6.12-12mdk “.Before installation, there are not any linux directory in the “/usr/src”.

Install vmware:
[root@phillip src]# cd /root/Downloads/
[root@phillip Downloads]# ls
OOA680_m1_native_packed-1_zh-CN.8990/
OOo_2.0.1_LinuxIntel_install_zh-CN.tar(1).gz*
OOO-Install.iso
vmware-any-any-update94/
vmware-any-any-update94.tar.gz
vmware-distrib/
VMware-workstation-5.5.1-19175.tar.gz
[root@phillip Downloads]# cd vmware-distrib/
[root@phillip vmware-distrib]# ls
bin/ doc/ etc/ FILES installer/ lib/ man/ vmware-install.pl@
[root@phillip vmware-distrib]# vmw
vmware vmware-mount.pl vmware-vdiskmanager
vmware-config.pl vmware-ping
vmware-loop vmware-uninstall.pl
[root@phillip vmware-distrib]# ./vmware-install.pl
A previous installation of VMware software has been detected.
The previous installation was made by the tar installer (version 3).
Keeping the tar3 installer database format.
Uninstalling the tar installation of VMware Workstation.
Stopping VMware services:
Virtual machine monitor [Done]
The removal of VMware Workstation 5.5.1 build-19175 for Linux completed successfully. Thank you for having tried this software. Installing the content of the package.
In which directory do you want to install the binary files?[/usr/bin]
What is the directory that contains the init directories (rc0.d/ to rc6.d/)?[/etc/rc.d]
What is the directory that contains the init scripts?[/etc/rc.d/init.d]
In which directory do you want to install the library files?[/usr/lib/vmware]
The path “/usr/lib/vmware” does not exist currently. This program is going to create it, including needed parent directories. Is this what you want? [yes]
In which directory do you want to install the manual files?[/usr/share/man]
In which directory do you want to install the documentation files?[/usr/share/doc/vmware]
The path “/usr/share/doc/vmware” does not exist currently. This program is going to create it, including needed parent directories. Is this what you want?[yes]
The installation of VMware Workstation 5.5.1 build-19175 for Linux completed successfully. You can decide to remove this software from your system at any time by invoking the following command: “/usr/bin/vmware-uninstall.pl”.
Before running VMware Workstation for the first time, you need to configure it by invoking the following command: “/usr/bin/vmware-config.pl”. Do you want this program to invoke the command for you now? [yes]
Making sure services for VMware Workstation are stopped.
Stopping VMware services:
Virtual machine monitor [Done]
You must read and accept the End User License Agreement to continue.
Press enter to display it. enter
END USER LICENSE AGREEMENT
FOR VMWARE(R) DESKTOP SOFTWARE PRODUCT

VMWARE, INC. LICENSES THIS DESKTOP SOFTWARE PRODUCT TO YOU SUBJECTTO THE TERMS CONTAINED IN THIS END USER LICENSE AGREEMENT (“EULA”).READ THE TERMS OF THIS EULA CAREFULLY. BY INSTALLING, COPYING OR OTHERWISE USING THE SOFTWARE (AS DEFINED BELOW), YOU AGREE TO BE BOUND BY THE TERMS OF THIS EULA. IF YOU DO NOT AGREE WITH THE TERMS OF THIS EULA, DO NOT DOWNLOAD, INSTALL, COPY OR USE THE SOFTWARE AND IF YOU HAVE PROOF OF PAYMENT, YOU MAY RETURN THE UNOPENED SOFTWARE TO THE LOCATION AT WHICH YOU ACQUIRED IT WITHIN THIRTY (30) DAYS
FOR A REFUND OF THE LICENSE FEE.
NOTICE TO CUSTOMER

This EULA is a contract between you (either an individual or an entity) and VMware, Inc. (“VMware”), which governs your use of the VMware software product that accompanies this EULA and related software components, which may include associated media, printed materials, and online or electronic documentation. This VMware software product is designed for installation and use on a personal computer only. You may not install or use this VMware
software product on a server.
Do you accept? (yes/no) yes
Thank you.
Configuring fallback GTK+ 2.4 libraries.
In which directory do you want to install the mime type icons? [/usr/share/icons]
What directory contains your desktop menu entry files? These files have a desktop file extension. [/usr/share/applications]
In which directory do you want to install the application’s icon? [/usr/share/pixmaps]
Trying to find a suitable vmmon module for your running kernel.
None of the pre-built vmmon modules for VMware Workstation is suitable for your running kernel. Do you want this program to try to build the vmmon module for your system (you need to have a C compiler installed on your system)? [yes]
Using compiler “/usr/bin/gcc”. Use environment variable CC to override.What is the location of the directory of C header files that match your running kernel? [/lib/modules/2.6.12-12mdksmp/build/include]
Extracting the sources of the vmmon module.
Building the vmmon module.
Using 2.6.x kernel build system.
make: Entering directory `/root/tmp/vmware-config0/vmmon-only’
make -C /lib/modules/2.6.12-12mdksmp/build/include/.. SUBDIRS=$PWD
SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-2.6.12-12mdk’
WARNING: Symbol version dump /usr/src/linux-2.6.12-12mdk/Module.symvers
is missing; modules will have no dependencies and modversions.
CC [M] /root/tmp/vmware-config0/vmmon-only/linux/driver.o
CC [M] /root/tmp/vmware-config0/vmmon-only/linux/hostif.o
CC [M] /root/tmp/vmware-config0/vmmon-only/common/cpuid.o
CC [M] /root/tmp/vmware-config0/vmmon-only/common/hash.o
CC [M] /root/tmp/vmware-config0/vmmon-only/common/memtrack.o
CC [M] /root/tmp/vmware-config0/vmmon-only/common/phystrack.o
CC [M] /root/tmp/vmware-config0/vmmon-only/common/task.o
CC [M] /root/tmp/vmware-config0/vmmon-only/common/vmx86.o
CC [M] /root/tmp/vmware-config0/vmmon-only/vmcore/moduleloop.o
LD [M] /root/tmp/vmware-config0/vmmon-only/vmmon.o
Building modules, stage 2.
MODPOST
CC /root/tmp/vmware-config0/vmmon-only/vmmon.mod.o
LD [M] /root/tmp/vmware-config0/vmmon-only/vmmon.ko
make[1]: Leaving directory `/usr/src/linux-2.6.12-12mdk’
cp -f vmmon.ko ./../vmmon.o
make: Leaving directory `/root/tmp/vmware-config0/vmmon-only’
The module loads perfectly in the running kernel.
Do you want networking for your virtual machines? (yes/no/help) [yes]
Configuring a bridged network for vmnet0.
Your computer has multiple ethernet network interfaces available: eth0, eth1.
Which one do you want to bridge to vmnet0? [eth0]
The following bridged networks have been defined:
. vmnet0 is bridged to eth0
Do you wish to configure another bridged network? (yes/no) [no]
Do you want to be able to use NAT networking in your virtual machines?
(yes/no)
[yes]
Configuring a NAT network for vmnet8.
Do you want this program to probe for an unused private subnet? (yes/no/help)
[yes]
Probing for an unused private subnet (this can take some time)…
The subnet 192.168.1.0/255.255.255.0 appears to be unused.
The following NAT networks have been defined:
. vmnet8 is a NAT network on private subnet 192.168.1.0.
Do you wish to configure another NAT network? (yes/no) [no]
Do you want to be able to use host-only networking in your virtual machines? [yes]
Configuring a host-only network for vmnet1.
Do you want this program to probe for an unused private subnet? (yes/no/help) [yes]
Probing for an unused private subnet (this can take some time)…
The subnet 172.16.74.0/255.255.255.0 appears to be unused.
The following host-only networks have been defined:
. vmnet1 is a host-only network on private subnet 172.16.74.0.
Do you wish to configure another host-only network? (yes/no) [no]
Extracting the sources of the vmnet module.
Building the vmnet module.
Using 2.6.x kernel build system.
make: Entering directory `/root/tmp/vmware-config0/vmnet-only’
make -C /lib/modules/2.6.12-12mdksmp/build/include/.. SUBDIRS=$PWD
SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-2.6.12-12mdk’
WARNING: Symbol version dump /usr/src/linux-2.6.12-12mdk/Module.symvers
is missing; modules will have no dependencies and modversions.
CC [M] /root/tmp/vmware-config0/vmnet-only/driver.o
CC [M] /root/tmp/vmware-config0/vmnet-only/hub.o
CC [M] /root/tmp/vmware-config0/vmnet-only/userif.o
CC [M] /root/tmp/vmware-config0/vmnet-only/netif.o
CC [M] /root/tmp/vmware-config0/vmnet-only/bridge.o
CC [M] /root/tmp/vmware-config0/vmnet-only/procfs.o
CC [M] /root/tmp/vmware-config0/vmnet-only/smac_compat.o
SHIPPED /root/tmp/vmware-config0/vmnet-only/smac_linux.x386.o
LD [M] /root/tmp/vmware-config0/vmnet-only/vmnet.o
Building modules, stage 2.
MODPOST
CC /root/tmp/vmware-config0/vmnet-only/vmnet.mod.o
LD [M] /root/tmp/vmware-config0/vmnet-only/vmnet.ko
make[1]: Leaving directory `/usr/src/linux-2.6.12-12mdk’
cp -f vmnet.ko ./../vmnet.o
make: Leaving directory `/root/tmp/vmware-config0/vmnet-only’
The module loads perfectly in the running kernel.
Starting VMware services:
Virtual machine monitor [Done]
Virtual ethernet [Done]
Bridged networking on /dev/vmnet0 [Done]
Host-only networking on /dev/vmnet1 (background) [Done]
Host-only networking on /dev/vmnet8 (background) [Done]
NAT service on /dev/vmnet8 [Done]
The configuration of VMware Workstation 5.5.1 build-19175 for Linux for this running kernel completed successfully.
You can now run VMware Workstation by invoking the following command:
“/usr/bin/vmware”.
Enjoy,
–the VMware team

Launch the vmware.
[root@phillip /]# cd /usr
[root@phillip usr]# cd bin
[root@phillip bin]# ./vmware
/usr/lib/vmware/bin/vmware: error while loading shared libraries:
libgnomevfs-2.so.0: cannot open shared object file: No such file or directory

At this time, the vmware GUI displayed. I’m successful.

By the way, this vmware is only evaluation revision, I registered in April 11th, and today it could not start up my virtual “Windows XP”. I tried to use other email and register for another free license, haha, It is perfect and so interesting, my “Windows” is able to run again!!!

分类: 科技 标签:

Quotation

2006年5月10日 没有评论

1.Double quotation “” is able to quota every strings except of back slash””, back quotation”`”(located nearby 1/! on the keyboard),and dollar”$” character.

2.Single quotation” could quota any strings including “,`$”.

3.Back quotation“,set the system output to variable. what was contain in pairs of “ will be issued as command. for example:
# echo ‘hello’ (single quotation)
hello
# echo `hello`
bash: hello: command no found
# echo `date`
2006年05月09日 星期二 (In my mandriva)
# mydate=`date`
# echo $mydate

How many users are logging on the system:
# echo “there is `who |wc-l` user in the system”

4.Back slash””: convertion
# echo *
it will list all the directy
# echo *
*
# echo “$99.99”
99.99
# echo “$99.99”
$99.99

分类: 科技 标签:

Environment variables

2006年5月10日 没有评论

All the processes share the environment variables, as the local variables.when log out, these configuration wil be invalid. So, it is usually to define the environment setting in “.profile” files.The system administrator have the privilege to pre-define some global variables in the “/etc/profile”, which means for every time the users log in, the system will be initialized by this variables exiting in the “/etc/profile”.

The global variables is always using upcase letters for distinction of other local variables.

Pay attention, issue the “export” command before the variables are used, otherwise, the variables do not take any effect in the processes.

1.Set the environment variables:
# VARIABLE_NAME=value;export VARIABLE_NAME
or # VARIABLE_NAME=value
# export VARIABLE_NAME

2.Show the value:
# echo $VARIABLE_NAME
List all the environment variables:
# env

3.Clear/unset the variables:
# unset $VARIABLE_NAME

HOME: declared in the last 2 items of “/etc/passwd”

IFS: default separation character of Shell, for example:
# export IFS=: (change the default setting “space” to “:”)
# echo $PATH
/sbin /bin /usr/bin /usr/sbin

LOGNAME: log name

MAIL: path of mail box directory

PATH: the sequence of directory which would have the command executing. The system read from the first item of PATH to the last, and issue the command when found in the directory listed.
Colon (“:”) acts as the separator of PATH line, for example:
# PATH=$HOME/bin:.:/bin:/usr ; export PATH
“.” means current directory.
PATH could be modified as this syntax:
# PATH=$PATH:/$HOME/bin; export PATH

SHELL: default Shell, this information could also be found in “/etc/passwd”

EDITOR: editor, for example,”vi”

PWD: current directory path

MANPATH: Manual directory path, use colon as separator.

How to export all the environment variables togethe?
# set -a

$#: the count of parameter passing to the script
$$: the script’s current PID.
$?: the status to check if the script has error or not. “0” presents ok,other number means troubles have been happened. This variables is very important for debug and testing.

分类: 科技 标签: