免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2957 | 回复: 3
打印 上一主题 下一主题

[其他] 阅读rc.boot,疑问重重--高手进 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-04-11 18:31 |只看该作者 |倒序浏览
1)        # Disk boot

                unset fd_invoker pdev_to_ldev
                unset native_netboot_cfg disknet_odm_init config_ATM

                case "$PHASE" in

                        1)        # Phase 1 boot - disk

                echo "\n\n_______________________________________"\
                                "_____________________________________" \
                       "\nrc.boot: starting disk boot process" \
                                >/tmp/boot_log
                        ln /usr/lib/lib* /lib
                      疑问1:/*在此之前,系统已经建立了RAMFS,而此时/tmp文件系统要到phase3时才   建立,那么>/tmp/boot_log是怎么解释?还有ln /usr/lib/lib* /lib,/usr文件系统是到phase2时才mount的啊?RAMFS即内存文件系统,就是找内存然后在上面做RAMFS,而RAMFS是否包括:
                       /
                                 /usr
                                /tmp 等文件系统呢?*/
                     
                           # Call restore base
                        echo "rc.boot: executing \"restbase\"" \
                                >>/tmp/boot_log
                        restbase
                     
                     /*restbase将逻辑卷上的简化的ODM复制到RAMFS上的/etc/objrepos中*/

                        rc=$?
                        [ $rc -eq 1 ] && ${SHOWLED} 0x548 #fatal error
                        [ $rc -eq 2 ] && >/no_sbase        #non-fatal error

                        ${SHOWLED} 0x510
                        # Call config manager phase 1
                        echo "rc.boot: executing \"cfgmgr -f -v\"" \
                                >>/tmp/boot_log
                        cfgmgr -f -v
                        dvc=`bootinfo -b`
                        echo "rc.boot: boot device is $dvc" \
                                >>/tmp/boot_log
                        ln /dev/r$dvc /dev/ipldevice
                  
                     疑问:/*/dev/ 是在哪儿?*/
                     
                        ${SHOWLED} 0x511
                        exit 0
                        ;;


                        2)        # Phase 2 boot - disk

                        ${SHOWLED} 0x551
                        # Bring up the root volume group
                        echo "rc.boot: executing \"ipl_varyon -v\"" \
                                >>/tmp/boot_log
                        ipl_varyon -v
                        rc=$?
                        case $rc in
                                0 )     ;;  # do nothing
                                7 | 8 ) loopled 0x554;;
                                4 | 9 ) loopled 0x556;;
                                * )     loopled 0x552;;
                        esac

                        ln /usr/sbin/mount /etc/umount

                  疑问2:/*ln /usr/sbin/mount /etc/umount 百思不得其解?
                          /usr此时存在么?*/

                        ${SHOWLED} 0x517
                        echo "rc.boot: executing \"fsck -fp /dev/hd4\"" \
                                >>/tmp/boot_log
                        fsck -fp /dev/hd4
                        [ "$?" -ne 0 ] && loopled 0x555

                        echo "rc.boot: executing \"mount /dev/hd4 /mnt\"" \
                                >>/tmp/boot_log
                        mount /dev/hd4 /mnt
                        [ "$?" -ne 0 ] && loopled 0x557
                        mount /mnt/etc/filesystems /etc/filesystems

                     疑问3:/*  在平常的维护中如果在linux中使用如下操作:
                             /dev/sdb1    /data
                                         mount /data /test1 (一定会出错mount: /data is not a block device)
                                  可是在AIX中;
                             /dev/hd4 /mnt
                                           mount /mnt/etc/filesystems /etc/filesystems 这是可行的,呵呵!
                             mount、fsck、ln等命令是放在那儿的?此时/usr还没mount上啊?*/

                        LIBPATH=/lib:/usr/lib
                        export LIBPATH
                        ln -s /mnt/sbin/comp* /sbin

                        # Mount /usr
                        echo "rc.boot: executing \"fsck -fp /usr\"" \
                                >>/tmp/boot_log
                        fsck -fp /usr

                     疑问4:/*fsck -fp /usr 此时根据/etc/filesystems 中的内容检测,
                            那么它为何不再写这么一句[ "$?" -ne 0 ] && loopled 0xXXX,
                            以便让管理员看见LED XXX 而知道是 /usr fsck过不去?*/
                           
                        echo "rc.boot: executing \"mount /usr\"" \
                                >>/tmp/boot_log
                        mount /usr
                        [ "$?" -ne 0 ] && loopled 0x518
                        echo "The \"date\" command is now available: " \
                                "`date`" >>/tmp/boot_log

                        if [ -f /mnt/etc/rc.B1 ]; then
                                /mnt/etc/rc.B1 start
                     
                                               疑问5:/*/mnt/etc/rc.B1 start 不知道是什么意思?*/

                        fi

                        umount /etc/filesystems
                        # now we have cp from the mounted /usr
                        cp /mnt/etc/filesystems /etc/filesystems

                        # Mount /var for copycore
                        echo "rc.boot: executing \"fsck -fp var\"" \
                                >>/tmp/boot_log
                        fsck -fp /var
                        echo "rc.boot: executing \"mount /var\"" \
                                >>/tmp/boot_log
                        mount /var
                        [ $? -ne 0 ] && loopled 0x518
                        # retrieve dump
                        echo "rc.boot: executing \"copycore\"" \
                                >>/tmp/boot_log
                        copycore
                        umount /var

                        # Start paging if no dump
                        [ ! -f /needcopydump ] && swapon /dev/hd6

                        # Error Recovery if customized data is zero
                        [ -f /no_sbase ] && {
                        echo "rc.boot: executing savebase recovery procedures" \
                                >>/tmp/boot_log
                                X=`ODMDIR=/mnt/etc/objrepos odmshow CuDv |\
                                        fgrep population`
                                count=`echo $X | cut -f2 -d' '`
                                [ $count -ne 0 ] && {
                                        /usr/sbin/savebase -o /mnt/etc/objrepos
                                        [ $? -ne 0 ] && loopled 0x546
                                        mount /var       
                                                                            # so that reboot can log
                    
                                 疑问6:/*mount /var 为什么上面要 umount /var掉 有什么原因么?*/

                                        echo "savebase recovery reboot" \
                                                >>/tmp/boot_log
                                        cat /tmp/boot_log | alog -q -t boot
                                        reboot
                                }
                        }

                        # allow service if there is a dump or
                        #  need diag/maintenance
                        KEYPOS=`odmget -q"$ODMSTRNG" CuAt`
                        if [ -n "$KEYPOS" -o -f /needcopydump ]
                        then
                        echo "rc.boot: initiating service procedures" \
                                >>/tmp/boot_log
                                export KEYPOS
                                /usr/lib/boot/srvboot
                                [ $? -ne 0 ] && {
                                        if [ `bootinfo -L` = "1" ]; then
                                                # yes, the box has LED display
                                                loopled 0x549
                                        fi
                                        # else there's no LED for us to
                                        # indicate that the dump image could
                                        # not be retrieved.
                                        # log it and move along
                                        echo "\nrc.boot: NOTICE: the dump image could not be saved." >>/tmp/boot_log
                                        echo "Increase the size of the dump copy directory.\n" >>/tmp/boot_log
                                        /usr/bin/sysdumpdev -z
                                }
                        fi

                        # Recover /dev directory from any maintenance work.
                        if [ -d /mnt/dev.org ]
                        then
                                rm -fr /mnt/dev
                                mvdir /mnt/dev.org /mnt/dev
                        fi

                        # Copy LVM information to the hardfile
                        cd /
                        find /etc/vg -print | cpio -updmv /mnt

                        # remove /dev/ipldevice from disk based filesystem
                        rm -f /mnt/dev/ipldevice

                        # Copy /dev special files from RAM filesystem to disk
                        # based filesystem, including /dev/ipldevice
                        /usr/lib/boot/mergedev

                        # Copy ram filesystem ODM customized data to disk
                        cp /etc/objrepos/Cu* /mnt/etc/objrepos

                     疑问7:/*  从cp /etc/objrepos/Cu* /mnt/etc/objrepos来看,
                             在RAMFS应该存在“/”这样在phase1时就好将ODM数据库复制到RAMFS,是这样的么?
                             那么在RAMFS中是否还有其它子文件系统么?如“/usr、/tmp什么的?*/

                        #
                        # If this is the first reboot since an update,
                        # we need to move the new odm commands
                        # and library into the proper place.
                        #
                        if [ -f /mnt/etc/rc.update ]
                        then
                                /mnt/etc/rc.update
                                rm /mnt/etc/rc.update
                        fi

                        # Permanent mounts
                        # need absolute pathname for umount command because
                        # the umount command is hashed to /usr/sbin/umount
                        echo "rc.boot: unmounting temporary mounts" \
                                >>/tmp/boot_log
                        /etc/umount /usr
                        umount /dev/hd4
                    
                     疑问8:/*此时“the umount command is hashed to /usr/sbin/umount”umount命令已改变到/usr/sbin/umount,
                            怎么改变的?(看疑问2)有点意思了,umount命令放在/usr中,所以用/etc/umount /usr,可为什么umount /dev/hd4时,
                            用umount而不用/etc/umount呢?已没有/usr了。
                     
                        ${SHOWLED} 0x517
                        echo "rc.boot: run time mount of / and /usr" \
                                >>/tmp/boot_log
                        mount -f /
                        [ "$?" -ne 0 ] && loopled 0x518

                        # reset SHOWLED just in case the next mount fails,
                        # then need to look in the RAM fs for the command
                        SHOWLED=/../usr/lib/methods/showled
                        export SHOWLED
                        /../usr/sbin/mount /usr
                    
                    疑问9: /*/../usr/sbin/mount /usr
                      呵呵,脑袋极度混乱了!*/

                        [ "$?" -ne 0 ] && loopled 0x518

                        LIBPATH=/usr/lib:/lib
                        SHOWLED=/usr/lib/methods/showled
                        export LIBPATH SHOWLED
                        echo "rc.boot: run time mount of /var" \
                                >>/../tmp/boot_log
                        mount /var
                        [ "$?" -ne 0 ] && loopled 0x518

                        cat /../tmp/boot_log | alog -q -t boot
                        chmod go-w /var/adm/ras/bootlog
                        undolt                # a function that tries to fix things
                        ${SHOWLED} 0x553
                        exit 0
                        # Exit to kernel newroot
                        ;;


                        3)        # Phase 3 inittab finish boot - disk

                        echo "rc.boot: run time mount of /tmp" \
                                | alog -q -t boot
                        if [ -r /etc/filesystems ]
                        then
                                fsck -fp /tmp
                                mount /tmp
                        else
                                fsck -fp /dev/hd3
                                mount -o log=/dev/hd8 /dev/hd3 /tmp
                        fi

                        # Volume group sync.
                        syncvg -v rootvg &

                        # fall through to bottom - phase 3 common code
                        ;;

                        *)        exit 0 ;;

                esac
                ;;

论坛徽章:
0
2 [报告]
发表于 2006-04-12 10:23 |只看该作者
能否给我详细介绍一下 RAMFS 也可以

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
3 [报告]
发表于 2006-04-12 11:19 |只看该作者
rc.boot 1阶段,rootvg还没有被激活,所以/usr、/tmp等所有的文件系统只能存在于内存中。这时你可以把内存(的一部分)看做是一块hdisk,文件系统都位于这个假hdisk上。rc.boot 1阶段的目的是配置一些基础设备(比如真正的硬盘hdisk0、hdisk1……)。

rc.boot 2阶段,rootvg才开始被激活,真正的/usr、/tmp等文件系统才被MOUNT起来,RAMFS里的有些东西会被拷(不一定就是cp命令)过来。rc.boot 2阶段阶结束后RAMFS就不存在了。

[ 本帖最后由 beginner-bj 于 2006-4-12 11:20 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2006-04-13 00:38 |只看该作者
看222的红皮书
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP