|
在论坛上看到一贴在下面, 但问题是我按照它说的方法做, 在rescue后执行
mkdir /mnt/sysimage
fdisk -l
e2lable /dev/sda1 显示 /boot
e2lable /dev/sda2 显示 /
e2lable /dev/sda3 显示 /usr
然后执行mount /dev/sda2 /mnt/sysimage
mount /dev/sda3 /mnt/sysimage
chroot /mnt/sysimage
后,并不能执行man,locate等命令啊! 然后我又用
mount /dev/sda1 /mnt/sysimage
mount /dev/sda2 /mnt/sysimage
chroot /mnt/sysimage
第三次用
mount /dev/sda1 /mnt/sysimage
mount /dev/sda2 /mnt/sysimage
mount /dev/sda3 /mnt/sysimage
chroot /mnt/sysimage
都无法执行man,locate命令, 虽然我可以手工做一个fstab了, 但我不明白的是
为什么这些命令不能用? 谁能帮我解释一下吗?
(6)Debug Exercise I
In this exercise, you'll be working without an /etc/fstab configuration file. To prepare, rename this file to something that you can remember and restore as required, such as /etc/bak.fstab. You'll also need a rescue disk. If your computer can boot directly from your CD drive, the first Red Hat Installation CD can serve this purpose. Otherwise, you'll also need a boot disk that also allows you access to the actual Red Hat Linux installation files, locally or over a network. And you'll need to know the root password for this system.
The objective is to learn how /etc/fstab works, as well as the key configuration parameters associated with an /etc/fstab configuration line for your root (/) directory.
1.Start Red Hat Linux. Rename your /etc/fstab configuration file. One possible name is /etc/bak.fstab.
2.Make sure you have a boot disk that can serve as a rescue disk. If you know that your computer can boot directly from your Red Hat Linux installation CD, you're set. Otherwise, create a boot disk from the appropriate image file (boot.img, bootnet.img, or pcmcia.img).
3.Use the reboot command to restart Linux.
4.When you see your boot loader, probably GRUB, select your current version of Red Hat Linux.
5.Watch the messages as they scroll across the screen. You'll probably see a message similar to:
WARNING: couldn't open /etc/fstab: No such file or directory
6.You'll probably be taken to the single-user mode maintenance login prompt. Enter your root password at this prompt.
7.Find your currently configured partitions with the fdisk -l command. Make a note of each partition device that is formatted to a Linux filesystem.
8.Check the labels associated with each Linux-formatted partition. For example, if one of the partitions is /dev/hda1, run the e2label /dev/hda1 command. Make a note of the label that you see, such as /boot or /.
9.Try restoring your /etc/fstab file from your backup. It probably won't work.
10.Reboot your computer with a Red Hat Linux installation CD or boot disk. Type linux rescue at the boot prompt.
11.Follow the first basic steps toward installation.
12.Direct the installation program toward the source for the Red Hat Linux installation files, as required.
13.When you get to the Rescue menu, select Continue and press ENTER.
14.Since Linux still can't find your /etc/fstab file, you'll see an error message that suggests that you don't have any Linux partitions. Select OK and press ENTER to continue.
15.You are now in rescue mode. Run the df command. You probably won't see any of your normal filesystems mounted anywhere.
16.Try running the man fstab command. You probably won't be able to see the man page for the /etc/fstab configuration file.
17.Create the /mnt/sysimage directory as required with the mkdir command.
18.Back in step 8, you found the partition device associated with your root directory. Mount it on the /mnt/sysimage directory.
19.Restore the basic workings of your directory structure with the chroot /mnt/sysimage command.
20.Now try to rebuild /etc/fstab. Run the man fstab command. It should work now. Try to remember the settings for each of the columns in /etc/fstab. Using the fstab man page, and the information you gathered with the e2label command, try to rebuild a simple /etc/fstab file. Remember, avoid tabs and keep all configuration settings from wrapping to the next line. Create an /etc/fstab file with at least the settings for your root (/) directory.
21.Remove the installation floppy and/or CD from their drives.
22.Reboot your computer. If it works, congratulations. If it doesn't work, try editing /etc/fstab again.
23.When you've had enough, restore your original /etc/fstab file from your backup. Reboot your computer to make sure everything is all right.
24.Remember, you don't need to memorize all of the settings for /etc/fstab. However, you should recognize what works and what does not work in an /etc/fstab configuration file. |
|