centos LVM扩容
centos LVM扩容
#创建物理卷,将新增磁盘加入到物理卷。 [ ~]# pvcreate /dev/sdb Physical volume "/dev/sdb" successfully created ##查看物理卷。 [ ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 vg_template lvm2 a--u 39.51g 0 /dev/sdb lvm2 ---- 20.00g 20.00g ##查看物理卷信息。 [ ~]# 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)。 [ ~]# vgextend vg_template /dev/sdb Volume group "vg_template" successfully extended ###先查看vg信息,然后将原/dev/vg_template/lv_root 逻辑卷的大小增加。 [ ~]# 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逻辑卷进行扩容(可能是虚拟机的问题,+20GB提示空间超了)。 [ vg_template]# lvextend -l +100%FREE /dev/mapper/vg_template-lv_root ###然后运行resize2fs命令 对容量重新扩容。 [ vg_template]# resize2fs /dev/mapper/vg_template-lv_root ####xfs格式的分区用xfs_growfs 命令对容量重新扩容。 [_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 ##查看空间是否增大。 [ vg_template]# df -TH ########异常问题处理: 1:pvcreate [_012 ~]# pvcreate /dev/sda Device /dev/sda excluded by a filter. [_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 ###处理方法: [_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
相关推荐
无忧老猪 2020-10-09
lfjjia 2020-05-28
邓博学习笔记 2020-08-03
tianhuak 2020-11-24
86276537 2020-11-19
大牛牛 2020-10-30
flycappuccino 2020-09-27
卢从利 2020-10-10
学峰的学习笔记 2020-10-05
85216033 2020-09-16
兄dei努力赚钱吧 2020-09-06
89334799 2020-08-12
ruanhongbiao 2020-08-16
ningningmingming 2020-07-28
zhongzhiwei 2020-07-27
Jiajinjin 2020-07-27
manimnchn 2020-07-26
xiyoukeke 2020-07-19