Ste*_*pan 2 linux ext4 lvm data-recovery
我在我的笔记本上使用 Linux。我的笔记本最近掉在地上,现在我正在尝试从损坏的硬盘中保存尽可能多的数据。我可以从 Linux live CD 启动 notebook。
长话短说:一个 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
Run Code Online (Sandbox Code Playgroud)
让我们忘记 /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 ( mount -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
Run Code Online (Sandbox Code Playgroud)
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?
Run Code Online (Sandbox Code Playgroud)
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.
Run Code Online (Sandbox Code Playgroud)
我唯一能做的就是尝试找到超级块通常在哪里:
# 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
Run Code Online (Sandbox Code Playgroud)
...并使用以下超级块之一启动 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...
Run Code Online (Sandbox Code Playgroud)
所以 - 它显示了很多错误,但它似乎会尝试修复(当然,如果我使用 fsck.ext4 -y 而不是 fsck.ext4 -n)。
其他选项 - 我的朋友有 SpinRite 6 引导 CD,据说它是修复坏块的最佳程序之一。
所以我的问题是 - 我应该
非常感谢您的任何提示。
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
Run Code Online (Sandbox Code Playgroud)
我要做的第一件事是使用 liveCD 中的 ddrescue 制作驱动器的备份映像。如果驱动器出现物理损坏,则有可能在有限的时间内它完全失效。然后,制作该图像的副本以进行处理。
从那里,我没有你没有尝试过的建议。其他比我更聪明的人将不得不在那里帮助你。