分页: 13/45 第一页 上页 8 9 10 11 12 13 14 15 16 17 下页 最后页 [ 显示模式: 摘要 | 列表 ]

U盘使用BT3的方法

[| 不指定 2008/06/03 11:43]
首先说一下U盘的规划,看到许多朋友将U盘做成启动盘之后,就不能为Windows所用了,失去U盘本来的基本作用了,这是非常不好的。以下是我的8G的U盘分区规划,首先第一个主分区4G给Win,格式化成fat32,插入Win里面,直接能识别。如果安装到其他分区则不行。第二个主分区是Grub的安装目录分了400M,我通常把一些其他的启动镜像放到这里。第三个主分区就是BT3,格式化成1G,后面的就是随时放一些其他的镜像结构了。

kook:/media/usb/boot/grub # fdisk -l /dev/sdc

Disk /dev/sdc: 8086 MB, 8086617600 bytes
249 heads, 62 sectors/track, 1023 cylinders
Units = cylinders of 15438 * 512 = 7904256 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         511     3944378    b  W95 FAT32        
/dev/sdc2             512         562      393669   83  Linux
/dev/sdc3             563         714     1173288   83  Linux
/dev/sdc4             715         716       15438    5  Extended
/dev/sdc5             715         716       15407    6  FAT16


其实BT3的U盘非常简单,直接将文件bt3b141207-u.rar解压,拷贝到相应的分区。
然后就将其加入菜单里面,重点就是一个grub引导后的菜单写法。如下:

kook:/media/usb/boot/grub # cat menu.lst
color light-gray/blue
timeout         20
default         0

title           Windows 95/98/NT/2000
map             (hd0) (hd1)
map             (hd1) (hd0)
rootnoverify    (hd1,0)
makeactive
chainloader     +1

title           BackTrack 3.0 Crack Wireless
root            (hd0,2)
kernel          /boot/vmlinuz root=/dev/ram0 ramdisk_size=51200 vga=791
initrd          /boot/initrd.gz
boot

title           RHEL 5.1 USB image
rootnoverify    (hd0,4)
makeactive
chainloader     +1

title           RHEL 5.1 Boot
root            (hd0,1)
kernel          /RHEL5.1/vmlinuz root=/dev/hda2 ro single
initrd          /RHEL5.1/initrd.img
boot



没什么好说的了。关于在U盘上安装grub的方法,参考我的另外的2篇日志吧。
http://www.52zhe.cn/read.php/22.htm
Tags: ,
我所谓的SuSE框架,就是说你用network来restart的时候会被调用。而不是自己写一个脚本来处理。当然写脚本也可以。但是在框架下有框架下的好处,各取所需吧。

直接定义在/etc/sysconfig/network/ifcfg-bond0

BOOTPROTO='static'
BROADCAST='192.168.59.255'
IPADDR='192.168.59.10'
NETWORK='192.168.59.1'
NETMASK='255.255.255.0'
STARTMODE='onboot'
BONDING_MASTER='yes'
BONDING_MODULE_OPTS='mode=0 miimon=100 use_carrier=0'
BONDING_SLAVE0='bus-pci-0000:00:12.0'
BONDING_SLAVE1='bus-pci-0000:00:13.0'

上面的BONDING_SLAVE0='bus-pci-0000:00:12.0'
也可以写成BONDING_SLAVE0='eth0'

如果在bond0上面创建bond0:0的做法。
注意:不是写一个新文件bond0:0, 像eth0:0这样处理的。而是都写在bond0里面。
/etc/sysconfig/network/ifcfg-bond0

BOOTPROTO='static'
BROADCAST=''
IPADDR='192.168.59.10'
NETWORK=''
NETMASK='255.255.255.0'
STARTMODE='onboot'
BONDING_MASTER='yes'
BONDING_MODULE_OPTS='mode=0 miimon=100 use_carrier=0'
BONDING_SLAVE0='bus-pci-0000:00:12.0'
BONDING_SLAVE1='bus-pci-0000:00:13.0'
ETHTOOL_OPTIONS=''
MTU=''
NAME=''
REMOTE_IPADDR=''
USERCONTROL='no'
IPADDR_0='192.168.59.9'
NETMASK_0='255.255.255.0'
LABEL_0='0'


如果已经创建了bond0,只是想手工添加bond0:0的处理方法如下:

方法1:
ifconfig bond0:0 192.168.59.9 netmask 255.255.255.0

方法2:
ip addr add  192.168.59.9 broadcast 255.255.255.0 label bond0:0  dev bond0

加路由
route add net 192.168.59.0 netmask 255.255.255.0 gw 192.168.59.1


参考URL:http://blog.chinaunix.net/u/5724/showart_217582.html
参考文件:/usr/src/linux/Documentation/networking/bonding.txt
Tags: , ,

