How to fix the/etc/fstab configuration file

Source: Internet
Author: User
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.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.