缩小 LVM 卷

缩小 LVM 卷

我们有一个 Synology RS3614rpxs NAS 头,其中包含 (9) 个 3TB 硬盘,采用 RAID 6 + 1 热备用。存储空间已耗尽,我们添加了一个扩展机箱,其中安装了 5TB 硬盘,目的是创建第二个阵列(也是 RAID 6)。

Synology 似乎使用标准 Linuxmd来形成 RAID 阵列,并LVM在其上形成卷组(由底层md设备组成),然后形成逻辑卷。

在引入扩展机箱期间,3 个磁盘被意外添加到第一个阵列 ( md2)。这是一个问题,因为我们正在丢失 5TB 磁盘上的可用空间。其余磁盘似乎已添加到第二个阵列 ( md3)。md3似乎已添加到现有卷组vg1.

我们的目标:

  1. 如果必要的话,删除md3逻辑卷vg1并调整其大小。
  2. 销毁md3其磁盘并将其可供重新利用。

问:我们如何才能最好地实现这些目标?

对于上下文:

“df -h”的输出

Filesystem Size Used Available Use% Mounted on /dev/md0 2.3G 637.9M 1.6G 28% / /tmp 1.9G 404.0K 1.9G 0% /tmp /run 1.9G 3.8M 1.9G 0% /run /dev/shm 1.9G 0 1.9G 0% /dev/shm /dev/vg1/volume_3 2.4T 1.2T 1.2T 49% /volume3 /dev/vg1/volume_1 5.8T 2.9T 2.9T 49% /volume1 /dev/vg1/volume_2 10.7T 10.2T 443.5G 96% /volume2

“lvdisplay”的输出

--- Logical volume --- LV Name /dev/vg1/syno_vg_reserved_area VG Name vg1 LV UUID agGo1D-0811-miWz-ro0e-Nsvo-YdO9-XRJQY4 LV Write Access read/write LV Status available # open 0 LV Size 12.00 MB Current LE 3 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 384 Block device 253:0 --- Logical volume --- LV Name /dev/vg1/volume_1 VG Name vg1 LV UUID 3oehZK-Bv5V-T1RL-MWfY-VQnh-tsrr-tXn3v9 LV Write Access read/write LV Status available # open 1 LV Size 5.86 TB Current LE 1536000 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 4096 Block device 253:1
--- Logical volume --- LV Name /dev/vg1/volume_2 VG Name vg1 LV UUID 3VMQE8-BG0Y-K0jC-Y2Rz-ID09-0dAs-XqTavU LV Write Access read/write LV Status available # open 1 LV Size 10.74 TB Current LE 2816000 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 4096 Block device 253:2
--- Logical volume --- LV Name /dev/vg1/volume_3 VG Name vg1 LV UUID mGs4IT-7QM8-PFF2-TD3O-SGzo-QaKp-33DrrW LV Write Access read/write LV Status available # open 1 LV Size 2.47 TB Current LE 647706 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 4096 Block device 253:3

“vgdisplay”的输出

--- Volume group --- VG Name vg1 System ID
Format lvm2 Metadata Areas 2 Metadata Sequence No 9 VG Access read/write VG Status resizable MAX LV 0 Cur LV 4 Open LV 3 Max PV 0 Cur PV 2 Act PV 2 VG Size 40.88 TB PE Size 4.00 MB Total PE 10715889 Alloc PE / Size 4999709 / 19.07 TB Free PE / Size 5716180 / 21.81 TB VG UUID 9i82gX-6djB-1KC3-jbZK-nEJ2-9jJh-KvNgJp

“pvdisplay”的输出 pvdisplay --- Physical volume --- PV Name /dev/md2 VG Name vg1 PV Size 27.25 TB / not usable 3.56 MB Allocatable yes PE Size (KByte) 4096 Total PE 7142441 Free PE 2142732 Allocated PE 4999709 PV UUID SmZrd0-jC5T-2QwU-Ecnh-PuY0-O9u6-sqDW1E --- Physical volume --- PV Name /dev/md3 VG Name vg1 PV Size 13.63 TB / not usable 1.62 MB Allocatable yes PE Size (KByte) 4096 Total PE 3573448 Free PE 3573448 Allocated PE 0 PV UUID aQmMu2-gg8j-Be1T-IofO-bOuk-aL0s-ysiR6j

答案1

免责声明:您应该仔细阅读 lvm 手册并了解每个步骤的作用。但是,除非遇到错误,否则风险很小。

在这种情况下,我通常会这么做。

如果其他人有可能做一些事情来扰乱您,您需要在维护时阻止任何登录(根据您的维护程序和公司政策触摸 /etc/nologin 等)。

pvmove /dev/md3 # 确保所有使用的范围都已移走

pvs -o+pv_used # 确保 /dev/md3 中没有使用任何区段

vgreduce vg1 /dev/md3 #现在删除物理卷

相关内容