从损坏的硬盘中拯救数据

从损坏的硬盘中拯救数据

我有 Ubuntu 服务器软件 RAID5 和 LVM 上的 3 x 1.5TB SATA2,它作为 VPS 节点运行。

今天早上数据中心的人给我发了一封邮件sda 已损坏需要修改...所以他修改了它,然后发现sdc 也损坏了,我要求他归还旧的 sda,以便我可以尝试恢复一些文件。

我在 sdb 上安装了 grub-install 但是它尚未配置,并且在 sdb1 上只有“lost+found”(我将它安装在实时救援系统中并检查),而且这是我唯一可以安装的分区,正如您在下面的(+ fsck)中看到的:

     root@rescue ~ # ll /mnt/
    total 0
    root@rescue ~ # cd /mnt/
    root@rescue /mnt # mkdir sda sda1 sda2 sdb sdb1 sdb2 sdc
    root@rescue /mnt # mount /dev/sda /mnt/sda
    mount: /dev/sda already mounted or /mnt/sda busy
    root@rescue /mnt # mount /dev/sda1 /mnt/sda1
    mount: unknown filesystem type 'linux_raid_member'
    root@rescue /mnt # mount /dev/sda2 /mnt/sda2
    mount: unknown filesystem type 'linux_raid_member'
    root@rescue /mnt # mount /dev/sdb /mnt/sdb
    mount: you must specify the filesystem type
    root@rescue /mnt # mount /dev/sdb1 /mnt/sdb1
    root@rescue /mnt # mount /dev/sdb2 /mnt/sdb2
    mount: you must specify the filesystem type
    root@rescue /mnt # mount /dev/sdc /mnt/sdc

    mount: you must specify the filesystem type
    root@rescue /mnt # 
    root@rescue /mnt # df -h
    Filesystem          Size  Used Avail Use% Mounted on
    rootfs               12G  1.6M   12G   1% /
    udev                 12G     0   12G   0% /dev
    188.40.24.212:/nfs  1.4T  592G  722G  46% /root/.oldroot/nfs
    aufs                 12G  1.6M   12G   1% /
    tmpfs               2.4G  288K  2.4G   1% /run
    tmpfs               5.0M     0  5.0M   0% /run/lock
    tmpfs               4.8G     0  4.8G   0% /run/shm
    /dev/sdb1           492M  2.9M  453M   1% /mnt/sdb1
    root@rescue /mnt # fsck /dev/sda
fsck from util-linux 2.20.1
e2fsck 1.42.5 (29-Jul-2012)
/dev/sda is in use.
e2fsck: Cannot continue, aborting.


root@rescue /mnt # fsck /dev/sda1
fsck from util-linux 2.20.1
fsck: fsck.linux_raid_member: not found
fsck: error 2 while executing fsck.linux_raid_member for /dev/sda1
root@rescue /mnt # fsck /dev/sda2
fsck from util-linux 2.20.1
fsck: fsck.linux_raid_member: not found
fsck: error 2 while executing fsck.linux_raid_member for /dev/sda2
root@rescue /mnt # fsck /dev/sdc
fsck from util-linux 2.20.1
^C
e2fsck 1.42.5 (29-Jul-2012)
fsck.ext2: Attempt to read block from filesystem resulted in short read while trying to open /dev/sdc
Could this be a zero-length partition?
root@rescue /mnt # 
root@rescue /mnt # fsck /dev/sdb
fsck from util-linux 2.20.1
e2fsck 1.42.5 (29-Jul-2012)
/dev/sdb is in use.
e2fsck: Cannot continue, aborting.


root@rescue /mnt # fsck /dev/sdb1
fsck from util-linux 2.20.1
e2fsck 1.42.5 (29-Jul-2012)
/dev/sdb1 is mounted.
e2fsck: Cannot continue, aborting.


root@rescue /mnt # fsck /dev/sdb2
fsck from util-linux 2.20.1
e2fsck 1.42.5 (29-Jul-2012)
ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/sdb2

The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
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>

这里还有一些额外的信息:

