/etc/fstab files in Linux have been deleted or modified, causing the system to fail to start

Source: Internet
Author: User

In Linux, the/etc/fstab file is a disk mount problem, if the file is accidentally modified, or deleted, it will cause the system cannot be restarted. Because the/etc/fstab file is a record of the disk mount information, if there is a problem with the file, then the corresponding home directory (/) and (/boot) and swap disks will not be mounted, so this file is very important for the Linux system.

I made the mistake is: I in the Hadoop cluster file configuration, in a host on the/etc/fstab file modification, modified, ready to distribute to other hosts, I began to think the contents of the Fstab file is the same, so I distributed the file to other hosts, and covered the other host original Fstab, after the end, I restarted other hosts, found that other hosts could not mount the hard disk, causing the system to restart. So I think, each host inside the Fstab file content is not the same. So I will make a fatal mistake. So I had to find a way to recover the fstab files on these hosts. Google on the internet a bit. There is still a way to find out.

Here to explain, fortunately I have a host is intact, this way I can refer to this intact host to modify the other host fstab files. Here's how to modify it:

1, online search, most said to enter the BIOS after the Linux resuce mode. But here's a simple way to do this: re-create the/etc/fstab file. The way to make it is a fstab file of intact hosts. Therefore, the Fstab file on the intact host is distributed to all hosts.

2, since to re-create the Fstab file, then need to understand the contents of the Fstab file, my fstab asking price content is as follows: The file can be divided into three parts.

  

# #/etc/fstab# Created by Anaconda on Tue June-23:29:58 2015## Accessible filesystems, by reference, is maintained Unde R '/dev/disk ' # See mans Pages Fstab (5), Findfs (8), mount (8) and/or Blkid (8) For more info# the first part (this is the key part) uuid=16fef5b5-a9cc-4d                   6F-8D3F-0081546FFB04/EXT4 Defaults 1 1uuid=6f352ae4-e53a-4e32-8129-369c6ba24e9a/boot EXT4 defaults 1 2uuid=adf600ad-ab03-482f-ae6f-fb80e973da1e swap swap Defau LTS 0 0# Part II tmpfs/dev/shm TMPFS defaults 0 0devpts/dev /pts devpts gid=5,mode=620 0 0sysfs/sys sysfs defaults 0 0 PROC/PROC proc Defaults 0 0# Third part//192.168.2.246/share/mnt/share CIFS def Ault,auto,username=administrator,password=passw0rd!/dev/sdb1/mnt/hdb ext4 defaults 0 0/dev/sdc1/mnt/hdc ext4 Defaults 0 0/DEV/SDD1/MNT/HDD EXT4 defaults 0 0/dev/sde1/mnt/hde ext4 defaults 0 0/dev/sdf1/mnt/hdf ext4 defaults 0 0 

Among them, the first part is the most important, because the first part is related to the system file disk hanging problem, this is where we need to modify, the second part and the third part of all hosts are the same.

3, for the first part, we can first through the command: Fdisk-l to see which disk in the system to mount/, boot and swap three directories.

3.1, I can see the following after executing the fdisk-l command:

  

We can clearly see that the swap corresponds to the disk/dev/sda3, then/dev/sda1 and/dev/sda2 and/and/boot correspondence we are not clear. So I see the intact host on the corresponding relationship, found that the/dev/sda2 corresponds to the/;/dev/sda1 corresponds to/boot.

4. What we need to know next is what the UUID in the/etc/fstab file means? By searching online, the answers are as follows:

If you have more than one hard drive, the hard disk in the computer in the order of the time, the same name may represent different hard disk partitions, if you are booting from a USB device, and other USB devices in the insertion order will also lead to the difficulty of partition recognition.

This time the UUID comes in handy, the UUID is universally unique Identifier, that is, each partition has a unique UUID value, so there is no problem of partition recognition confusion.

5. How do I see the UUID? (The red is the UUID)

Browse through the device file information under/dev/disk/by-uuid/. Execute the following command:

# ls-l/dev/disk/by-uuid/

------

lrwxrwxrwx 1 root root 10-13 09:14 0909-090b. /.. /sdb5

lrwxrwxrwx 1 root root 10-13 09:13 7c627a81-7a6b-4806-987b-b5a8a0a93645 . /.. /sda4

.....

6, then the next step is to modify the other host Fstab files:

6.1. After reboot, you will be required to enter the password to enter the root permission of the interface

6.2, at this time the file system is read-only mode, if you need to modify the/etc/fstab file, you need to do: mount-o remount RW/command.

6.3, at this time can modify the/etc/fstab file. Execution: Vi/etc/fstab

6.4. Modify the value of the UUID without a host.

6.5, reboot restart, OK.

/etc/fstab files in Linux have been deleted or modified, causing the system to fail to start

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.