LVM2新加入的磁碟立即報滿

LVM2新加入的磁碟立即報滿

我使用 webmin 將格式化為 EXT4 (/dev/sdk1) 的 4TB 磁碟新增至我的 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 檔案系統的大小。

相關內容