What should I do if the NAS storage failure causes Linux to fail to start properly?

  

Linux system may not start properly due to NAS storage failure. In this case, you must start with Linux system. So what should you do? The following small series will introduce you to the solution to the problem that the Linux system cannot be started due to NAS storage failure.

First, the fault phenomenon description

The NAS operating system kernel is Linux, the built-in storage has 16 hard disks, a total of two groups, each group made RAID5, the Linux operating system can not start normally When the service starts up to the cups, it stops. The button ctrl+c is forced to disconnect and there is no response. Checking the status of the hard disk is normal, there is no alarm or warning.

Second, the problem judgment ideas

Through the above phenomena, first judge the NAS hardware should be no problem, the NAS storage disk should also be normal, now Linux can not be started, it should be a problem with the Linux system itself, Therefore, first start with the Linux system for troubleshooting.

Third, the problem processing process

1, the first process

The NAS system itself is a Linux kernel loaded with a file system management software, management software can be on the system Disks, system services, file systems, etc. are managed and operated. Under normal circumstances, the NAS system based on the Linux kernel should be booted into init3 or init5 mode. Since NAS uses only one kernel module and several simple services, it is judged by NAS. The Linux system is definitely booted into init 3 mode, so it can't be booted into the multi-user character interface now. Why not let Linux directly enter the single-user (init 1) mode, because only the system is required to enable the system in single-user mode. Several services, while the cpus service is application-level, certainly will not start in the "init 1" mode, thus avoiding the problem that cups can not be started, so the following work is to enter the single-user mode of Linux under.

Many Linux distributions can enter the single-user mode through the relevant settings in the boot interface. By looking at the NAS boot process, it is basically judged that this Linux system is very similar to the RHEL/Centos distribution. Try it out by entering the single-user mode via RHEL/Centos.

RHEL/Centos is easy to enter single-user mode, that is, in the system boot to boot welcome interface, press e, then edit the correct kernel boot option, add the "single" option at the end, and finally directly Press ““b“ to enter a single user.

Next, restart the NAS, then hardware self-test, and then start Linux, has been waiting for the NAS boot welcome interface, but the welcome interface has not come out, just enter the kernel image, load the kernel stage There is no kernel boot interface, how to enter a single user, after a simple thought, or decided to directly press the keyboard after the hardware detection is completed, the miracle appears, it is really possible, NAS enters the kernel boot interface, through simple Observe, the second is the kernel option to be booted, so move the keyboard up and down keys, select the kernel, and then press the button to enter the kernel boot editing interface. At the end of the line, enter “single&rdquo ;, then press the Enter key to return to the previous interface, then press "ld"; b & rdquo; start single-user boot, after a minute, the system entered the shell command line under a single user.

After entering single-user mode, there are a lot of things that can be done. The first thing to do is to turn off the cups service in multi-user mode. The command is as follows:

chkconfig -- Levle 35 cups off

After successful execution, reboot the system into multi-user mode to see if the system can boot normally.

2, the second process

After the cups service is turned on, the NAS is restarted, and the problem is still solved. The NAS still starts to stop at the cups service. Is the above command not available? Successful execution? It is obvious that the cups service has been banned. How can it be started? So, continue to restart the NAS, enter the single-user mode again, and see where the problem is.

After entering a single user, execute the chkconfig command again, it can still be successful. Is it a problem with the cups service? First look at the configuration file and execute the following command:

vi /etc/cups/cupsd .conf

Found a problem here, when vi opens cupsd.conf, it prompts "write file in swap", the file clearly exists, how to say it in virtual memory, after thinking, there is only one It is possible that the Linux system partition of the NAS device should not be properly mounted, so that when entering a single user, all files are stored in the virtual memory. To verify, it is very simple. Execute the “df” command to view it, as shown in the following figure. shows:

can be seen here, Linux system partition is not mounted, by & ldquo; examining the status of the disk partition shown, the output below; fdisk -l & rdquo:

According to the output, the NAS system disk is /dev/sda, which only divides the two system partitions /dev/sda1 and /dev/sda2, and the data disk is done by doing RAID5, the device on the system. Identification score Is /dev/sdb1 and /dev/sdc1. Since the single user does not mount any NAS disk by default, try to mount the NAS system disk manually. Run the following command:

[root@NASserver ~]#mount /dev/sda2 /mnt

[root@NASserver ~]#mount /dev/sda1 /opt

Here /mnt, /opt are freely mounted directories, you can also mount to other empty directory, the mount is completed, respectively, into which even a catalog to see what there is, as shown below:


by looking at both the content of the preliminary judging, The /dev/sda2 partition should be the root partition of Linux, and /dev/sda1 should be the /boot partition. Now that your partitions mounted up, execute df command again to see mount case, as shown below:

Up to this point, see the problem. The /dev/sda2 disk partition has no available disk space, and this partition is just the root partition of the NAS system. There is no space in the root partition, so the system startup will definitely be a problem.

The following ideas are transferred to the case described above. Since the system cups service will write the startup log to the root partition when it starts, the root partition cannot write the log because there is no space. The result is that the cups service fails to start, which explains why the NAS system stops every time it boots into the cups service in this case.

Four problem solving

Since the NAS system only has the root partition and /boot partition, the related logs generated by the system will be stored in the root partition. Now the root partition is full, the first thing that can be cleaned up is System-related log files in the /var directory. The directory that can usually be cleaned is /var/log. Execute the following command to view the /var/log log directory occupying disk space:

[root@NASserver ~]# du -sh /var/log

50.1G /var/log

The command output shows that the /var/log directory occupies only 70% of the root partition and cleans up the log files in this directory. It can release most of the root partition space, clean up, restart the NAS system, and find that the system cups service can be started normally, and the NAS service is also started normally.

The above is the introduction of the Linux system failure caused by the NAS storage failure. If your system has this problem, you must first analyze the problem, analyze what is wrong, and then process it. Do more with less and solve problems in a timely manner.

Copyright © Windows knowledge All Rights Reserved