#创建物理卷,将新增磁盘加入到物理卷
[root@Template ~]# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created
#查看物理卷
[root@Template ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 vg_template lvm2 a--u 39.51g 0
/dev/sdb lvm2 ---- 20.00g 20.00g
#查看物理卷信息
[root@Template ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name vg_template
PV Size 39.51 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 10114
Free PE 0
Allocated PE 10114
PV UUID A6Ai9a-LdqF-GbCn-p0DF-3V3X-j3h1-KfvlI4
"/dev/sdb" is a new physical volume of "20.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb
VG Name
PV Size 20.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID sxgFvu-x0au-8CxD-g6I6-yCJe-M9gg-Ax2jiu
#扩展卷组vg_template,即将PV加入卷组(VG)
[root@Template ~]# vgextend vg_template /dev/sdb
Volume group "vg_template" successfully extended
#先查看vg信息,然后将原/dev/vg_template/lv_root 逻辑卷的大小增加
[root@Template ~]# vgdisplay
--- Volume group ---
VG Name vg_template
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 59.50 GiB
PE Size 4.00 MiB
Total PE 15233
Alloc PE / Size 10114 / 39.51 GiB
Free PE / Size 5119 / 20.00 GiB
VG UUID p5VnUJ-vdh9-7ffb-guxI-97sR-GnzU-rwzyc4
#运行扩容命令,对/dev/vg_template/lv_root逻辑卷进行扩容
[root@Template vg_template]# lvextend -l +100%FREE /dev/mapper/vg_template-lv_root
#查看分区格式,如果分区格式是ext,用resize2fs扩容;如果分区格式是xfs,用xfs_growfs扩容。命令如下
[root@node172 ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vg_root-lv_root xfs 930G 70G 861G 8% /
#然后运行resize2fs命令 对容量重新扩容
[root@Template vg_template]# resize2fs /dev/mapper/vg_template-lv_root
#xfs格式的分区用xfs_growfs 命令对容量重新扩容
[root@sz_012 ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=28311552 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=113246208, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=55296, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 113246208 to 932805632
#查看空间是否增大
[root@Template vg_template]# df -Th
##异常问题处理
1:pvcreate
[root@sz_012 ~]# pvcreate /dev/sda
Device /dev/sda excluded by a filter.
[root@sz_012 ~]# parted /dev/sda
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: LSI MR9270-8i (scsi)
Disk /dev/sda: 3357GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags
###处理方法:
[root@sz_012 ~]# parted /dev/sda
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel loop
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted) p
Model: LSI MR9270-8i (scsi)
Disk /dev/sda: 3357GB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容