我家里的 Intel Nuc NUC7PJYH 中有一个 Ubuntu 服务器 16.04。它已经运行了一年,但今天早上它关机了。在停止运行之前没有运行任何命令。我试图打开它,但它没有检测到任何可启动设备。服务器通过具有适当防火墙配置的 Mikrotik HAP2 路由器连接到外部世界。我没有关键数据,但我经常使用它,如果可能的话,我不想重置和重新配置它。我下载了最后一个 Ubuntu 桌面并将其安装到 USB 中;用它启动了 Intel Nuc,然后运行了一些测试https://unix.stackexchange.com/questions/33284/recovering-ext4-superblocks
首先尝试检查磁盘:
ubuntu@ubuntu:$ sudo fdisk -l
[…]
Disk /dev/sda: 111.81 GiB, 120034123776 bytes, 234441648 sectors
Disk model: SATAFIRM S11
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[…]
Device Boot Start End Sectors Size Id Type
/dev/sdc1 * 0 5619583 5619584 2.7G 0 Empty
/dev/sdc2 1700 9699 8000 3.9M ef EFI (FAT-12/16/32)
/dev/sdc3 5619712 61439999 55820288 26.6G 83 Linux
然后尝试安装我的 SSD
ubuntu@ubuntu:$ sudo mkdir /mnt/MOUNTED_DRIVE
ubuntu@ubuntu:$ sudo mount -v /dev/sda /mnt/MOUNTED_DRIVE
mount: /mnt/MOUNTED_DRIVE: wrong fs type, bad option, bad superblock on /dev/sda, missing codepage or helper program, or other error.
尝试查看 fdisk 返回的内容:
ubuntu@ubuntu:/$ sudo fdisk -l /dev/sda
Disk /dev/sda: 111.81 GiB, 120034123776 bytes, 234441648 sectors
Disk model: SATAFIRM S11
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
使用 fsck:
ubuntu@ubuntu:/$ sudo fsck.ext4 /dev/sda
e2fsck 1.45.5 (07-Jan-2020)
ext2fs_open2: Bad magic number in super-block
fsck.ext4: Superblock invalid, trying backup blocks...
fsck.ext4: Bad magic number in super-block while trying to open /dev/sda
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>
我运行 e2fsck,结果相同:
ubuntu@ubuntu:/$ sudo e2fsck /dev/sda
e2fsck 1.45.5 (07-Jan-2020)
ext2fs_open2: Bad magic number in super-block
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/sda
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>
dumpe2fs 返回备份块
ubuntu@ubuntu:/$ sudo dumpe2fs /dev/sda
dumpe2fs 1.45.5 (07-Jan-2020)
dumpe2fs: Bad magic number in super-block while trying to open /dev/sda
Couldn't find valid filesystem superblock.
mke2fs 1.45.5 (07-Jan-2020)
Creating filesystem with 29305206 4k blocks and 7331840 inodes
Filesystem UUID: 6710bdb4-5f0c-4b29-b2d4-d40e98e34748
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
因此现在我尝试恢复一个块:
ubuntu@ubuntu:~$ sudo e2fsck -b 32768 /dev/sda
e2fsck 1.45.5 (07-Jan-2020)
e2fsck: Invalid argument while trying to open /dev/sda
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>
最后,我尝试使用 testdisk,它说Partition sector doesn't have the endmark 0xAA55
TestDisk 7.2-WIP, Data Recovery Utility, Novembre 2020
Christophe GRENIER <[email protected]>
https://www.cgsecurity.org
Disk /dev/sda - 120 GB / 111 GiB - CHS 14593 255 63
Current partition structure:
Partition Start End Size in sectors
Partition sector doesn't have the endmark 0xAA55
此时我开始怀疑是否有人进入了我的网络并删除了这个硬盘,但我认为路由器和服务器中的防火墙规则都配置好了。另一种可能是磁盘坏了,但我觉得这很不寻常。
欢迎任何帮助
-- 编辑:按照@happyTusk 的建议我运行fsck -p
,但结果相同:
ubuntu@ubuntu:~$ sudo fsck -p /dev/sda
fsck from util-linux 2.34
fsck.ext2: Bad magic number in super-block while trying to open /dev/sda
/dev/sda:
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>
答案1
硬盘损坏或严重损坏无法修复的可能性很大。尝试fsck -p /dev/sda
通过此选项修复是否可行。我的 6TB 硬盘花了大约一天时间,但最终我还是找回了。