我在笔记本上使用 Linux。我的笔记本最近掉在地上,现在我正试图从损坏的硬盘中尽可能多地保存数据。我可以从 Linux Live CD 启动笔记本。
长话短说:一个 ext4 分区无法安装,但我可以尝试通过 fsck.ext4 修复它。我也可以尝试先恢复硬盘上的坏块(可能通过 SpinRite)。我应该先做什么?
详细信息:
这是我的驱动器:
# fdisk -l
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000080
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3824 30716248+ 7 HPFS/NTFS
/dev/sda2 3825 19449 125507812+ 83 Linux
/dev/sda3 19450 19457 64260 83 Linux
让我们忘记 /dev/sda1 NTFS 分区,它并不那么重要。第三个分区 /dev/sda3 只是 /boot,也不重要。第二个 /dev/sda2 是 LVM 的物理空间(见下文)。
逻辑组 /dev/group1/arch 由 dm-crypt LUKS 加密,我无法打开它,那里的数据可能丢失了。逻辑组 /dev/group1/data 和 /dev/group1/data2 是 ext4 卷。我可以挂载 /dev/group1/data2 (安装-t ext4-o ro,noload / dev / group1 / data2 / mnt / data2) 并在外部驱动器上备份数据。但我无法挂载 /dev/group1/data:
# mount -t ext4 -o ro,noload /dev/group1/data /x/data
mount: wrong fs type, bad option, bad superblock on /dev/mapper/group1-data,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
fsck 不起作用:
# fsck.ext4 -n /dev/group1/data
e2fsck 1.41.11 (14-Mar-2010)
fsck.ext4: Attempt to read block from filesystem resulted in short read while trying to open /dev/group1/data
Could this be a zero-length partition?
dumpe2fs 也找不到超级块:
# dumpe2fs /dev/group1/data
dumpe2fs 1.41.11 (14-Mar-2010)
dumpe2fs: Attempt to read block from filesystem resulted in short read while trying to open /dev/group1/data
Couldn't find valid filesystem superblock.
我唯一能做的就是尝试找到超级块通常所在的位置:
# mkfs.ext4 -n /dev/group1/data
mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
5242880 inodes, 20971520 blocks
1048576 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
640 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000
...并使用以下某个超级块启动 fsck:
# fsck.ext4 -n -b 229376 /dev/group1/data
e2fsck 1.41.11 (14-Mar-2010)
One or more block group descriptor checksums are invalid. Fix? no
Group descriptor 0 checksum is invalid. IGNORED.
Group descriptor 1 checksum is invalid. IGNORED.
Group descriptor 2 checksum is invalid. IGNORED.
Group descriptor 3 checksum is invalid. IGNORED.
Group descriptor 4 checksum is invalid. IGNORED.
Group descriptor 5 checksum is invalid. IGNORED.
...
Group descriptor 637 checksum is invalid. IGNORED.
Group descriptor 638 checksum is invalid. IGNORED.
Group descriptor 639 checksum is invalid. IGNORED.
/dev/group1/data contains a file system with errors, check forced.
Resize inode not valid. Recreate? no
Pass 1: Checking inodes, blocks, and sizes
...here I pressed Ctrl-C...
所以 - 它显示了很多错误,但似乎它会尝试修复(当然,如果我使用 fsck.ext4 -y 而不是 fsck.ext4 -n)。
其他选项 - 我的朋友有 SpinRite 6 启动 CD,据说它是修复坏块的最佳程序之一。
所以我的问题是 - 我应该
- 首先尝试 SpinRite 修复坏块,然后尝试 fsck.ext4 -y(或者更好的是将整个原始分区转储到外部硬盘上的一个大文件中,进行复制,将副本挂载为环回,然后尝试 fckk.ext4 -y)
- 首先尝试 fsck.ext4 -y,希望之后 ome 数据可读,将这些数据备份到外部硬盘上(然后最终尝试 SpinRite)?
- 或者做其他事?
非常感谢您的提示。
LVM结构:
# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name group1
PV Size 119.69 GiB / not usable 2.22 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 30641
Free PE 0
Allocated PE 30641
PV UUID 0k3Zl5-Q7BD-rb8J-9jTZ-2uii-GSGd-B339JB
# vgdisplay
--- Volume group ---
VG Name group1
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 10
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 4
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 119.69 GiB
PE Size 4.00 MiB
Total PE 30641
Alloc PE / Size 30641 / 119.69 GiB
Free PE / Size 0 / 0
VG UUID kKhvri-OVpL-uhCP-T4an-qXIJ-4XL0-kn9Ifi
# lvdisplay
--- Logical volume ---
LV Name /dev/group1/swap
VG Name group1
LV UUID wpDink-01q0-peLc-29at-5kgP-YO3a-8bNrb7
LV Write Access read/write
LV Status available
# open 0
LV Size 1.50 GiB
Current LE 384
Segments 1
Allocation contiguous
Read ahead sectors auto
- currently set to 256
Block device 252:0
--- Logical volume ---
LV Name /dev/group1/arch
VG Name group1
LV UUID S1TZkr-y62z-dOuc-D38G-nuCH-1ilc-y2jqMa
LV Write Access read/write
LV Status available
# open 0
LV Size 15.00 GiB
Current LE 3840
Segments 1
Allocation contiguous
Read ahead sectors auto
- currently set to 256
Block device 252:1
--- Logical volume ---
LV Name /dev/group1/data
VG Name group1
LV UUID 2R4LNv-sHPh-E7ES-goIF-5nUz-tQyj-GOiwvC
LV Write Access read/write
LV Status available
# open 0
LV Size 80.00 GiB
Current LE 20480
Segments 1
Allocation contiguous
Read ahead sectors auto
- currently set to 256
Block device 252:2
--- Logical volume ---
LV Name /dev/group1/data2
VG Name group1
LV UUID 4VqpZj-uOBi-OAIZ-1IXA-G6mj-Qgfb-c6RYqw
LV Write Access read/write
LV Status available
# open 1
LV Size 23.19 GiB
Current LE 5937
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:3
答案1
我要做的第一件事是使用 liveCD 中的 ddrescue 制作驱动器的备份映像。如果驱动器受到物理损坏,则有可能在有限的时间内完全失效。然后,复制该映像以供使用。
从这里开始,我没有你未曾尝试过的建议。其他比我聪明的人将不得不帮助你。