Linux common system failures (MBR sector repair fault, repair GRUB boot failure, forgotten root password, repair the file system, disk quotas, etc.)

Repair MBR (Master Boot Record) sector failure

cause of issue

Viruses, Trojans and other damage caused

Incorrect partitioning, disk read and write misuse

Symptom

To find a boot program, start interrupt

Unable to load the operating system, the boot black

Solutions

You should make a backup file in advance

RHEL installation CD to boot into emergency mode

Restore from a backup file

 

bak backup files

View Subdivision

 

disk partition

 

Format the partition

 

Establish mount point directory

 

Backup MBR sector data

 

Simulation of the fault is destroyed MBR

 

Exit CD

Reboot reboot

 

 

Linux CD-ROM boot into emergency mode

Reboot into emergency mode

 

Reply MBR sector from a backup file

 

Repair GRUB boot failure

cause of issue

GRUB boot loader in the MBR is destroyed

grub.conf file is missing, the boot configuration error

Symptom

System boot stagnation, display "grub>" prompt

Solutions

Try to manually enter the boot command

Enter emergency mode, return from a backup grub.conf

Grub program to rebuild MBR sector

 

Restore from a backup file

 

check the file

 

Once mounted to make a backup of grub.conf

 

Delete the file grub.conf

 

Restart

 

Into the firmware

Select CD-ROM guide shift + F10 to save and exit No.

 

Enter emergency mode

Reply grub.conf file to mount two partitions from the backup file

 

After rebooting select the fourth option from the local disk

 

Forget the root password

cause of issue

Forgotten root password

Symptom

You can not require root privileges management manipulation

If there is no other available account will not login

Solutions

Boot into single-user mode and reset passwords grub> kernel ... single or s or 1

Or go to the emergency mode and then reset the password

 

Boot into single-user mode and reset the password

In the guide screen twice press e

Selected sub-menu item 2

Press e

Option 2

Knock box

Input 1

Enter

Input b

Execute passwd command to change the root user password

 

Repair the file system

cause of issue

Non-normal shutdown, sudden power outages, equipment failures and other reading and writing

Super fast file system (super-block) information to be destroyed

Symptom

Unable to read or write data to the partition

After starting the prompt "Give root password for maintenance"

Solutions

Enter the repair status prompted, enter the root password

Use fsck command to repair

 

normal situation

 

Analog partition damage

 

检查是否能挂载该分区 报错 超级块信息被破坏

 

对分区/dev/sdb1进行修复 修复的时候文件系统不能处于挂载状态

 

重新挂载成功

 

磁盘资源耗尽故障

故障原因

磁盘空间已被大量的数据占满 空间耗尽

虽然还有可用空间 但文件数i节点耗尽

故障现象

无法写入新的文件 提示“… : 设备上没有空间”

部分程序无法运行 甚至系统无法启动

解决思路

清理磁盘空间 删除无用、冗余的文件

转移或删除占用大量i节点的琐碎文件

进入单用户模式、急救模式进行修复

为用户设置磁盘配额

 

查看磁盘空间和节点数

 

检测磁盘坏道

故障原因

磁盘设备中存在坏道(逻辑的或物理的)

故障现象

读取磁盘中的数据时,磁盘设备发出异常声响

访问磁盘中的某个文件,反复读取且出错,提示文件损坏

对于新建立的分区无法完成格式化

系统使用该磁盘时频繁死机

解决思路

检测硬盘中是否存在坏道

修复硬盘 或者更换新的硬盘

 

磁盘配额

实现磁盘配额的条件

需要Linux内核支持

安装quota软件包

Linux磁盘限额的特点

作用范围:针对指定的文件系统(分区)

限制对象:用户帐号、组帐号

限制类型:磁盘容量(默认单位为KB)文件数量

限制方法:软限制(可以越过七天)、硬限制(不能越过) 

 

启用文件系统的配额支持 添加usrquota、grpquota挂载参数

 

重启

 

查看

创建配额文件 quotacheck

quotacheck -augcv

-a 检测所有可用的分区

-u 检测用户配额

-g 检测组配额

-c 创建配额数据文件

-v 显示执行过程信息

 

创建配额文件

 

需要临时关闭selinux

 

重新创建 报错是因为分区里面没有旧的配额文件

 

编辑用户和组账号的配额设置 edquota

创建一个新普通用户

编辑用户配额文件

 

启用、关闭文件系统的配额功能 quotaon、quotaoff

给backup挂载点目录开放权限 让用户对sdb1分区能进行操作

 

切换用户对分区进行写入

 

查看配额

 

使节点数超出配额 (touch命令创建的是0字节的文件)

 

再次查看配额 节点数也超出配额

 

查看配额使用情况 quota(侧重用户、组账号)  rep相当于生成一个报表一样的东西

配额一般对root无效

发布了59 篇原创文章 · 获赞 58 · 访问量 2217

Guess you like

Origin blog.csdn.net/qq_37077262/article/details/103962613