一个bonding的脚本

[| 不指定 2008/06/03 11:15]

#!/bin/bash
bond_ip=192.168.59.9                            #bond0的ip地址
bond_netmask=255.255.255.0                      #bond0的子网掩码
bond_gw=192.168.65.62                           #网关
bond_mode=active-backup                         #bonding的工作模式,active-backup为互备模式,balance_rr为负载均衡模式
dev_list="eth1 eth2"                            #bonding绑定的网络接口
primary_eth="eth1"                              #bonding绑定的的主网络接口
mii_val=100
dev_num=`echo $dev_list | awk '{print NF}'`

function wait_real_interfaces()
{
        local max_wait=180
        local wait_count=0
        local chk_dev_count=0
        local dev=""
        while [ 0 ] ; do
                chk_dev_count=0
                #Check each device in the list
                for dev in $dev_list ; do
                        chk_eth=`cat /proc/net/dev | awk '{print $1}' | grep "$dev:" | sed 's/:[0-9]*//' | wc -l`
                        if [ $chk_eth -eq 1 ] ; then
                                chk_dev_count=$[chk_dev_count+1]
                        fi
                done
                if [ $wait_count -eq $max_wait ] ; then
                        echo "Max waits reached,abort to wait real interfaces!"
                        exit 1
                fi
                if [ $chk_dev_count -eq $dev_num ] ; then
                        return 0
                fi
                wait_count=$[wait_count+1]
                echo "Bonding network : waiting for real interfaces,retry at $wait_count,max waits is $max_wait"
                sleep 1
        done
}

function check_real_interfaces()
{
        local chk_eth=0
        local chk_dev_count=0
        for dev in $dev_list ; do
                chk_eth=`ifconfig -a $dev | grep $dev | awk '{print $1}' | wc -l`
                if [ $chk_eth -eq 1 ] ; then
                        chk_dev_count=$[chk_dev_count+1]
                fi
        done
        if [ $chk_dev_count -eq $dev_num ] ; then
                return 0
        fi
        return 1
}

function check_bond_device()
{
        local chk_num=$[dev_num+1]
        chk_bond=`ifconfig | grep "$bond_ip" | wc -l`
        if [ $chk_bond -eq $chk_num ] ; then
                echo "--------------------------------------------------------------------------------"
                echo "Bond IP : $bond_ip , Netmask : $bond_netmask , Gateway : $bond_gw"
                echo "Bonding network devices are successfully setup!"
                echo "--------------------------------------------------------------------------------"
                return 0
        else
                echo "Bonding network device is NOT setup correctly!"
                return 1
        fi
}

function init_bond_device()
{
        local dev=""
        modprobe bonding mode=$bond_mode miimon=$mii_val primary=$primary_eth
        ifconfig bond0 inet $bond_ip netmask $bond_netmask
                for dev in $dev_list ; do
                ifenslave bond0 $dev
        done
        ifconfig bond0 up
    route add default gw $bond_gw

}

function start_bond_device()
{
        local max_attempt=30
        local attempt_count=0
        local interval=3
        while [ 0 ] ; do
                wait_real_interfaces
                if [ $? -eq 0 ];then
                        echo "All real network devices are initialized!"
                fi
                check_real_interfaces
                if [ $? -eq 1 ];then
                        continue
                fi
                echo "Wait for $interval seconds to bind real interface..."
                sleep $interval
                init_bond_device
                check_bond_device
                if [ $? -eq 0 ] ; then
                        break
                else
                        stop_bond_device
                        attempt_count=$[attempt_count+1]
                        echo "Binding real interfaces,retry at $attempt_count,max attempts is $max_attempt"
                        if [ $attempt_count -eq $max_attempt ] ; then
                                echo "Max attempt retry reached,abort to setup bonding network!"
                                exit 1
                        fi
                        continue
                fi
        done
}

function stop_bond_device()
{
        local dev=""
        chk_bond=`ifconfig | grep bond`
        if [ -z "$chk_bond" ] ; then
                echo "Bonding device is not up,no need to stop"
                return 0
        fi
        echo "Stopping bonding devices..."
        for dev in $dev_list ; do
                ifenslave -d bond0 $dev
                ifdown $dev
        done
        #stop the other devices that may be configured as the same ip address
        for dev in `cat /proc/net/dev | grep eth | sed 's/:.*//'` ; do
                chk_ip=`ifconfig $dev | grep $bond_ip | wc -l`
                if [ $chk_ip -eq 1 ] ; then
                        ifdown $dev
                fi
                chk_ip=0
        done
        ifconfig bond0 down
        rmmod bonding
}

case $1 in
start)          #Initialize bonding device,try every times until everything is OK
        start_bond_device       ;;
stop)           #Unbind and stop the bonding & real network interfaces
        stop_bond_device        ;;
status)         #Show status for bonding device
        check_bond_device       ;;
*)
        echo "Usage:`basename $0` [ start | stop | restart | status]"
        exit 1  ;;
esac
exit 0

由MAC地址判定生产厂商

[| 不指定 2008/05/27 20:04]
网卡MAC码是由全球惟一的一个固定组织来分配的,未经认证和授权的厂家无权生产网卡。每块网卡都有一个固定的卡号,并且任何正规厂家生产的网卡上都直接标明了卡号,一般为一组12位的16进制数。其中前6位代表网卡的生产厂商(Intel为00-d0-b7)。

全部厂商列表:
http://standards.ieee.org/regauth/oui/oui.txt

网页查询地址:
http://standards.ieee.org/regauth/oui/index.shtml
在Search the public OUI listing . . .输入网卡MAC地址前三位即可,如00145e得到结果:


00-14-5E    (hex)         IBM
00145E      (base 16)     IBM
                          3039 Cornwallis Rd
                          BLD 660-2F202
                          Raleigh NC 27709
                          UNITED STATES



速度较快,有3个数据库
http://kano.cc163.net/whois/ether.htm

数据 00:14:5e 的查找结果:

标准数据库中:

00145E IBM        

NMAP 数据库中:

自建数据库中:



一个Yast出错解决全记录。

[| 不指定 2008/05/21 11:15]
客户邮件发过来说在用Xmanager连接服务器,执行Yast分区过程中,Yast失去响应死掉了。后来再执行yast,就报错如下:
warning: the qt frontend is installed but does not work
warning: the ncurses frontend is installed but does not work
You need to install yast2-ncurses to use the YaST2 text mode interface
无法正常启动Yast。


解决方案如下:
1:提示了yast2-qt 和 yast2-ncurses已经安装但是不工作。那就查一下这2个包的完整性吧。检查结果是没有变动。都是正常的。

ha01:~ # rpm -V yast2-qt
ha01:~ # rpm -V yast2-ncurses


2:最后一句提示在yast文本模式下安装yast2-ncurses。在文本模式下执行yast仍然报错.继而直接用rpm命令直接安装。无效。

ha01:~ # yast
warning: the qt frontend is installed but does not work
warning: the ncurses frontend is installed but does not work
You need to install yast2-ncurses to use the YaST2 text mode interface
ha01:/misc/media/suse/i586 # rpm -ivh --force yast2-ncurses-2.13.66-0.12.i586.rpm
Preparing...                ########################################### [100%]
   1:yast2-ncurses          ########################################### [100%]
ha01:/misc/media/suse/i586 # yast
warning: the qt frontend is installed but does not work
warning: the ncurses frontend is installed but does not work
You need to install yast2-ncurses to use the YaST2 text mode interface


3:查看yast2-ncurses的包,及其所依赖的动态库。

ha01:~ # rpm -ql yast2-ncurses
/usr/lib/YaST2/plugin/libpy2ncurses.so
/usr/lib/YaST2/plugin/libpy2ncurses.so.2
/usr/lib/YaST2/plugin/libpy2ncurses.so.2.0.0
/usr/share/YaST2/data/pkg_layout.ycp
/usr/share/YaST2/data/you_layout.ycp
/usr/share/doc/packages/yast2-ncurses
/usr/share/doc/packages/yast2-ncurses/COPYING
/usr/share/doc/packages/yast2-ncurses/COPYRIGHT.english
/usr/share/doc/packages/yast2-ncurses/README
ha01:~ # ls -al /usr/lib/YaST2/plugin/libpy2ncurses.so*
lrwxrwxrwx 1 root root      22 May 20 01:53 /usr/lib/YaST2/plugin/libpy2ncurses.so -> libpy2ncurses.so.2.0.0
lrwxrwxrwx 1 root root      22 May 20 01:53 /usr/lib/YaST2/plugin/libpy2ncurses.so.2 -> libpy2ncurses.so.2.0.0
-rwxr-xr-x 1 root root 1542272 May 18  2007 /usr/lib/YaST2/plugin/libpy2ncurses.so.2.0.0

