Mdadm

如何恢復突襲?mount:無法讀取超級塊

  • March 1, 2017

我在/dev/md0上有一個用 mdadm 創建的 raid5 陣列,它工作了大約一年。它由三個 1TB 的 HDD 組成。前幾天發生了停電和UPS故障。不幸的是,這不是第一次。

作業系統位於一個單獨的 SSD 磁碟 ( /dev/sda ) 上,該磁碟不是 raid 陣列的一部分,因此它可以啟動,但無法再掛載陣列。有時*/dev/md0*根本不存在。我還做了一些可能會讓事情變得更糟的事情。我跑fsck /dev/sdb -y了在磁碟上寫了很多次。

我擔心我不會恢復我的文件。你能幫我解決這個問題嗎?

謝謝。

掛載 /dev/md0 /mnt/raid5

mount: /dev/md0: can't read superblock

系統日誌:

Feb 25 15:59:53 pve kernel: [  365.559378] EXT4-fs (md0): unable to read superblock
Feb 25 15:59:53 pve kernel: [  365.560118] EXT4-fs (md0): unable to read superblock
Feb 25 15:59:53 pve kernel: [  365.560216] EXT4-fs (md0): unable to read superblock
Feb 25 15:59:53 pve kernel: [  365.560310] FAT-fs (md0): unable to read boot sector

貓 /proc/mdstat

Personalities : [raid6] [raid5] [raid4] 
unused devices: <none>

fdisk -l

Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x75633c0d

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1        2048 1950353407 1950351360  930G fd Linux raid autodetect

Disk /dev/sdc: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: F397C12B-1549-45EA-97EA-6A41B713B58F

Device     Start        End    Sectors  Size Type
/dev/sdc1   2048 1950353407 1950351360  930G Linux RAID

Disk /dev/sdd: 931.5 GiB, 1000203804160 bytes, 1953523055 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xcced27e3

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdd1        2048 1950353407 1950351360  930G fd Linux raid autodetect

有時 fdisk -l

-bash: /sbin/fdisk: Input/output error

系統日誌:

Feb 25 16:03:25 pve kernel: [  577.221547] ata1.00: SRST failed (errno=-16)
Feb 25 16:03:25 pve kernel: [  577.232569] ata1.00: reset failed, giving up
Feb 25 16:03:25 pve kernel: [  577.232640] ata1.00: disabled
Feb 25 16:03:25 pve kernel: [  577.232643] ata1.01: disabled
Feb 25 16:03:25 pve kernel: [  577.232658] ata1: EH complete
Feb 25 16:03:25 pve kernel: [  577.232683] sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
Feb 25 16:03:25 pve kernel: [  577.232697] sd 0:0:0:0: [sda] tag#0 CDB: Write(10) 2a 00 05 13 a0 38 00 00 08 00
Feb 25 16:03:25 pve kernel: [  577.232702] blk_update_request: I/O error, dev sda, sector 85172280
Feb 25 16:03:25 pve kernel: [  577.232784] Buffer I/O error on dev dm-6, logical block 9255, lost sync page write
Feb 25 16:03:25 pve kernel: [  577.232928] sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
Feb 25 16:03:25 pve kernel: [  577.232936] sd 0:0:0:0: [sda] tag#0 CDB: Write(10) 2a 00 02 88 6a 10 00 00 68 00
Feb 25 16:03:25 pve kernel: [  577.232941] blk_update_request: I/O error, dev sda, sector 42494480
Feb 25 16:03:25 pve kernel: [  577.232948] EXT4-fs error (device dm-6): kmmpd:176: comm kmmpd-dm-6: Error writing to MMP block

編輯1:


sudo mdadm –examine / dev / sdb1

mdadm: No md superblock detected on /dev/sdb1.

sudo mdadm –examine / dev / sdc1

/dev/sdc1:
         Magic : a92b4efc
       Version : 1.2
   Feature Map : 0x1
    Array UUID : 34c11bda:11bbb8c9:c4cf5f56:7c38e1c3
          Name : pve:0
 Creation Time : Sun Jun  5 21:06:33 2016
    Raid Level : raid5
  Raid Devices : 3

Avail Dev Size : 1950089216 (929.88 GiB 998.45 GB)
    Array Size : 1950089216 (1859.75 GiB 1996.89 GB)
   Data Offset : 262144 sectors
  Super Offset : 8 sectors
  Unused Space : before=262056 sectors, after=0 sectors
         State : active
   Device UUID : be76ecf7:b0f28a7d:718c3d58:3afae9f7

Internal Bitmap : 8 sectors from superblock
   Update Time : Mon Feb 20 14:48:51 2017
 Bad Block Log : 512 entries available at offset 72 sectors
      Checksum : ffbc1988 - correct
        Events : 2901112

        Layout : left-symmetric
    Chunk Size : 512K

  Device Role : Active device 1
  Array State : .AA ('A' == active, '.' == missing, 'R' == replacing)

sudo mdadm –examine / dev / sdd1

/dev/sdd1:
         Magic : a92b4efc
       Version : 1.2
   Feature Map : 0x9
    Array UUID : 34c11bda:11bbb8c9:c4cf5f56:7c38e1c3
          Name : pve:0
 Creation Time : Sun Jun  5 21:06:33 2016
    Raid Level : raid5
  Raid Devices : 3

Avail Dev Size : 1950089216 (929.88 GiB 998.45 GB)
    Array Size : 1950089216 (1859.75 GiB 1996.89 GB)
   Data Offset : 262144 sectors
  Super Offset : 8 sectors
  Unused Space : before=262056 sectors, after=0 sectors
         State : active
   Device UUID : 7b9ed6e0:ffad7603:b226e752:355765a8

Internal Bitmap : 8 sectors from superblock
   Update Time : Mon Feb 20 14:48:51 2017
 Bad Block Log : 512 entries available at offset 72 sectors - bad blocks present.
      Checksum : 19b6f3da - correct
        Events : 2901112

        Layout : left-symmetric
    Chunk Size : 512K

  Device Role : Active device 2
  Array State : .AA ('A' == active, '.' == missing, 'R' == replacing)

感謝所有我恢復的數據。

我跑去sudo mdadm --verbose --assemble --force /dev/md0 /dev/sdc1 /dev/sdd1用剩下的兩個好的硬碟組裝陣列,它工作了!

然後我格式化了 sdb 並將其重新添加到數組中sudo mdadm --manage /dev/md0 --add /dev/sdb1,我將很快購買一個新的來替換它。我也在尋找備份解決方案..

如果您給出輸入/輸出錯誤,我認為您有一個或多個壞磁碟。您需要通過命令檢查所有磁碟的 SMART 屬性smartctl -a /dev/sdx。通過命令檢查status每個Update Time磁碟mdadm --examine /dev/sdx1。選擇一個最壞的磁碟女巫,具有更壞的智能屬性和最舊Update Time的並將其從陣列中刪除。

如果您有兩個壞盤,則需要選擇較少壞盤,並且必須通過程序將其恢復到新盤ddrecovery。刪除這個壞磁碟並將新恢復的磁碟插入到同一個地方。

然後,您可以sdc通過以下命令恢復 RAID 5 陣列,其中包含一個失去的磁碟(例如):

mdadm --verbose --create /dev/md0 --chunk=512 --level=5 --raid-devices=3 /dev/sdb1 missing /dev/sdd1

確保該chunk參數與良好磁碟上的參數相同。

此外,您的 sda 磁碟損壞,它不是 RAID 5 陣列的成員。

小心每一個命令。只有一種方法可以恢復您的 RAID 陣列。

通過範例閱讀此內容。

引用自:https://serverfault.com/questions/834886