Linux Remote-Boot mini-HOWTO(5)

2008-02-23 07:23:09来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折


在唯读的客户端加入一些设定的东西是必须的, 如此才可以挂上 ramdisk, 及设定档案快取和侦测硬体以变更设定档. 这些都由三个程序档和一个组态档来完成, 您可以把它复制到您的NFS 伺服器: 


runtime/etc/rc.d/rc.ramdisk, 可以快速设定并挂上 ramdisk: 

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

#!/bin/sh
#
# 设定一个 ramdisk 因为 root 透过 NFS 以唯读方式挂上
#
modprobe rd
gzip -c -d /runtime/lib/ramdisk.gz | dd of=/dev/ram bs=1k > /dev/null 2>&1
mount -n -t ext2 /dev/ram /ramdisk


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

runtime/etc/rc.d/rc.sysdetect, 这是所有的机器各自独立的设定档, 包括侦测及分配 区域硬碟机的分割区给档案快取使用. 为了空间的理由我们不在此份文件可列印的版本中包含此档, 但您可以在超文件的版本找到它; 
runtime/etc/rc.d/init.d/filecache.init 这是用来启动档案系统的: 

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

#!/bin/sh
#
# filecache:    档案快取:    启动档案快取 (给 NFS root 用)
#
# 来源功能函数库.
. /etc/rc.d/init.d/functions

# 看看我们如何呼叫功能函数.
case "$1" in
  start)
        if [ -e /cache -a -r /etc/filecache.conf ]; then
                echo -n "Starting NFS filecache: "
                # 把 var 与 tmp 移到区域性的硬碟机
                rm -rf /cache/var /cache/tmp
                (cd /ramdisk; tar cf - var tmp) | (cd /cache; tar xf -)
                (cd /ramdisk; rm -rf var tmp;ln -s /cache/var;ln -s /cache/tmp
)
                chmod 777 /cache/tmp
                # 启动档案快取
                daemon filecache -d on
                echo ""
                touch /var/lock/subsys/filecache
        fi
        ;;
  stop)
        filecache off
        rm -f /var/lock/subsys/filecache
        ;;
  *)
        echo "*** Usage: filecache.init {start|stop}"
        exit 1
esac

exit 0


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

runtime/etc/filecache.conf, 档案快取的设定档 

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

Max 100 MB 50 % #
Cache /runtime /cache


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

前两个档案应该放在前两个档案应该放在 runtime/etc/rc.d/rc.sysinit, 档案内最前面的位置, 如下所示: 

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

# 设定所需的  ramdisk  (给 root NFS 唯读的机器)
if [ -e /ramdisk -a -r /etc/rc.d/rc.ramdisk ]; then
        /etc/rc.d/rc.ramdisk
fi

# 设定硬体各自独立的参数 (给每个 root NFS使用)
if [ -r /etc/rc.d/rc.sysdetect ]; then
        /etc/rc.d/rc.sysdetect
fi


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

而第三个应该 be bound as usual to the System V init directories: we use links named S35filecache in the rc3.d and rc5.d directories, and K80filecache in the rc0.d, rc1.d, rc2.d and rc6.d directories. 
检查一下 rc.sysdetect 这个档案, 并使它与您的硬体设备配合. 特别要注意的是, 如果您跟我们一样没有使用相同的显示卡及萤幕 (这很可能发生的 :-), 看看它们在 /proc/pci 的回应并依此修改叙述档. 在每台机器所使用的存放位置下, 其 rc.sysdetect 之中有一段内容为, 可自订的设定档 (例如 printcap), a为了能每台独立工作, 您需要於伺服器的 dhcpd.conf 档案中, 用特别的标记 option-132 设定每台机器所使用的位置. 在您继续安装之前, 您至少要先建立基本的几个档案 runtime/etc/fstab.ref 和 runtime/etc/hosts.ref , 这些将由 rc.sysdetect 叙述档在启动时透过侦测设定来完成, 为了动态的设定 X servver, 使用 RedHat 软体套件, 有一件事您必须先变更的: 在 /usr/X11R6/bin 及 /usr/X11R6/lib/X11 目录下, 有一些相关的连结设定档及目录应该改成绝对连结. 别忘了以後的 X server 更新安装也要如法泡制. 

把 filecache 安装在 runtime/bin 目录下, 并把它的使用说明 man page 安装在 runtime/usr/man/man8 目录下. 把 bootptag 或 dhcptag 安装在 runtime/usr/local/bin 目录下, 并且 bootptag.c (或 dhcptag.c) 必须放在 runtime/usr/local/src 目录下: 它是一个发送 BOOTP/DHCP 要求, 并以相容於 shell 的标准输出格式回应 BOOTP/DHCP 内容的小程式, 就如下的□例所示: 




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

bootp_your_ip='129.194.71.32'
bootp_server_ip='129.194.77.31'
bootp_filename='XXXclean'
bootp_subnet_mask='255.255.252.0'
bootp_routers='129.194.68.1'

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:The Linux BootPrompt-HowTo 中译版

下一篇:使用LILO做为Win95 WinNT Linux多重开机 mini-HOWTO