|
Linux 开机程序之研讨(5) echo "Remounting root device with read-write enabled." /sbin/mount -w -n -o remount /
## 在前面的情况中 , 都是 root partition 为 read-only 的状态下 , 所做的一些 ## 工作 , 到了最後一个指令 /sbin/mount -w -n -o remount / , 才把 root ## partition mount 成 read-write . 各位有没有看到前面那行 : ## if [ ! $READWRITE = yes ]; then ..... 下面这个 else 就是与这个 if 对应 ## 也就是说 , 前面那个 if 的区块中 , 所作的工作都是在 root partition 为 ## read-only 的条件成立下所作的事 , 那很明显的 , 下面这个 else 就是 root ## partition 为 read-write 的条件下所作的工作 . 假如你的 root partition ## 为 read-writeable 的话 , 那麽系统就会显示下面的讯息 . cat << EOF 所作的 ## 事 , 就是把 EOF 之前的讯息全部显示在萤幕上 : ## 我想 , 下面的讯息写得很明显了 , 它说 : 你的 root partition 被 mount 成 ## read-write , 没有办法检查 , 要使检查的动作能够顺利的进行 , 你必须把 ## root partition mount 成 read-only ! 那要怎麽做呢 ? 很容易 , 只要利用 ## rdev -R /<your_kernel_name> 1 就可以了 ......
else cat << EOF
*** Root partition has already been mounted read-write. Cannot check! For filesystem checking to work properly, your system must initially mount the root partition as read only. Please modify your kernel with 'rdev' so that it does this. If you're booting with LILO, type: rdev -R /vmlinuz 1 (^^^^^^^^ ... or whatever your kernel name is.)
If you boot from a kernel on a floppy disk, put it in the drive and type: rdev -R /dev/fd0 1
This will fix the problem *AND* eliminate this annoying message. :^)
EOF
## 下面这个指令没什麽好说的 , 就是暂停 10 秒钟 , 让 user 能够有充足的 ## 时间看完上面的讯息
sleep 10 fi
## 删除 /etc/mtab /etc/nologin /etc/utmp
/bin/rm -f /etc/mtab* /etc/nologin /etc/utmp
## 制造 /etc/utmp , 这是一个很典型制造空档案的写法 . /dev/null 这个 node ## 蛮有趣的 , 在某一方面来说 , 它有点像是一个 " 黑洞 " . 怎麽说呢 ? ## 各位可以试试看下面的指令 ls >> /dev/null , 当你使用这个指令之後会 ## 发生什麽事呢 ? 什麽也没发生 , 而且 ls 的输出就好像被丢到黑洞里 , 无 ## 影无踪了 . 那也许你会想 : 那这有什麽用 ? 我的回答是 : 的确没有什麽 ## 很大的用处 , 但当你想抑制输出的讯息时 , 你就会用得到了 .
|