我有一台 QNAP HS-251+ NAS,配有两个采用 RAID1 配置的 3TB WD Red NAS 硬盘。我非常熟悉 Linux 和 CLI 工具,但从未使用过 mdadm 或 LVM,因此,尽管(现在)知道 QNAP 使用它们,但我没有专业知识,甚至不知道 QNAP 如何设法创建 RAID1 组合。几周前,在固件更新期间,NAS 停止启动。我正在解决这个问题,但我想在尝试将磁盘再次插入 NAS 之前恢复我的数据(QNAP HelpDesk 基本上没用)。
我希望能够轻松地安装分区,只需将其中一个磁盘插入我的笔记本电脑(Kubuntu)上,但那时我发现事情比这更复杂。
这是我设法提取的相关信息:
xabi@XV-XPS15:~$ sudo dmesg
[...]
[17272.730964] usb 3-1: new high-speed USB device number 3 using xhci_hcd
[17272.884120] usb 3-1: New USB device found, idVendor=059b, idProduct=0475, bcdDevice= 0.00
[17272.884138] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=5
[17272.884144] usb 3-1: Product: USB to ATA/ATAPI Bridge
[17272.884149] usb 3-1: Manufacturer: JMicron
[17272.884153] usb 3-1: SerialNumber: DCC4108FFFFF
[17272.891498] usb-storage 3-1:1.0: USB Mass Storage device detected
[17272.892117] scsi host6: usb-storage 3-1:1.0
[17273.907765] scsi 6:0:0:0: Direct-Access WDC WD30 EFRX-68EUZN0 PQ: 0 ANSI: 2 CCS
[17273.908085] sd 6:0:0:0: Attached scsi generic sg2 type 0
[17273.908261] sd 6:0:0:0: [sdc] 1565565872 512-byte logical blocks: (802 GB/747 GiB)
[17273.909041] sd 6:0:0:0: [sdc] Write Protect is off
[17273.909046] sd 6:0:0:0: [sdc] Mode Sense: 34 00 00 00
[17273.909789] sd 6:0:0:0: [sdc] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[17273.976961] sd 6:0:0:0: [sdc] Attached SCSI disk
xabi@XV-XPS15:~$
xabi@XV-XPS15:~$ sudo fdisk -l /dev/sdc
Disk /dev/sdc: 746,52 GiB, 801569726464 bytes, 1565565872 sectors
Disk model: EFRX-68EUZN0
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: 0x00000000
Dispositivo Boot Start End Sectors Size Id Tipo
/dev/sdc1 1 4294967295 4294967295 2T ee GPT
xabi@XV-XPS15:~$ sudo mount /dev/sdc1 /mnt/
mount: /mnt: special device /dev/sdc1 does not exist.
xabi@XV-XPS15:~$
xabi@XV-XPS15:~$ sudo parted -l
[...]
Error: Invalid argument during seek for read on /dev/sdc
Retry/Ignore/Cancel? i
Error: The backup GPT table is corrupt, but the primary appears OK, so that will be used.
OK/Cancel? ok
Model: WDC WD30 EFRX-68EUZN0 (scsi)
Disk /dev/sdc: 802GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
xabi@XV-XPS15:~$
xabi@XV-XPS15:~$ sudo lsblk
[...]
sdc 8:32 0 746,5G 0 disk
xabi@XV-XPS15:~$
使用免费版本的商业工具(UFS RAID Recovery)我获得了有关磁盘分区的高级信息:
甚至恢复了lvm备份配置
# Generated by LVM2 version 2.02.138(2)-git (2015-12-14): Fri Feb 11 09:43:53 2022
contents = "Text Format Volume Group"
version = 1
description = "Created *after* executing '/sbin/vgchange vg288 --addtag cacheVersion:3'"
creation_host = "XV-NAS" # Linux XV-NAS 5.10.60-qnap #1 SMP Tue Dec 21 10:57:31 CST 2021 x86_64
creation_time = 1644569033 # Fri Feb 11 09:43:53 2022
vg288 {
id = "g0F3zh-N3aN-1vEQ-qYU4-6Jhv-xgLC-d4hU43"
seqno = 199
format = "lvm2" # informational
status = ["RESIZEABLE", "READ", "WRITE"]
flags = []
tags = ["PV:DRBD", "PoolType:Static", "StaticPoolRev:2", "cacheVersion:3"]
extent_size = 8192 # 4 Megabytes
max_lv = 0
max_pv = 0
metadata_copies = 0
physical_volumes {
pv0 {
id = "ZcFzMw-ZgzA-fOr0-FGgI-E3hc-uwKu-GzWSKn"
device = "/dev/drbd1" # Hint only
status = ["ALLOCATABLE"]
flags = []
dev_size = 5840621112 # 2.71975 Terabytes
pe_start = 2048
pe_count = 712966 # 2.71975 Terabytes
}
}
logical_volumes {
lv544 {
id = "NRzjb8-Dgw4-oHSj-rjtF-2e8H-KQZ2-YPRre3"
status = ["READ", "WRITE", "VISIBLE"]
flags = []
creation_host = "NAS0D80FB"
creation_time = 1494716166 # 2017-05-14 00:56:06 +0200
read_ahead = 8192
segment_count = 1
segment1 {
start_extent = 0
extent_count = 7129 # 27.8477 Gigabytes
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv0", 0
]
}
}
lv1 {
id = "1ND0gN-Lcgx-ALcO-Ui17-hzzg-2soX-LGr1rl"
status = ["READ", "WRITE", "VISIBLE"]
flags = []
creation_host = "NAS0D80FB"
creation_time = 1494716174 # 2017-05-14 00:56:14 +0200
read_ahead = 8192
segment_count = 1
segment1 {
start_extent = 0
extent_count = 705837 # 2.69255 Terabytes
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv0", 7129
]
}
}
}
}
尽管如此,我仍无法安装相关卷(vg288-lv1)。正如我所说,我对 LVM 不熟悉,与我在其他帖子中看到的内容存在一些不一致(没有 sdc1 设备、parted 找不到分区、报告的大小与实际大小不符.. .) 我不知道如何开始有条不紊地解决这个问题。
我尝试使用备份配置作为模板来恢复 lvm 卷,但失败了,但是,正如我所说,我不确定我做的事情是否正确,所以我觉得我需要一些关于从哪里开始的指导,因为到目前为止我的测试结果只会增加混乱。谢谢。
更新:
正如@user7138814所建议的,WD30EFRX似乎是一个“高级格式”磁盘,意味着4k(物理)扇区,并且一些SATA-USB适配器不支持这一点。我的是旧的,所以我买了一个新的,所有奇怪的不一致都消失了:
# dmesg
[...]
[74820.751587] usb 4-1: new SuperSpeed USB device number 4 using xhci_hcd
[74820.779219] usb 4-1: New USB device found, idVendor=174c, idProduct=1153, bcdDevice= 1.00
[74820.779235] usb 4-1: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[74820.779241] usb 4-1: Product: Ugreen Storage Device
[74820.779245] usb 4-1: Manufacturer: Ugreen
[74820.779249] usb 4-1: SerialNumber: 26A1EE833D7E
[74820.787123] scsi host7: uas
[74820.788495] scsi 7:0:0:0: Direct-Access WDC WD30 EFRX-68EUZN0 0 PQ: 0 ANSI: 6
[74820.789417] sd 7:0:0:0: Attached scsi generic sg2 type 0
[74820.789908] sd 7:0:0:0: [sdd] 5860533168 512-byte logical blocks: (3.00 TB/2.73 TiB)
[74820.789918] sd 7:0:0:0: [sdd] 4096-byte physical blocks
[74820.790061] sd 7:0:0:0: [sdd] Write Protect is off
[74820.790067] sd 7:0:0:0: [sdd] Mode Sense: 43 00 00 00
[74820.790252] sd 7:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[74820.790688] sd 7:0:0:0: [sdd] Optimal transfer size 33553920 bytes not a multiple of physical block size (4096 bytes)
[74820.849288] sdd: sdd1 sdd2 sdd3 sdd4 sdd5
[74820.891810] sd 7:0:0:0: [sdd] Attached SCSI disk
# fdisk -l /dev/sdd
Disk /dev/sdd: 2.73 TiB, 3000592982016 bytes, 5860533168 sectors
Disk model: EFRX-68EUZN0
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: EA97E765-8FD0-4C41-8AEA-8B7570F42D68
Device Start End Sectors Size Type
/dev/sdd1 40 1060289 1060250 517.7M Microsoft basic data
/dev/sdd2 1060296 2120579 1060284 517.7M Microsoft basic data
/dev/sdd3 2120584 5842744109 5840623526 2.7T Microsoft basic data
/dev/sdd4 5842744112 5843804399 1060288 517.7M Microsoft basic data
/dev/sdd5 5843804408 5860511999 16707592 8G Microsoft basic data
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
[...]
sdd 8:48 0 2.7T 0 disk
|-sdd1 8:49 0 517.7M 0 part
|-sdd2 8:50 0 517.7M 0 part
|-sdd3 8:51 0 2.7T 0 part
|-sdd4 8:52 0 517.7M 0 part
`-sdd5 8:53 0 8G 0 part
解决方案
大致遵循以下说明https://forum.qnap.com/viewtopic.php?t=156819,我成功挂载了分区并恢复了数据。这是我遵循的步骤:
强制 mdadm 检查磁盘:
# mdadm --examine --scan
ARRAY /dev/md/9 metadata=1.0 UUID=2b29da4f:f725eb04:e2ac3e60:37023bbd name=9
ARRAY /dev/md/256 metadata=1.0 UUID=ed18a26a:4e9ca5f1:aca74d2f:99cb409b name=256
ARRAY /dev/md/1 metadata=1.0 UUID=111bee9e:d34c75c0:87822b63:fbcd271d name=1
ARRAY /dev/md/13 metadata=1.0 UUID=d410ebe5:a4158d63:08559db0:795abb11 name=13
ARRAY /dev/md/322 metadata=1.0 UUID=4bd0cd6d:fcc98341:329fab8c:a32f5495 name=322
检查 raid 阵列是否已被识别:
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
[...]
sdd 8:48 0 2.7T 0 disk
|-sdd1 8:49 0 517.7M 0 part
|-sdd2 8:50 0 517.7M 0 part
|-sdd3 8:51 0 2.7T 0 part
| `-md127 9:127 0 2.7T 0 raid1
|-sdd4 8:52 0 517.7M 0 part
`-sdd5 8:53 0 8G 0 part
# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md127 : active (auto-read-only) raid1 sdd3[1]
2920311616 blocks super 1.0 [2/1] [_U]
md123 : inactive sdc1[1]
530108 blocks super 1.0
md124 : inactive sdc5[1]
8353780 blocks super 1.0
md125 : inactive sdc2[1]
530124 blocks super 1.0
md126 : inactive sdc4[1]
530128 blocks super 1.0
unused devices: <none>
识别物理卷。忽略警告:
# pvdisplay
WARNING: PV /dev/md127 in VG vg288 is using an old PV header, modify the VG to update.
--- Physical volume ---
PV Name /dev/md127
VG Name vg288
PV Size <2.72 TiB / not usable <1.78 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 712966
Free PE 0
Allocated PE 712966
PV UUID ZcFzMw-ZgzA-fOr0-FGgI-E3hc-uwKu-GzWSKn
识别卷组:
# vgdisplay vg288
WARNING: PV /dev/md127 in VG vg288 is using an old PV header, modify the VG to update.
--- Volume group ---
VG Name vg288
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 199
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 <2.72 TiB
PE Size 4.00 MiB
Total PE 712966
Alloc PE / Size 712966 / <2.72 TiB
Free PE / Size 0 / 0
VG UUID g0F3zh-N3aN-1vEQ-qYU4-6Jhv-xgLC-d4hU43
识别逻辑卷:
# lvdisplay
WARNING: PV /dev/md127 in VG vg288 is using an old PV header, modify the VG to update.
--- Logical volume ---
LV Path /dev/vg288/lv544
LV Name lv544
VG Name vg288
LV UUID NRzjb8-Dgw4-oHSj-rjtF-2e8H-KQZ2-YPRre3
LV Write Access read/write
LV Creation host, time NAS0D80FB, 2017-05-14 00:56:06 +0200
LV Status NOT available
LV Size <27.85 GiB
Current LE 7129
Segments 1
Allocation inherit
Read ahead sectors 8192
--- Logical volume ---
LV Path /dev/vg288/lv1
LV Name lv1
VG Name vg288
LV UUID 1ND0gN-Lcgx-ALcO-Ui17-hzzg-2soX-LGr1rl
LV Write Access read/write
LV Creation host, time NAS0D80FB, 2017-05-14 00:56:14 +0200
LV Status NOT available
LV Size 2.69 TiB
Current LE 705837
Segments 1
Allocation inherit
Read ahead sectors 8192
激活所需的音量:
# lvchange -ay /dev/vg288/lv1
WARNING: PV /dev/md127 in VG vg288 is using an old PV header, modify the VG to update.
安装并检查其是否可访问:
# mount -t ext4 -o ro /dev/vg288/lv1 /mnt
# ls /mnt
Container Multimedia Public Web core-hal_callhome_co core-hal_lvm_check hal_daemon_seg_fault.log lost+found
Download Musica Samples aquota.user core-hal_daemon core-hal_netlink homes qsync-homes
Imaxes Pelis Series aquota.user.new core-hal_enc_reset hal_daemon_fail.log htdocs