一种修复ext4系统盘分区的方法

现象:

    1. 系统启动时卡住。

    2. 断电重启后,会出现如下界面:

        welcome to emergency mode!

        

    3. 系统/var/log/messages中显示如下:

Apr  9 11:36:21 inspur01 systemd-fsck: /dev/sda2: recovering journal
Apr  9 11:36:21 inspur01 systemd-fsck: /dev/sda2: clean, 339/128016 files, 127461/512000 blocks
Apr  9 11:36:21 inspur01 systemd: Started File System Check on /dev/disk/by-uuid/f5ddd083-a188-4e3b-9574-3b4dadf5bbfe.
Apr  9 11:36:21 inspur01 systemd: Mounting /boot...
Apr  9 11:36:21 inspur01 systemd-fsck: /dev/sda6 contains a file system with errors, check forced.
Apr  9 11:36:21 inspur01 kernel: EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)
Apr  9 11:36:21 inspur01 systemd: Mounted /boot.
Apr  9 11:36:21 inspur01 systemd: Mounting /boot/efi...
Apr  9 11:36:21 inspur01 systemd: Mounted /boot/efi.
Apr  9 11:36:21 inspur01 kernel: FAT-fs (sda8): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
Apr  9 11:36:22 inspur01 systemd-fsck: /dev/sda6: Deleted inode 29 has zero dtime.  FIXED.
Apr  9 11:36:22 inspur01 systemd-fsck: /dev/sda6: Inodes that were part of a corrupted orphan linked list found.
Apr  9 11:36:22 inspur01 systemd-fsck: /dev/sda6: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
Apr  9 11:36:22 inspur01 systemd-fsck: (i.e., without -a or -p options)
Apr  9 11:36:22 inspur01 systemd-fsck: fsck failed with error code 4.
Apr  9 11:36:22 inspur01 systemd-fsck: Running request emergency.target/start/replace
Apr  9 11:36:22 inspur01 systemd: Started File System Check on /dev/disk/by-uuid/d63bef64-e374-4239-bf7d-d37edcb6efc2.
Apr  9 11:36:22 inspur01 systemd: Mounting /var/log...
Apr  9 11:36:22 inspur01 systemd: Stopped Dump dmesg to /var/log/dmesg.
Apr  9 11:36:22 inspur01 systemd: Stopped target Multi-User System. /dev/sda6 contains a file system with errors, check forced.
Apr  9 11:36:21 inspur01 kernel: EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)
Apr  9 11:36:21 inspur01 systemd: Mounted /boot.
Apr  9 11:36:21 inspur01 systemd: Mounting /boot/efi...
Apr  9 11:36:21 inspur01 systemd: Mounted /boot/efi.
Apr  9 11:36:21 inspur01 kernel: FAT-fs (sda8): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
Apr  9 11:36:22 inspur01 systemd-fsck: /dev/sda6: Deleted inode 29 has zero dtime.  FIXED.
Apr  9 11:36:22 inspur01 systemd-fsck: /dev/sda6: Inodes that were part of a corrupted orphan linked list found.
Apr  9 11:36:22 inspur01 systemd-fsck: /dev/sda6: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
Apr  9 11:36:22 inspur01 systemd-fsck: (i.e., without -a or -p options)
Apr  9 11:36:22 inspur01 systemd-fsck: fsck failed with error code 4.
Apr  9 11:36:22 inspur01 systemd-fsck: Running request emergency.target/start/replace
Apr  9 11:36:22 inspur01 systemd: Started File System Check on /dev/disk/by-uuid/d63bef64-e374-4239-bf7d-d37edcb6efc2.
Apr  9 11:36:22 inspur01 systemd: Mounting /var/log...
Apr  9 11:36:22 inspur01 systemd: Stopped Dump dmesg to /var/log/dmesg.
Apr  9 11:36:22 inspur01 systemd: Stopped target Multi-User System.

 

解决方法:

    1. 通过日志分析是磁盘sda的sda6分区出现文件系统error。

    2.重启系统,进入单用户模式。步骤如下:

        reboot--> 长按e ---> 将rhgb quiet替换成 single ---> ctrl + x进行重启。

    3. 进入单用户模式后df显示如下

    一种修复ext4系统盘分区的方法_第1张图片

        说明sda6是系统的日志分区。

    4. 通过umount /var/log卸载挂载目录,并查看/dev/sda6分区,发现存在error。

        一种修复ext4系统盘分区的方法_第2张图片

    5. 修复文件系统

fsck.ext4  -f  /dev/sda6

并通过fsck.ext4  -a /dev/sda6进行查看

    一种修复ext4系统盘分区的方法_第3张图片

 

 

 

 

 

你可能感兴趣的:(linux运维,硬盘相关)