Jun 15 2008

WINPE多合一集成制作

Category: 技术ssmax @ 17:05:58

1、首先了解PE光盘的启动过程
以老毛桃XPPE的BOOTCD_070310.ISO文件为例,这个ISO文件是个可引导的光盘文件,用ULTRAISO打开这个ISO文件,保存引导文件到D:\BOOT\EZBOOT\XP.BIF,把光盘中所有文件提取到D:\BOOT
从上面的目录结构可以看出PE光盘的引导过程,首先启动引导文件XP.BIF,再找到WXPE目录下SETUPLDR.BIN,读取WINNT.XPE,加载WINPE.IS_,再WXPE\NTDETECT.COM启动PE,即
XP.BIF->SETUPLDR.BIN->WINNT.XPE->WINPE.IS_->NTDETECT.COM

(注:easyboot从版本5.08开始,加入了BCDW命令,如果你的EASYBOOT版本比5.08新,都是支持BCDW命令的。从EASYBOOT的安装目录中拷贝BCDW.BIN到上面D:\BOOT\EZBOOT,在菜单中原来用RUN XP.BIF 用下面命令代替BCDW \WXPE\SETUPLDR.BIN,这里注意写上光盘绝对路径。原这样的XP.BIF文件就可删除了)

 

2、如何集成第二个winpe

第二个winpe也有SETUPLDR.BIN、WINNT.XPE、MINIPE目录等,改名SETUPLDR.BIN 为任意,比如xxx.bin,照样放在WXPE下,WINNT.XPE改名为xxxxx.xpe,照样放在根目录,MINIPE也随便改名,改成xxxpe

然后用ultraedit或者winhex打开 xxx.bin ,搜索winnt.xpe,全部改成xxxxx.xpe,最好xxxxx就是五个字符啦,要不就改了引导文件的大小了,估计也可以,没试过。

然后修改打开xxxxx.xpe,更改镜像文件目录,把minipe改为xxxpe

一般到这里就可以load出来了,但是有很多集成软件可能还用不了,因为是在镜像里面指定的。

 

3、如果修改外置程序目录

一般镜像文件是winpe.is_或者winpe.im_,这种命名方式看上去和windows安装盘的文件一样,其实就是cab打包的默认命名方式,winpe.is_对应就是winpe.iso,winpe.im_对应就是winpe.img,先用winrar强行解压(或者改名成winrar. cab),得到winpe.iso,用ultraiso或者其它镜像编辑工具,修改里面的

\WXPE\SYSTEM32\PECMD.INI

文件,找到minipe,替换成xxxpe,然后保存成新的iso文件,最后用

makecab winpe.iso

重新压缩成winpe.is_,不建议再增加压缩率,启动解压的时候会慢一点。。。

这样winpe.is_就改好了,然后继续搜索xxxpe下面的wim文件、winpe.ini文件,替换所有minipe为xxxpe,保存。

 

这样一个winpe就集成上去了,用easyboot执行 BCDW /wxpe/xxx.bin就好了

或者u盘启动的话可以选择grub4dos,用

chainloader /wxpe/xxx.bin;

boot;

就好了,有耐心的话集成多少个都没问题,当然集成完了要测试一下哦。哈哈


Jun 10 2008

每个innodb表用不同的索引

Category: 技术ssmax @ 13:02:57

ibdata1这个垃圾文件除了reload整个database是没办法缩小的了,每个table用不同的索引文件看上去会舒服一点。。。

13.2.3.1. Using Per-Table Tablespaces

You can store each InnoDB table and its indexes in its own file. This feature is called “multiple tablespaces” because in effect each table has its own tablespace.

Using multiple tablespaces can be beneficial to users who want to move specific tables to separate physical disks or who wish to restore backups of single tables quickly without interrupting the use of the remaining InnoDB tables.

You can enable multiple tablespaces by adding this line to the [mysqld] section of my.cnf:

[mysqld]
innodb_file_per_table

After restarting the server, InnoDB stores each newly created table into its own file tbl_name.ibd in the database directory where the table belongs. This is similar to what the MyISAM storage engine does, but MyISAM divides the table into a data file tbl_name.MYD and the index file tbl_name.MYI. For InnoDB, the data and the indexes are stored together in the .ibd file. The tbl_name.frm file is still created as usual.

If you remove the innodb_file_per_table line from my.cnf and restart the server, InnoDB creates tables inside the shared tablespace files again.

innodb_file_per_table affects only table creation, not access to existing tables. If you start the server with this option, new tables are created using .ibd files, but you can still access tables that exist in the shared tablespace. If you remove the option and restart the server, new tables are created in the shared tablespace, but you can still access any tables that were created using multiple tablespaces.

Note

