Pay attention to the error information of each problem, which is the best clue we can get when encountering a problem. For example, WARNING: couldntopen/etc/fstab: Nosuchfileordirectory clearly prompts that/etc/fstab does not exist. So what we need to do is determine whether/etc/fstab exists. if not, we need to find a solution.
Pay attention to the error information of each problem, which is the best clue we can get when encountering a problem. For example: WARNING: couldn't open/etc/fstab: No such file or directory
It is clearly indicated that/etc/fstab does not exist. So what we need to do is determine whether/etc/fstab exists. if it does not exist, we need to find a way to recreate it.
In this exercise, we use the rescue environment to fix fstab.
Solution:
(Assume that all partitions in Linux are normal hard disk partitions. if it is lvm, refer to the previous section on the rescue environment)
The basic steps are as follows:
1. fdisk? L view the partition table and write down
2. use the e2label command to find/,/boot, and other partitions.
3. if the rescue has mounted the partition for us, go to step 1.
4. if the rescue does not find the partition, or we use the skip to directly go to the shell state, create the/mnt/sysimage directory and mount the root partition. if the device file does not exist, use makedevs to create it.
5. chroot to/mnt/sysimage, so we can get a lot of commands, such as man.
6. use vi to create fstab based on the fstab format. it is best to have/,/boot,/proc, swap,/dev/pts
7. Save the disk, and then sync back to the rescue environment
8. exit and restart
Other Method 1:
1. after startup, the system prompts you to enter the root password to enter the shell. the prompt is (Repair filesystem)
2. mount/to read write again
$ Mount? O remount, rw/dev/hdaX/ # Here, hdaX is your/partition
3. create/etc/fstab (fdisk-l, e2label) by yourself)
Other Method 2:
1. pass the Bootloader startup parameter init =/bin/bash to enter the shell mode.
2. mount/to read write again
$ Mount? O remount, rw/dev/hdaX/ # Here, hdaX is your/partition
3. create/etc/fstab as above
Fstab itself does not belong to any rpm Package. even different machines may have different partitions. Regardless of the method used, you must have a good understanding of/etc/fstab. of course, you can also use manfstab to view the fstab format on site.
The start of the last two methods is not completed. Generally, the kernel of the bootloader usually uses the ro parameter, so remember to mount it again to the rw state.