到这里,我们发现发现yast2-ncurses这个rpm包里面只有这样一个重要的动态库文件libpy2ncurses.so.2.0.0。其它的2个都是软连接,指向它而已。
ha01:~ # ldd /usr/lib/YaST2/plugin/libpy2ncurses.so.2.0.0
        linux-gate.so.1 =>  (0xffffe000)
        libyui.so.2 => /usr/lib/libyui.so.2 (0xb7cea000)
        libzypp.so.215 => /usr/lib/libzypp.so.215 (0xb777f000)
        libncursesw.so.5 => /usr/lib/libncursesw.so.5 (0xb7732000)
        libpanelw.so.5 => /usr/lib/libpanelw.so.5 (0xb772f000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb764a000)
        libm.so.6 => /lib/libm.so.6 (0xb7625000)
        libc.so.6 => /lib/libc.so.6 (0xb7503000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb74f8000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xb74e3000)
        libxml2.so.2 => /usr/lib/libxml2.so.2 (0xb73b3000)
        libcurl.so.3 => /usr/lib/libcurl.so.3 (0xb737e000)
        libidn.so.11 => /usr/lib/libidn.so.11 (0xb734e000)
        libssl.so.0.9.8 => /usr/lib/libssl.so.0.9.8 (0xb7311000)
        libcrypto.so.0.9.8 => /usr/lib/libcrypto.so.0.9.8 (0xb71e9000)
        librpm-4.4.so => /usr/lib/librpm-4.4.so (0xb715d000)
        librpmdb-4.4.so => /usr/lib/librpmdb-4.4.so (0xb706e000)
        librpmio-4.4.so => /usr/lib/librpmio-4.4.so (0xb6fbf000)
        libdl.so.2 => /lib/libdl.so.2 (0xb6fbb000)
        librt.so.1 => /lib/librt.so.1 (0xb6fb2000)
        libz.so.1 => /lib/libz.so.1 (0xb6fa0000)
        libbz2.so.1 => /lib/libbz2.so.1 (0xb6f8f000)
        libpopt.so.0 => /usr/lib/libpopt.so.0 (0xb6f87000)
        libdbus-glib-1.so.2 => /usr/lib/libdbus-glib-1.so.2 (0xb6f6d000)
        libgobject-2.0.so.0 => not found
        libglib-2.0.so.0 => not found
        libhal-storage.so.1 => /usr/lib/libhal-storage.so.1 (0xb6f65000)
        libhal.so.1 => /usr/lib/libhal.so.1 (0xb6f5c000)
        libdbus-1.so.2 => /usr/lib/libdbus-1.so.2 (0xb6f2c000)
        libnsl.so.1 => /lib/libnsl.so.1 (0xb6f17000)
        libboost_regex.so.1.33.1 => /usr/lib/libboost_regex.so.1.33.1 (0xb6e75000)
        libboost_filesystem.so.1.33.1 => /usr/lib/libboost_filesystem.so.1.33.1 (0xb6e64000)
        libutil.so.1 => /lib/libutil.so.1 (0xb6e60000)
        /lib/ld-linux.so.2 (0x80000000)
        libgobject-2.0.so.0 => not found
        libglib-2.0.so.0 => not found
        libicui18n.so.34 => /usr/lib/libicui18n.so.34 (0xb6d44000)
        libicuuc.so.34 => /usr/lib/libicuuc.so.34 (0xb6c3e000)
        libicudata.so.34 => /usr/lib/libicudata.so.34 (0xb63d0000)
大家仔细看上面的not found,依赖的有个2重复的库文件。下面就用正常的系统用locate命令查一下他们。如下:
ha01:~ # locate libglib-2.0.so.0
/opt/gnome/lib/libglib-2.0.so.0
/opt/gnome/lib/libglib-2.0.so.0.800.6
ha01:~ # locate libgobject-2.0.so.0
/opt/gnome/lib/libgobject-2.0.so.0
/opt/gnome/lib/libgobject-2.0.so.0.800.6

进入/opt/目录检查发现没有gnome目录,更不要那2个库文件。
ha01:~ # ls /opt
lost+found


4:最终解决,从别的正常机器拷贝过来完整的目录结构。然后执行ldconfig。再执行yast,就一切正常了。

ha01:~ # ldconfig


出错原因:

当时查到/opt目录下面我就很奇怪,这个下面怎么只有一个lost+found目录。我当时的第一感觉,就是客户肯定是错误的将这个分区格式化了。否则里面怎么什么都没有啊。后来再次询问客户才知道详细原因,原来他们的/opt/是没有单独的分区。这次想单独为/opt/做个分区。用Yast执行了这个操作,并将新的分区直接挂载到/opt/上了。至此就非常明了了。由于当时/opt/这些文件存储在/所在的分区里面。新的分区创建好后,挂载到/opt/上后,原来跟/分区下面的/opt/文件内容就都不可见了。而实际上文件也都没有丢。这样也就明白了为什么在执行Yast的过程中失去响应了。因为依赖的库文件也不见了吗。


最终解决方案:
将新为/opt/的创建的分区卸载就OK了。记得再次执行ldconfig.


感兴趣的试试错误模拟:
mkdir /tmp/foo
mount /tmp/foo /opt/gnome --bind
再执行yast试试。
分页: 13/45 第一页 上页 8 9 10 11 12 13 14 15 16 17 下页 最后页 [ 显示模式: 摘要 | 列表 ]