InnoDB always needs the shared tablespace because it puts its internal data dictionary and undo logs there. The .ibd files are not sufficient for InnoDB to operate.

Note

You cannot freely move .ibd files between database directories as you can with MyISAM table files. This is because the table definition that is stored in the InnoDB shared tablespace includes the database name, and because InnoDB must preserve the consistency of transaction IDs and log sequence numbers.

To move an .ibd file and the associated table from one database to another, use a RENAME TABLE statement:

RENAME TABLE db1.tbl_name TO db2.tbl_name;

If you have a “clean” backup of an .ibd file, you can restore it to the MySQL installation from which it originated as follows:

  1. Issue this ALTER TABLE statement:
    ALTER TABLE tbl_name DISCARD TABLESPACE;

    Caution

    This statement deletes the current .ibd file.

  2. Put the backup .ibd file back in the proper database directory.
  3. Issue this ALTER TABLE statement:
    ALTER TABLE tbl_name IMPORT TABLESPACE;

In this context, a “clean.ibd file backup means:

  • There are no uncommitted modifications by transactions in the .ibd file.
  • There are no unmerged insert buffer entries in the .ibd file.
  • Purge has removed all delete-marked index records from the .ibd file.
  • mysqld has flushed all modified pages of the .ibd file from the buffer pool to the file.

You can make a clean backup .ibd file using the following method:

  1. Stop all activity from the mysqld server and commit all transactions.
  2. Wait until SHOW ENGINE INNODB STATUS shows that there are no active transactions in the database, and the main thread status of InnoDB is Waiting for server activity. Then you can make a copy of the .ibd file.

Another method for making a clean copy of an .ibd file is to use the commercial InnoDB Hot Backup tool:

  1. Use InnoDB Hot Backup to back up the InnoDB installation.
  2. Start a second mysqld server on the backup and let it clean up the .ibd files in the backup.


Jun 05 2008

dtrace java method time cost and counter

Category: 技术ssmax @ 10:32:56

昨晚在sun的论坛问了一下,今天既然10几篇回复,真tmd热情。。。

完善了一下那个简单的脚本,应该可以用了。。。

#!/usr/sbin/dtrace -s
#pragma D option quiet

dtrace:::BEGIN
{
 self->index = 0;
 tstart = timestamp;
}

hotspot$1:::method-entry
{
mname = strjoin(strjoin(copyinstr(arg1,arg2),”->”),copyinstr(arg3,arg4));
self->index++;
self->mname[self->index] = mname;
self->mtime[self->index] = timestamp;
@count[mname] = count();
}

hotspot$1:::method-return
{
mname = strjoin(strjoin(copyinstr(arg1,arg2),”->”),copyinstr(arg3,arg4));
mindex = (self->mname[self->index] == mname) ? -1 : 0;
mtime = (mindex == -1) ? self->mtime[self->index] : tstart;

/*
mname = (mindex == -1) ? mname : strjoin(“non-start-“, mname);
printf(“method : %s : start : %d\n”, mname, tstart);
*/

@time[mname] = avg(timestamp – mtime);
self->index += mindex;
}


Jun 02 2008

Linux和solaris下面检测程序打开文件和socket

Category: 技术ssmax @ 14:53:13

solaris下面就有个很简单的命令

pfiles -p pid

linux下面也有,rhel里面集成了lsof

lsof -p pid

或者去 ls -alh /proc/pid/fd/

socket[inode_num],方括号里面就是inode数字,再怎么看详情没有研究出来方便的方法,还是到

/proc/net/tcp 里面找找,ip是用8位16进制字符表示的。。。


May 29 2008

Solaris 下的网卡驱动和网络配置

Category: 技术ssmax @ 15:06:41

本文在solaris下面写的,最新版,自带的拼音输入法还不错,很流畅。。。

昨天安装了solaris,但是网卡驱动找不到,去网上找了一下,发现solaris支持的网卡还是很少的,机上的集成网卡芯片是 Realtek RTL8168/8111 ,好像是比较普遍的网卡了,但是Solaris就是没有自带驱动,在网上找到一个人写的驱动,说是支持 Realtek RTL8169/8110的,也支持8168,下载,u盘,copy。。。

按步骤一步步来。。。

# gunzip -cd gani-x.x.x.tar.gz | tar xf –

% cd /…/gani-x.x.x
% rm obj Makefile
% ln -s Makefile.${KARCH}_${COMPILER} Makefile
% ln -s ${KARCH} obj

isainfo看体系,应该是amd64了。。

