将空间从一个卷组重新分配到另一个卷组 - Linux CentOs

将空间从一个卷组重新分配到另一个卷组 - Linux CentOs

我有一台 1and1 提供的专用服务器。我开始将网站迁移到该服务器,却发现磁盘空间不足。我不得不清除备份才能继续迁移我的网站。我觉得这很奇怪,因为服务器自带 4T 的磁盘空间。

通过 ssh 访问系统时,我看到 1and1 的以下设置:

#vgdisplay

 --- Volume group ---
VG Name               vg00
System ID
Format                lvm2
Metadata Areas        1
Metadata Sequence No  8
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                3
Open LV               3
Max PV                0
Cur PV                1
Act PV                1
VG Size               <54.00 GiB
PE Size               4.00 MiB
Total PE              13823
Alloc PE / Size       11520 / 45.00 GiB
Free  PE / Size       2303 / <9.00 GiB
VG UUID               CmLv2a-xKAn-cFQQ-K4TU-f5y2-UK8K-Uv1PO9

--- Volume group ---
VG Name               hdd
System ID
Format                lvm2
Metadata Areas        1
Metadata Sequence No  2
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                1
Open LV               1
Max PV                0
Cur PV                1
Act PV                1
VG Size               <3.58 TiB
PE Size               4.00 MiB
Total PE              938308
Alloc PE / Size       1024 / 4.00 GiB
Free  PE / Size       937284 / <3.58 TiB
VG UUID               Pv2xfH-zkE1-hgH0-dOzZ-FgKp-IobS-5C2zea

Also #pvscan reveals this:
PV /dev/sda3   VG vg00            lvm2 [<54.00 GiB / <9.00 GiB free]
PV /dev/sdb1   VG hdd             lvm2 [<3.58 TiB / <3.58 TiB free]

有人能告诉我将未使用的可用空间放入根卷组的最佳过程吗?我搜索过并看到了很多不同的答案。因为我已经开始迁移一些网站。我不能承受服务器损坏的后果,否则我会像往常一样摆弄、损坏并学习。

只是想到了没有提到这是硬件 Raid 5

更新以下问题:

#pvdisplay
--- Physical volume ---
 PV Name               /dev/sda3
 VG Name               vg00
 PV Size               <54.00 GiB / not usable 2.81 MiB
 Allocatable           yes
 PE Size               4.00 MiB
 Total PE              13823
 Free PE               767
 Allocated PE          13056
 PV UUID               6J06IE-52et-s8aV-bXk0-alud-0N1v-NEwHHr

 --- Physical volume ---
 PV Name               /dev/sdb1
 VG Name               hdd
 PV Size               <3.58 TiB / not usable <3.78 MiB
 Allocatable           yes
 PE Size               4.00 MiB
 Total PE              938308
 Free PE               937284
 Allocated PE          1024
 PV UUID               bGlBQQ-gnmF-gOav-VTfj-np5R-sAKs-YNxemq

我想将 /dev/sdb1 中的物理卷减少 2 或 3TB,并将 /dev/sda3 增加相同的量。可以这样做吗?如果可以,我需要遵循什么流程?

如果没有,我注意到回复中提到“将网站迁移到硬盘”,我必须遵循什么流程,以及这样做有什么后果?

Logical Volumes: 

--- Logical volume ---
LV Path                /dev/vg00/usr
LV Name                usr
VG Name                vg00
LV UUID                sRvgQ3-W80K-AJQD-lZid-fqF3-1KTY-JH2Ul0
LV Write Access        read/write
LV Creation host, time ,
LV Status              available
# open                 1
LV Size                15.00 GiB
Current LE             3840
Segments               2
Allocation             inherit
Read ahead sectors     auto
- currently set to     8192
Block device           253:0

--- Logical volume ---
LV Path                /dev/vg00/var
LV Name                var
VG Name                vg00
LV UUID                xWSCRG-vBPH-JLha-yJ8X-3zMP-WgRG-AOoJqO
LV Write Access        read/write
LV Creation host, time ,
LV Status              available
# open                 1
LV Size                31.00 GiB
Current LE             7936
Segments               3
Allocation             inherit
Read ahead sectors     auto
- currently set to     8192
Block device           253:1

--- Logical volume ---
LV Path                /dev/vg00/home
LV Name                home
VG Name                vg00
LV UUID                2foQrE-Wy3C-Ig1Z-zIDy-tTFQ-YyO5-ayHBZl
LV Write Access        read/write
LV Creation host, time ,
LV Status              available
# open                 1
LV Size                5.00 GiB
Current LE             1280
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     8192
Block device           253:2

--- Logical volume ---
LV Path                /dev/hdd/data
LV Name                data
VG Name                hdd
LV UUID                GwJgTL-LC8r-jn0a-yQ5H-mTX3-dARL-Xz0eOU
LV Write Access        read/write
LV Creation host, time ,
LV Status              available
# open                 1
LV Size                4.00 GiB
Current LE             1024
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     8192
Block device           253:3

我将 /dev/vg00/var 上的 LV 增加了 100%(这是存储网站的地方)。但是一旦我继续迁移更多网站,它将很快被用完!

这也可能有帮助。这是从运行 mount 命令中删除的附加行:

/dev/sda1 on / type ext3 (rw,noatime,data=ordered)
/dev/mapper/vg00-usr on /usr type ext4 (rw,noatime,data=ordered)
/dev/mapper/hdd-data on /data type ext4 (rw,noatime,quota,usrquota,data=ordered)
/dev/mapper/vg00-home on /home type ext4 (rw,noatime,quota,usrquota,data=ordered)
/dev/mapper/vg00-var on /var type ext4 (rw,noatime,quota,usrquota,data=ordered)

非常感谢您的回复!

答案1

我假设 /data 是您要迁移的数据所在的位置。底层卷位于“hdd”卷组上,该卷组的大小超过 3.5 TB。为什么不将其大小设置为足以容纳您要迁移的数据的大小?您应该能够在源上测量它并相应地调整 /dev/hdd/data。

相关内容