Lvm

在 LVM 中恢復失敗的物理卷 (PV)

  • November 24, 2021

我的主機板燒了。在獲得新主機板並連接磁碟後,恢復失敗的 PV 失敗,因為硬碟大小已減小。

# pvcreate --test --uuid "wcUYiJ-ULvA-YcLK-xlLM-qTof-uCD4-u2p0FH" --restorefile /etc/lvm/backup/home-vg /dev/sda
 TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
 WARNING: Couldn't find device with uuid wcUYiJ-ULvA-YcLK-xlLM-qTof-uCD4-u2p0FH.
 Device /dev/sda excluded by a filter.

現在 PV 不再適合磁碟了。我知道磁碟不僅從 PVM 備份文件中縮小了,而且在災難發生前我還有 fdisk 的輸出。之前 fdisk 報告的磁碟大小為 9.1 TiB,現在它顯示:

# fdisk -l /dev/sda
Disk /dev/sda: 8,19 TiB, 9000659811328 bytes, 17579413694 sectors
Disk model: WDC WD100EFAX-68
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors Size Id Type
/dev/sda1           1 4294967295 4294967295   2T ee GPT

Partition 1 does not start on physical sector boundary.

磁碟的分區表也已損壞。正確的分區表應如下所示:

Disk /dev/sdd: 9,1 TiB, 10000831348736 bytes, 19532873728 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: E965D649-FADC-4450-BB9A-EA0B7E6191DE

Device         Start         End     Sectors  Size Type
/dev/sdd1       2048   671090687   671088640  320G Linux filesystem
/dev/sdd2  671090688 19532873694 18861783007  8,8T Linux filesystem

# gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.5

Warning! Disk size is smaller than the main header indicates! Loading
secondary header from the last sector of the disk! You should use 'v' to
verify disk integrity, and perhaps options on the experts' menu to repair
the disk.
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.

Warning! One or more CRCs don't match. You should repair the disk!
Main header: OK
Backup header: ERROR
Main partition table: OK
Backup partition table: ERROR

Partition table scan:
 MBR: protective
 BSD: not present
 APM: not present
 GPT: damaged

****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************
Disk /dev/sda: 17579413694 sectors, 8.2 TiB
Model: WDC WD100EFAX-68
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): E965D649-FADC-4450-BB9A-EA0B7E6191DE
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 2048, last usable sector is 19532873694
Partitions will be aligned on 2048-sector boundaries
Total free space is 0 sectors (0 bytes)

Number  Start (sector)    End (sector)  Size       Code  Name
  1            2048       671090687   320.0 GiB   8300  
  2       671090688     19532873694   8.8 TiB     8300  

如何進行?當然,我想保留盡可能多的數據。

我這樣做了:

# hdparm -N /dev/sda
/dev/sda:
max sectors   = 17579413694/19532873728, HPA is enabled
# hdparm -N p19532873728 /dev/sda
/dev/sda:
setting max visible sectors to 19532873728 (permanent)
max sectors   = 19532873728/19532873728, HPA is disabled

但是,重新啟動後,不再檢測到磁碟。然後我更換了 SATA 電纜,現在磁碟工作正常。所有可用數據。

這很奇怪,WD 10tb 硬碟驅動器不應該檢測為 8.2TiB

我懷疑您的油炸 Mobo 可能發出了電源尖峰並烤了您的驅動器韌體!

也許嘗試 WD 驅動器診斷 -

https://support.wdc.com/downloads.aspx?p=2

如果驅動器上有數據,請非常小心,只做非侵入性的!

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