# cd /…/gani-x.x.x
# /usr/ccs/bin/make install
# ./adddrv.sh
# /usr/ccs/bin/make uninstall (for solaris7, don’t remove the file )
# modload obj/gani
# devfsadm -i gani (for solaris7, use drvconfig and reboot with -r )
# ifconfig ganiN plumb ( where N is an instance number, typcally 0 for first card)
# ifconfig -a ( you will see an entry for ganiN)
# ifconfig ganiN YOUR-HOST-NAME
# ifconfig ganiN ( ensure IP address is correct)
# ifconfig ganiN up ( and then you can test with ping, telnet, ftp …)

做到devfsadm -i gani的时候死活也装不上,这个命令是把驱动绑定设备上面并且生成/dev/gani的,出错:

devfsadm: driver failed to attach: gani

改一下设备名称啦之类的都不行,一直在研究,后来找到网上说solaris新版已经带8169的驱动了,是/kernel/drv/amd64/rge模块,好,试一下能不能强行装上用用。。。

先用prtconf -v | less 找到设备pci地址,网卡设备名一般是Ethernet controller,搜索Ethernet,找到设备地址

pci1458,e000,或者用别名pci10ec,8168都应该可以的,然后强行装上驱动

/usr/sbin/add_drv -n -v -m ‘* 0600 root sys’ -i “pci1458,e000” rge

没出问题

modload /kernel/drv/amd64/rge

devfsadm -i rge

竟然没有出问题,装上了,有个设备rge0了

然后

touch /etc/hostname.rge0

touch /etc/dhcp.rge0

配置成dhcp模式,

dhcp会自动配置

/etc/resolv.conf        dns服务器

/etc/nsswitch.conf    域名解释顺序

等一堆东西。。。然后reboot之。。

开机了,拿到ip地址,dns地址,以为没有问题了,谁知道ping一下网关,没有反应,全部包都丢失,再重启一下看看,正常了,但是解释不了dns。。。只有ping可以通,其他所有服务都用不了,直接ip访问页面也不行,出绝招,

sys-unconfig

重新设定系统的所有配置,oh shit,更惨,连ip都拿不到了,估计还是驱动问题,汗阿汗。。。

死死地气去问it借了个3com的网卡来。。。插上,开机,认出来了,

pci10b7,9055,3Com 3C905B-TX

驱动是elxl,设备号是elxl0。。。

配置好hostname和dhcp,reboot拿到ip,能ping通,能nslookup,但是ping域名或者用firefox上的时候还是不行,unknown hosts错误,tnnd,又检查了半天,觉得可能是nscd服务没有开,这个是name service cache daemon,做dns缓存的,把服务打开,ok了,tnnd。。。

总结一下,

主要的启动日志在/var/adm/message,很多时候要看。

solaris里面的ifconfig比较怪异,基本还是和linux差不多的

tar也比较怪异,没有z项,不能直接tar压缩文件

ps 也很怪异,暂时没有研究它的选项,反正默认显示不了多少东西。。。

route更怪异,没有打印路由的功能,要netstat -nr

最后就是服务管理了,可以直接用unix的常用方法,直接搞/etc/rcx.d/

也有自己提供的方法 svcs 来观察服务是否启动

svcs -v

这套东西是它自己的smf,Solaris Service Management Facility

  • Enabling and disabling servicesPrior to Solaris 10, there wasn’t a good way to permanently disable a service in Solaris. The typical method used is to rename the relevant rc script to a name that won’t get executed, but that change will get overlooked the next time the system is upgraded. Furthermore, inetd-based services are enabled and disabled by a totally different method — editing a configuration file. Under SMF, both types of services can be configured using the svcadm(1M) command, and the changes will persist if the machine is upgraded. Here’s a comparison of how to enable and disable some services:
    Old method
    SMF Method
    mv /etc/rc2.d/S75cron /etc/rc2.d/x.S75cron
    svcadm disable system/cron:default
    edit /etc/inet/inetd.conf, uncomment the finger line
    svcadm enable network/finger:default

    The last argument to svcadm in these examples is the FMRI of the service.

    Note that svcadm should only be used for SMF services — legacy rc script-controlled services work the same as in past releases.

  • Stopping, starting, and restarting servicesTraditionally, services have been started by an rc script run at boot, run with the argument start. Some rc scripts provide a stop option, and a few also allow restart. In SMF, these tasks are all accomplished with the svcadm(1M) command:
    Old method
    SMF Method
    /etc/init.d/sshd stop
    svcadm disable -t network/ssh:default
    /etc/init.d/sshd start
    svcadm enable -t network/ssh:default
    /etc/init.d/sshd stop; /etc/init.d/sshd start
    svcadm restart network/ssh:default
    kill -HUP `cat /var/run/sshd.pid`
    svcadm refresh network/ssh:default

    The “-t” option to svcadm enable and svcadm disable indicates that the requested action should be temporary — it will not affect whether the service is started the next time that the system boots.