root@rescue /mnt # mount /dev/sdc /mnt/sdc
root@rescue /mnt # mount /dev/sda /mnt/sda
mount: /dev/sda already mounted or /mnt/sda busy
root@rescue /mnt # dmesg | tail -n 100
[ 5983.073733] ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 5983.093445] ata4.00: irq_stat 0x40000001
[ 5983.112706] ata4.00: cmd c8/00:02:1a:00:00/00:00:00:00:00/e0 tag 0 dma 1024 in
[ 5983.112706]          res 51/04:02:1a:00:00/00:00:00:00:00/e0 Emask 0x1 (device error)
[ 5983.152382] ata4.00: configured for UDMA/133 (device error ignored)
[ 5983.152389] ata4: EH complete
[ 5983.152524] ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 5983.172225] ata4.00: irq_stat 0x40000001
[ 5983.191500] ata4.00: cmd c8/00:02:1a:00:00/00:00:00:00:00/e0 tag 0 dma 1024 in
[ 5983.191500]          res 51/04:02:1a:00:00/00:00:00:00:00/e0 Emask 0x1 (device error)
[ 5983.231138] ata4.00: configured for UDMA/133 (device error ignored)
[ 5983.231145] ata4: EH complete
[ 5983.231280] ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 5983.250992] ata4.00: irq_stat 0x40000001
[ 5983.270263] ata4.00: cmd c8/00:02:1a:00:00/00:00:00:00:00/e0 tag 0 dma 1024 in
[ 5983.270263]          res 51/04:02:1a:00:00/00:00:00:00:00/e0 Emask 0x1 (device error)
[ 5983.309890] ata4.00: configured for UDMA/133 (device error ignored)
[ 5983.309898] ata4: EH complete
[ 5983.310033] ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 5983.329745] ata4.00: irq_stat 0x40000001
[ 5983.349017] ata4.00: cmd c8/00:02:1a:00:00/00:00:00:00:00/e0 tag 0 dma 1024 in
[ 5983.349017]          res 51/04:02:1a:00:00/00:00:00:00:00/e0 Emask 0x1 (device error)
[ 5983.388611] ata4.00: configured for UDMA/133 (device error ignored)
[ 5983.388618] ata4: EH complete
[ 5983.388847] ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 5983.408712] ata4.00: irq_stat 0x40000001
[ 5983.429984] ata4.00: cmd c8/00:02:1a:00:00/00:00:00:00:00/e0 tag 0 dma 1024 in
[ 5983.429984]          res 51/04:02:1a:00:00/00:00:00:00:00/e0 Emask 0x1 (device error)
[ 5983.474085] ata4.00: configured for UDMA/133 (device error ignored)
[ 5983.474100] ata4: EH complete
[ 5983.474228] ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 5983.494517] ata4.00: irq_stat 0x40000001
[ 5983.514473] ata4.00: cmd c8/00:02:1a:00:00/00:00:00:00:00/e0 tag 0 dma 1024 in
[ 5983.514473]          res 51/04:02:1a:00:00/00:00:00:00:00/e0 Emask 0x1 (device error)
[ 5983.555572] ata4.00: configured for UDMA/133 (device error ignored)
[ 5983.555587] sd 3:0:0:0: [sdc]  
[ 5983.555590] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 5983.555593] sd 3:0:0:0: [sdc]  
[ 5983.555595] Sense Key : Aborted Command [current] [descriptor]
[ 5983.555598] Descriptor sense data with sense descriptors (in hex):
[ 5983.555600]         72 0b 00 00 00 00 00 0c 00 0a 80 00 00 00 00 00 
[ 5983.555608]         00 00 00 1a 
[ 5983.555613] sd 3:0:0:0: [sdc]  
[ 5983.555615] Add. Sense: No additional sense information
[ 5983.555619] sd 3:0:0:0: [sdc] CDB: 
[ 5983.555620] Read(10): 28 00 00 00 00 1a 00 00 02 00
[ 5983.555628] end_request: I/O error, dev sdc, sector 26
[ 5983.575924] Buffer I/O error on device sdc, logical block 13
[ 5983.596058] ata4: EH complete
[ 5983.596189] ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 5983.616541] ata4.00: irq_stat 0x40000001
[ 5983.636612] ata4.00: cmd c8/00:04:1c:00:00/00:00:00:00:00/e0 tag 0 dma 2048 in
[ 5983.636612]          res 51/04:04:1c:00:00/00:00:00:00:00/e0 Emask 0x1 (device error)
[ 5983.677777] ata4.00: configured for UDMA/133 (device error ignored)
[ 5983.677784] ata4: EH complete
[ 5983.677924] ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 5983.698262] ata4.00: irq_stat 0x40000001
[ 5983.718291] ata4.00: cmd c8/00:04:1c:00:00/00:00:00:00:00/e0 tag 0 dma 2048 in
[ 5983.718291]          res 51/04:04:1c:00:00/00:00:00:00:00/e0 Emask 0x1 (device error)
[ 5983.759539] ata4.00: configured for UDMA/133 (device error ignored)
[ 5983.759553] ata4: EH complete
[ 5983.759675] ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 5983.779991] ata4.00: irq_stat 0x40000001
[ 5983.800041] ata4.00: cmd c8/00:04:1c:00:00/00:00:00:00:00/e0 tag 0 dma 2048 in
[ 5983.800041]          res 51/04:04:1c:00:00/00:00:00:00:00/e0 Emask 0x1 (device error)
[ 5983.841255] ata4.00: configured for UDMA/133 (device error ignored)
[ 5983.841269] ata4: EH complete
[ 5983.841391] ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 5983.861707] ata4.00: irq_stat 0x40000001
[ 5983.881708] ata4.00: cmd c8/00:04:1c:00:00/00:00:00:00:00/e0 tag 0 dma 2048 in
[ 5983.881708]          res 51/04:04:1c:00:00/00:00:00:00:00/e0 Emask 0x1 (device error)
[ 5983.922818] ata4.00: configured for UDMA/133 (device error ignored)
[ 5983.922831] ata4: EH complete
[ 5983.922952] ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 5983.943262] ata4.00: irq_stat 0x40000001
[ 5983.963273] ata4.00: cmd c8/00:04:1c:00:00/00:00:00:00:00/e0 tag 0 dma 2048 in
[ 5983.963273]          res 51/04:04:1c:00:00/00:00:00:00:00/e0 Emask 0x1 (device error)
[ 5984.004398] ata4.00: configured for UDMA/133 (device error ignored)
[ 5984.004412] ata4: EH complete
[ 5984.004561] ata4.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 5984.024824] ata4.00: irq_stat 0x40000001
[ 5984.044713] ata4.00: cmd c8/00:04:1c:00:00/00:00:00:00:00/e0 tag 0 dma 2048 in
[ 5984.044713]          res 51/04:04:1c:00:00/00:00:00:00:00/e0 Emask 0x1 (device error)
[ 5984.085733] ata4.00: configured for UDMA/133 (device error ignored)
[ 5984.085741] sd 3:0:0:0: [sdc]  
[ 5984.085743] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 5984.085744] sd 3:0:0:0: [sdc]  
[ 5984.085745] Sense Key : Aborted Command [current] [descriptor]
[ 5984.085746] Descriptor sense data with sense descriptors (in hex):
[ 5984.085747]         72 0b 00 00 00 00 00 0c 00 0a 80 00 00 00 00 00 
[ 5984.085751]         00 00 00 1c 
[ 5984.085753] sd 3:0:0:0: [sdc]  
[ 5984.085754] Add. Sense: No additional sense information
[ 5984.085755] sd 3:0:0:0: [sdc] CDB: 
[ 5984.085756] Read(10): 28 00 00 00 00 1c 00 00 04 00
[ 5984.085760] end_request: I/O error, dev sdc, sector 28
[ 5984.106176] Buffer I/O error on device sdc, logical block 14
[ 5984.126323] Buffer I/O error on device sdc, logical block 15
[ 5984.146119] ata4: EH complete
[ 5984.146128] cramfs: wrong magic
root@rescue /mnt # 


