/dev/sda1:发现属于损坏的孤立链接列表的 Inode

/dev/sda1:发现属于损坏的孤立链接列表的 Inode

我正在正常使用我的 Ubuntu 2015.04(带有 ecryptfs 加密的用户主页)笔记本电脑,突然硬盘变成只读状态。

我重新启动了,现在它卡在了这个状态:

[    0.703206] ACPI PCC probe failed.
starting version 219
error: /dev/sdb: No medium found
error: /dev/sdb: No medium found
Welcome to emergency mode! After logging in, type "journalctl -xb" to view
system logs, "systemctl reboot" to reboot, "systemctl default or ^D to
try again to boot into default mode.
root@nico:~#

系统日志中有趣的部分:

-- Unit systemd-fsckd.service has begun starting up.
system-fsck[475]: /dev/sda1 contains a file system with errors, check forced.
kernel: ACPI warning: \_SB_.PCIO.PEG_.VID_._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20141107/nsarguments-95)
kernel: ACPI warning: \_SB_.PCIO.PEG_.VID_._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20141107/nsarguments-95)
kernel: thinkpad_acpi: EC reports that Thermal Table has changed
system-fsck[475]: /dev/sda1: Inodes that were part of a corrupted orphan linked list found.
system-fsck[475]: /dev/sda1: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
system-fsck[475]: (i.e., without -a or -p options)
system-fsck[475]: fsck failed with error code 4.
system-fsck[475]: Running request emergency.target/start/replace
systemd[1]: system-fsck-root.service: main process exited, code=exited, status=1/FAILURE
systemd[1]: Failed to start File System Check on Root Device
-- Subject: Unit system-fsck-root.service has failed

我不确定是 ACPI 问题还是磁盘问题。我尝试将我的 Lenovo Thinkpad T520 更新到最新 BIOS,但启动效果并不好。

如何解决这个问题,或者如果磁盘坏了,如何至少将数据从我的加密主页导出到外部驱动器?

答案1

  1. 在提示符下,键入并按回车键(根据包含文件系统错误的目录从日志中fsck /dev/sda<number>查找)<number>
  2. 输入y所有错误来修复它们
  3. exit

答案2

在终端

sudo -i (如果不是 root 用户,则跳过此步骤)

fdisk -l

查找您的根驱动器。

我在树莓派中使用 Kali Linux,所以我的看起来有点像mmcblk0p2......sdb1看看你的。

`umount /dev/mmcblk0p2`

fsck -y /dev/mmcblk0p2

poweroff

答案3

我也遇到过同样的问题。我使用 Win32DiskImager 从正常工作的 Raspbian SDCard 创建了一个映像文件。当我运行 pishrink 时,该工具给出了“孤立的 inode 列表”错误。因此,我按照 Rocky Inde 的建议执行了 fsck。它遇到并修复了一些错误,因此我再次运行 pishrink,它成功了!谢谢 Rock Inde。

如果你已经读到这里,但仍然不知道该怎么做,我创建了一个脚本,部分基于 pishrink,用于修复这些“孤立的 inode”。你可以在以下位置查看脚本源代码:

https://github.com/gmenezesg/fix_orphaned_inode_list

用法:

wget https://raw.githubusercontent.com/gmenezesg/fix_orphaned_inode_list/master/fix_orphaned_inode_list.sh

sudo chmod +x fix_orphaned_inode_list.sh

sudo ./fix_orphaned_inode_list.sh [imagefile.img]

脚本:

#!/bin/bash

function cleanup() {
  if losetup $loopback &>/dev/null; then
        if [ "$verbose_mode" = true ]; then
        echo "### Running cleanup ###"
        fi
        losetup -d "$loopback"
  fi
}

verbose_mode=false

while getopts ":v" opt; do
  case "${opt}" in
    v) verbose_mode=true ;;
    *) usage ;;
  esac
done
shift $((OPTIND-1))

usage() { echo "Usage: $0 [-v] imagefile.img"; exit -1; }

if [ "$verbose_mode" = true ]; then
echo "### Mapping arguments ###"
fi

img="$1"

if [ "$verbose_mode" = true ]; then
echo "### Usage checks ###"
fi

if [[ -z "$img" ]]; then
  usage
fi
if [[ ! -f "$img" ]]; then
  echo "ERROR: $img is not a file..."
  exit -2
fi
if (( EUID != 0 )); then
  echo "ERROR: You need to be running as root."
  exit -3
fi

echo "#Check that what we need is installed"
for command in parted losetup tune2fs md5sum e2fsck resize2fs; do
  which $command 2>&1 >/dev/null
  if (( $? != 0 )); then
    echo "ERROR: $command is not installed."
    exit -4
  fi
done

if [ "$verbose_mode" = true ]; then
echo "### Setting cleanup at script exit ###"
fi
trap cleanup ERR EXIT

beforesize=$(ls -lh "$img" | cut -d ' ' -f 5)
parted_output=$(parted -ms "$img" unit B print | tail -n 1)
partnum=$(echo "$parted_output" | cut -d ':' -f 1)
partstart=$(echo "$parted_output" | cut -d ':' -f 2 | tr -d 'B')
loopback=$(losetup -f --show -o $partstart "$img")
tune2fs_output=$(tune2fs -l "$loopback")
currentsize=$(echo "$tune2fs_output" | grep '^Block count:' | tr -d ' ' | cut -d ':' -f 2)
blocksize=$(echo "$tune2fs_output" | grep '^Block size:' | tr -d ' ' | cut -d ':' -f 2)

fsck -y "$loopback"

相关内容