不过solaris的错误跟踪是比较强大,比如

truss ping www.163.com

出来一堆跟踪信息。。。

明天还要看dtrace,这个才是这次主要研究对象。。。tnnd郁闷阿。。。


May 28 2008

Windows Services for UNIX

Category: 技术ssmax @ 14:14:19

上面基本上有unix上面的所有gun基本命令,在windows下面使用,200多m,nfs啊之类的什么都有,所以说微软的开发人员还是很不错的,这些用户支持方面做得太tmd好了,赚这么多也是理所当然。。。

Windows Services for UNIX version provides a full range of cross-platform services for integrating Windows into existing UNIX-based environments.


May 27 2008

jsp sendRedirect 出错

Category: 技术ssmax @ 18:52:19

java.lang.IllegalStateException: Can’t sendRedirect() after data has committed to the client.

本来就是最简单的错误了,sendRedirect之前已经flush过了,有可能是buffer满了或者手动flush,但是检查了一下就不对了,resin默认有8k的buffer,怎么看jsp都输出不了8k的东西,tag的换行最多也就是几十个字节,想不通啊,看resin编译出来的jsp源代码,也没找到有输出什么大东西啊,也不是每个浏览器都出错,偶然才会出现,难道是resin的智能flush作怪,tnnd。。。


May 22 2008

linux下修改时区

Category: 技术ssmax @ 12:47:30

1、查看时间和时区
Logged in as root, check which timezone your machine is currently using by executing `date`. You’ll see something like Mon 17 Jan 2005 12:15:08 PM PST, PST in this case is the current timezone.

2、找到所有系统可用的时区设置,子目录下面也有
Change to the directory /usr/share/zoneinfo here you will find a list of time zone regions. Choose the most appropriate region, if you live in Canada or the US this directory is the “America” directory.

3、备份当前时区设置
If you wish, backup the previous timezone configuration by copying it to a different location. Such as
mv /etc/localtime /etc/localtime-old

4、创建新的时区,软连接
Create a symbolic link from the appropiate timezone to /etc/localtime. Example:
ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime

5、同步时间,同步服务器列表可以去google
If you have the utility rdate, update the current system time by executing
/usr/bin/rdate -s time.nist.gov

6、开机的时候设定时区
Set the ZONE entry in the file /etc/sysconfig/clock file (e.g. “America/Los_Angeles”)

7、把系统时间写入bios硬件
Set the hardware clock by executing:
/sbin/hwclock –systohc


May 20 2008

jvmti…

Category: 技术ssmax @ 14:54:52

今天终于自己写一个jvmti来测试一下,原来用的那些全部太慢,写个简单的功能测试一下,编译了半天没过,sun上面教程是solaris的,自己的编译器,参数看不懂,找了半天,用最简单的方法就行了,不需要什么-fpic之类的参数。。。

gcc -shared -o libssmax.so -I$JAVA_HOME/include -I$JAVA_HOME/include/linux ssmax.c

然后java 命令行加上 -agentpath path_to_libssmax.so 启动就好了,或者copy到lib目录用-agentlib:ssmax启动

最简单的,开了一个事件。。。MethodEntry,里面做计数器++这样最简单的事情,服务器开起来基本动不了,汗。。。后来查了一下,MethodEntry貌似是比较恐怖,开了以后jvm调用会多了3倍。。。明天再研究下是什么问题好了。。。


May 16 2008

数据库连接的 unix socket vs tcp connection

Category: 技术ssmax @ 11:16:28

抄录一下一些常识,貌似unix socket速度还是快一点的,个人认为。

1、空用户连接必须删除,否则会带来很多麻烦

2、在Unix上,localhost连接不使用TCP协议,使用的是Unix Socket协议,在这种情况下,你就算关闭3306端口,也不会影响程序访问数据库。例如你在PHP中访问数据库就是这种情况。但是Unix Socket连接吞吐量没有TCP连接大,建议用TCP连接。

例如本论坛原来就是使用Unix Socket,现在已经被我改为TCP了。

3、JDBC连接是基于TCP协议的,就算你写localhost,也肯定使用TCP协议,这需要你打开相应的访问权限。PHP只所以可以使用Unix Socket,是因为PHP是调用底层的MySQL C API访问数据库,不必通过网络端口调用。

4、安装MySQL之后第一件事情:

#mysql

connect mysql;

delete from user where user=”;

grant all mysql.* to root@”localhost” identified by “password” with grant option;

grant all mysql.* to root@”%” identified by “password” with grant option;

quit

这样就不必担心连接问题了。以后添加新的用户,照此办理。

另外在Linux上推荐使用iptables封掉3306端口,这样安全了,只允许本机程序访问,不允许外部访问。


« Previous PageNext Page »