恢复 LVM 中发生故障的物理卷 (PV)

恢复 LVM 中发生故障的物理卷 (PV)

我的主板烧坏了。换了一块新主板并连接了磁盘后,恢复故障的 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  

怎么办?当然,我想保留尽可能多的数据。

答案1

这很奇怪,WD 10TB 硬盘不应该被检测为 8.2TiB

我怀疑你的主板烧坏了,可能发出了电源尖峰并且烧坏了你的驱动器固件!

也许可以尝试 WD 驱动器诊断程序 -

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

如果驱动器上有数据,请务必小心,仅执行非侵入性操作!

答案2

我这样做了:

# 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 电缆,现在磁盘工作正常。所有数据可用。

相关内容