root@rescue ~ # ll /dev/sd*
brw-rw---T 1 root disk 8,  0 Nov 18 17:56 /dev/sda
brw-rw---T 1 root disk 8,  1 Nov 18 17:57 /dev/sda1
brw-rw---T 1 root disk 8,  2 Nov 18 17:57 /dev/sda2
brw-rw---T 1 root disk 8, 16 Nov 18 17:56 /dev/sdb
brw-rw---T 1 root disk 8, 17 Nov 18 17:56 /dev/sdb1
brw-rw---T 1 root disk 8, 18 Nov 18 18:53 /dev/sdb2
brw-rw---T 1 root disk 8, 32 Nov 18 18:24 /dev/sdc
root@rescue ~ # ll /dev/md*
brw-rw---T 1 root disk 9, 0 Nov 18 17:57 /dev/md0
brw-rw---T 1 root disk 9, 1 Nov 18 17:57 /dev/md1

/dev/md:
total 0
root@rescue ~ # mdadm --detail /dev/md0
/dev/md0:
        Version : 0.90
  Creation Time : Sun Oct 17 14:55:20 2010
     Raid Level : raid1
     Array Size : 528128 (515.84 MiB 540.80 MB)
  Used Dev Size : 528128 (515.84 MiB 540.80 MB)
   Raid Devices : 3
  Total Devices : 1
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Mon Nov 18 19:40:49 2013
          State : clean, degraded 
 Active Devices : 1
Working Devices : 1
 Failed Devices : 0
  Spare Devices : 0

           UUID : acc3740a:bf0cfaea:776c2c25:004bd7b2 (local to host rescue)
         Events : 0.1416

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       0        0        1      removed
       2       0        0        2      removed
root@rescue ~ # mdadm --detail /dev/md1
mdadm: md device /dev/md1 does not appear to be active.

如果有人有任何建议那就太好了;)谢谢,Frane M.

答案1

我们许多人会使用 testdisk 来挽救硬盘中损坏的数据。

sudo apt-get install testdisk

将安装它并且 sudo testdisk 可以启动它。

要了解如何使用测试磁盘恢复数据,不同的 PC 有不同的方法。所以我不能更具体,但这些链接可以帮到你。

相关内容