简要背景
我有 QNAP TS-451。NAS 出现故障,但我很确定驱动器仍然完好。我有一个新的 QNAP TS-462 试图更换它,我想确保我的数据在新系统中完好无损。
问题
无法组RAID时如何访问LVM的内容?
(下面问题的更多细节)
环境
TS -451系统已死,不再启动。它是这样配置的:
- 驱动器 A - 20TB RAID1 镜像
- 驱动器 B - 20TB RAID1 镜像
- C 盘 - 8TB 无 RAID
- D 盘 - 14TB 无 RAID
TS -462是一个新系统,我想将驱动器 A/B/C/D 迁移到其中。
分离Linux 系统以(理想情况下)非破坏性地从驱动器 A/B/C/D 读取数据:
- 软呢帽 38
- Linux 内核 6.2.14-300
- 旧 BIOS(即我认为它不能从 GPT 分区启动——在这种情况下不是问题)
- 奔腾双核 E6500(只是为了让您了解这个系统有多旧)
实验一
我尝试将其中一个不重要的驱动器(驱动器 C)移动到新的 TS-462,但 TS-462 似乎无法读取它。据我所知,它似乎对分区表感到困惑(fdisk 报告一件事而 blkid/lsblk 报告不同。
在单独的 Linux 计算机 (Fedora 38) 上,我能够读取 LVM 并将分区挂载到驱动器 C 和 D 上,并确认文件完好无损。
实验二
所以我尝试做同样的事情来读取驱动器 B。驱动器 A/B 是 RAID1 镜像的一部分,所以我认为只在其中一个驱动器上进行实验(谨慎)并将另一个作为备份应该没问题。
不幸的是,我似乎无法激活 LVM。以下是我在 Linux 系统上尝试过的一些事情:
# fdisk -l /dev/sdc
Disk /dev/sdc: 18.19 TiB, 20000588955648 bytes, 39063650304 sectors
Disk model: WDC WD201KFGX-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: gpt
Disk identifier: DFC9F3CE-9CFA-4251-8DD1-48BF99476C04
Device Start End Sectors Size Type
/dev/sdc1 40 1060289 1060250 517.7M Microsoft basic data
/dev/sdc2 1060296 2120579 1060284 517.7M Microsoft basic data
/dev/sdc3 2120584 39045853979 39043733396 18.2T Microsoft basic data
/dev/sdc4 39045853984 39046914269 1060286 517.7M Microsoft basic data
/dev/sdc5 39046914272 39063621869 16707598 8G Microsoft basic data
从我从http://www.rodsbooks.com/linux-fs-code/收集的信息来看,这些分区显示为的事实Microsoft basic data
不是问题,只是证明这是在非常旧版本的 Linux/ 上设置的磁盘。(我从 2015 年左右就开始使用 TS-451)。
# gdisk /dev/sdc
GPT fdisk (gdisk) version 1.0.9
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): p
Disk /dev/sdc: 39063650304 sectors, 18.2 TiB
Model: WDC WD201KFGX-68
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): DFC9F3CE-9CFA-4251-8DD1-48BF99476C04
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 39063650270
Partitions will be aligned on 8-sector boundaries
Total free space is 28423 sectors (13.9 MiB)
Number Start (sector) End (sector) Size Code Name
1 40 1060289 517.7 MiB 0700 primary
2 1060296 2120579 517.7 MiB 0700 primary
3 2120584 39045853979 18.2 TiB 0700 primary
4 39045853984 39046914269 517.7 MiB 0700 primary
5 39046914272 39063621869 8.0 GiB 0700 primary
# cat /proc/mdstat
Personalities :
md123 : inactive sdc5[1](S)
8353780 blocks super 1.0
md124 : inactive sdc4[25](S)
530124 blocks super 1.0
md125 : inactive sdc1[26](S)
530108 blocks super 1.0
md126 : inactive sdc2[1](S)
530124 blocks super 1.0
md127 : inactive sdc3[2](S)
19521865728 blocks super 1.0
unused devices: <none>
# mdadm --assemble --readonly /dev/sdc3
mdadm: device /dev/sdc3 exists but is not an md array.
为什么???:-(
pvdisplay
并且各种 LVM 工具最初并没有发现 LVM。当明确指定分区时:
# pvdisplay /dev/sdc3
Cannot use /dev/sdc3: device is an md component
什么?但是 mdadm 说不是。:-(
# mdadm --examine /dev/sdc3
/dev/sdc3:
Magic : a92b4efc
Version : 1.0
Feature Map : 0x0
Array UUID : 5a6e38ee:eb6bf302:79856803:58887046
Name : 1
Creation Time : Wed Nov 25 03:18:54 2015
Raid Level : raid1
Raid Devices : 2
Avail Dev Size : 39043731456 sectors (18.18 TiB 19.99 TB)
Array Size : 19521865728 KiB (18.18 TiB 19.99 TB)
Super Offset : 39043733376 sectors
Unused Space : before=0 sectors, after=1920 sectors
State : active
Device UUID : f2a96ebc:996e4231:1576a39a:8606a71c
Update Time : Sun Mar 26 00:56:13 2023
Checksum : 893841dd - correct
Events : 436627
Device Role : Active device 1
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
校验和很好。那么这不应该意味着这是一个有效的 RAID 分区吗?(虽然其他分区(甚至交换分区)显示有效的 raid 信息和校验和,所以我不知道那是什么意思。)
让我们尝试不同的路线...
但是,通过设置md_component_detection=0
并/etc/lvm/lvm.conf
执行pvscan --cache --devices /dev/sdc
,我能够获取 LVM 数据...
# pvdisplay /dev/sdc3
--- Physical volume ---
PV Name /dev/sdc3
VG Name vg1
PV Size 18.18 TiB / not usable 0
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 4766080
Free PE 0
Allocated PE 4766080
PV UUID Xt2uVv-PMCy-oHuK-0UAc-43ZI-z7TH-hHAK7A
# vgdisplay vg1
--- Volume group ---
VG Name vg1
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 131
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 18.18 TiB
PE Size 4.00 MiB
Total PE 4766080
Alloc PE / Size 4766080 / 18.18 TiB
Free PE / Size 0 / 0
VG UUID oNdjeV-lPuv-PgPR-J11o-zbHQ-X7az-93sr9J
# lvdisplay vg1
--- Logical volume ---
LV Path /dev/vg1/lv544
LV Name lv544
VG Name vg1
LV UUID z1gyiX-FhGG-cTaM-shPx-wZg4-G1xN-b9fS37
LV Write Access read/write
LV Creation host, time NASEFF3AE, 2015-11-25 03:18:56 -0800
LV Status NOT available
LV Size 144.00 GiB
Current LE 36864
Segments 2
Allocation inherit
Read ahead sectors 8192
--- Segments ---
Logical extents 0 to 5119:
Type linear
Physical volume /dev/sdc3
Physical extents 0 to 5119
Logical extents 5120 to 36863:
Type linear
Physical volume /dev/sdc3
Physical extents 1428360 to 1460103
--- Logical volume ---
LV Path /dev/vg1/lv1
LV Name lv1
VG Name vg1
LV UUID 4lsaNW-E4Bg-g93F-ko0a-Ep1m-wHD0-3Hc3Cb
LV Write Access read/write
LV Creation host, time NASEFF3AE, 2015-11-25 03:19:03 -0800
LV Status NOT available
LV Size 18.04 TiB
Current LE 4729216
Segments 2
Allocation inherit
Read ahead sectors 8192
--- Segments ---
Logical extents 0 to 1423239:
Type linear
Physical volume /dev/sdc3
Physical extents 5120 to 1428359
Logical extents 1423240 to 4729215:
Type linear
Physical volume /dev/sdc3
Physical extents 1460104 to 4766079
是的,所以我应该能够安装驱动器,对吗?
# vgchange -ay vg1
WARNING: PV /dev/sdc3 in VG vg1 is using an old PV header, modify the VG to update.
device-mapper: reload ioctl on (253:3) failed: Device or resource busy
device-mapper: reload ioctl on (253:3) failed: Device or resource busy
0 logical volume(s) in volume group "vg1" now active
嗯...所以也许md_component_detection=0
不是正确的方法?
实验三
为了彻底,我测试了最重要的、手术刀和测试盘。这些都是很好的工具,但我觉得对于目前的情况来说有点笨重。磁盘应该非常好且可读......分区和文件系统完好无损。我假设某处只是某种版本不兼容?
目标与问题(重访)
我的目标主要是以一种或另一种方式访问我的旧数据(来自驱动器 A/B)。我不介意重新格式化其中一个驱动器并从另一个系统迁移。或者如果我有任何合理的期望能够访问数据,就把它放在 TS-462 中。
在我目前的道路上(沿着实验 2),我被困的地方是弄清楚如何让 Linux 识别 RAID?我想我将尝试frostschutz在从 Linux Raid1 成员磁盘恢复文件中共享的关于写时复制覆盖的出色建议- 尽其所能。
但我愿意接受建议!
这完全是一个错误的命令;使用 mdadm,您组装的是一个
/dev/md
设备,而不是一个/dev/sd
设备。你可以试试:
但是,您已经为 sdc3 ( ) 组装了一个 md 设备
/dev/md127
,因此在您再次组装它之前,您必须mdadm --stop /dev/md127
先组装它。/dev/sdc3
这个现有的 md 设备也应该是您在尝试 vgchange而忽略 raid 层时看到的“设备忙”错误的原因。