LVM2新添加的磁盘立即报满

LVM2新添加的磁盘立即报满

我使用 webmin 将一个 4TB 磁盘格式为 EXT4 (/dev/sdk1) 添加到我的 lvm2 阵列。然后我要求 webmin 扩展文件系统以包含该磁盘。它报告了一个错误,我没有拍摄快照。但是它已将磁盘添加到逻辑卷,并且卷报告了新的总大小,但仍然具有旧的可用空间量。当我查看 pvdisplay 时,它显示新磁盘已满!我该如何纠正这个错误。我试过 e2fsck,它报告 lv 为干净的。以下是我的 vgdisplay、pvdisplay 和 lvdisplay 结果:

name@Server:~$ sudo pvdisplay
--- Physical volume ---
PV Name               /dev/sdg1
VG Name               samba
PV Size               3.64 TiB / not usable 2.00 MiB
Allocatable           yes (but full)
PE Size               4.00 MiB
Total PE              953861
Free PE               0
Allocated PE          953861
PV UUID               VCtRWQ-c2u3-jIb3-AwGH-Wdpm-BNAz-U1QvzZ

--- Physical volume ---
PV Name               /dev/sdh1
VG Name               samba
PV Size               931.51 GiB / not usable 4.00 MiB
Allocatable           yes (but full)
PE Size               4.00 MiB
Total PE              238466
Free PE               0
Allocated PE          238466
PV UUID               0zHiKC-TTBn-L1TK-qmSo-y34W-G4mn-VCJXhA

--- Physical volume ---
PV Name               /dev/sdf1
VG Name               samba
PV Size               1.82 TiB / not usable 4.00 MiB
Allocatable           yes (but full)
PE Size               4.00 MiB
Total PE              476931
Free PE               0
Allocated PE          476931
PV UUID               5eOiZr-BdYk-Jk6c-X5fA-jMvf-7pdM-qvYI6G

--- Physical volume ---
PV Name               /dev/sde1
VG Name               samba
PV Size               3.64 TiB / not usable 2.00 MiB
Allocatable           yes (but full)
PE Size               4.00 MiB
Total PE              953861
Free PE               0
Allocated PE          953861
PV UUID               mrxqc3-qurh-eMER-dwRB-YTOB-fNf0-KPlfmg

--- Physical volume ---
PV Name               /dev/sdj1
VG Name               samba
PV Size               931.51 GiB / not usable 4.00 MiB
Allocatable           yes (but full)
PE Size               4.00 MiB
Total PE              238466
Free PE               0
Allocated PE          238466
PV UUID               SG2gP9-NLII-OsWd-tWGJ-Di8r-pDtT-rkcnTj

--- Physical volume ---
PV Name               /dev/sdm1
VG Name               samba
PV Size               1.82 TiB / not usable 4.00 MiB
Allocatable           yes (but full)
PE Size               4.00 MiB
Total PE              476931
Free PE               0
Allocated PE          476931
PV UUID               Ycqd4P-noXD-Nzgx-auAc-zzrS-F4KE-JSSMCd

--- Physical volume ---
PV Name               /dev/sdl1
VG Name               samba
PV Size               1.82 TiB / not usable 4.00 MiB
Allocatable           yes (but full)
PE Size               4.00 MiB
Total PE              476931
Free PE               0
Allocated PE          476931
PV UUID               XexUjT-PlM4-PQMu-9frH-dAVi-S8tC-hunsby

--- Physical volume ---
PV Name               /dev/sda1
VG Name               samba
PV Size               7.28 TiB / not usable 4.00 MiB
Allocatable           yes (but full)
PE Size               4.00 MiB
Total PE              1907720
Free PE               0
Allocated PE          1907720
PV UUID               ruDYpO-W9n8-XpMp-yLtg-3hfr-AOcX-DyAKlO

--- Physical volume ---
PV Name               /dev/sdk1
VG Name               samba
PV Size               3.64 TiB / not usable 2.00 MiB
Allocatable           yes (but full)
PE Size               4.00 MiB
Total PE              953861
Free PE               0
Allocated PE          953861
PV UUID               SEn3i2-8TcV-D2sm-6Ahe-pgQ4-hPzm-8wTDx1

name@Server:~$ sudo lvdisplay
--- Logical volume ---
LV Path                /dev/samba/media
LV Name                media
VG Name                samba
LV UUID                t3ItFs-3HWB-ZAZj-A0Ia-MDAe-sITn-tWaml1
LV Write Access        read/write
LV Creation host, time Server, 2017-08-03 17:36:54 +0100
LV Status              available
# open                 1
LV Size                25.47 TiB
Current LE             6677028
Segments               9
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           252:0

name@Server:~$ sudo vgdisplay
--- Volume group ---
VG Name               samba
System ID             
Format                lvm2
Metadata Areas        9
Metadata Sequence No  43
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                1
Open LV               1
Max PV                0
Cur PV                9
Act PV                9
VG Size               25.47 TiB
PE Size               4.00 MiB
Total PE              6677028
Alloc PE / Size       6677028 / 25.47 TiB
Free  PE / Size       0 / 0   
VG UUID               S2A8Yl-CKR3-hhEf-DOoc-c564-e5DQ-GZ2vMb

非常感谢大家的帮助。我想知道我是否可以删除新磁盘(因为新磁盘上应该没有数据),然后使用强制删除选项,看看是否可以恢复旧阵列,但由于它已经将新 pv 分配给 lv,我会丢失 lv 吗?

答案1

“我向我的 lvm2 添加了 4TB 磁盘,格式为 EXT4 (/dev/sdk1)” - 这是您的第一个问题。向 LVM 添加空白磁盘。当您创建填满磁盘的 LV 时,您不希望在磁盘上找到旧的超级块。文件系统位于 LV 之上,而不是 PV 之上。

此外,如果您要将整个磁盘添加到 LVM,则不必在其上放置分区表。添加原始磁盘更加简单可靠,尤其是在替换它们时。

为了更准确地解决您的问题,我必须查看添加过程中的错误是什么。此处提供的信息将指导您从何处以及如何获取该信息。最有用的信息来自lvmdump和中的元数据存档/etc/lvm/archive/

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Cluster_Logical_Volume_Manager/troubleshooting.html

关于您关于删除和重新添加的问题,是的,如果您的 VG 在其他 PV 中有足够的空间来取消分配您想要删除的 PV,那么您应该能够做到这一点。从 VG 中删除 PV 非常简单,只需指示 LVM 将该磁盘上的所有扩展区移动到 VG 中的其他磁盘,然后通过从阵列中删除该磁盘来缩小 VG:

pvmove /dev/sdk1
vgreduce samba /dev/sdk1

更新

从查看提供的数据来看,似乎所有 LVM 更改都成功了,webmin 已将新磁盘添加到现有的“samba”VG - 将 VG 扩展了大约 4TiB,然后将“媒体”LV 扩展到该新磁盘提供的剩余可用物理范围。失败(实际上默默无闻)的是命令resize2fs /dev/samba/media,该命令应该在 LV 本身扩展后在“媒体”LV 之上调整现有 EXT4 文件系统的大小。

相关内容