给VMware虚拟机中的CentOS分区扩容的操作笔记

2020-01-30 14:57:18王振洲

[root@dev-vhost017 ~]# mkfs.ext4 /dev/sda3

lvm 扩容

复制代码
[root@dev-vhost017 ~]# pvcreate /dev/sda3

  Physical volume "/dev/sda3" successfully created
 
复制代码
[root@dev-vhost017 ~]# pvs

  PV         VG         Fmt  Attr PSize  PFree
  /dev/sda2  vg_centos6 lvm2 a--   9.51g     0
  /dev/sda3             lvm2 ---  40.00g 40.00g
 
复制代码
[root@dev-vhost017 ~]# vgextend /dev/mapper/vg_centos6 /dev/sda3 (注意组名)

  Volume group "vg_centos6" successfully extended
 
复制代码
[root@dev-vhost017 ~]# lvextend -L 39.9G /dev/vg_centos6/lv_root /dev/sda3

  Rounding size to boundary between physical extents: 39.90 GiB
  Size of logical volume vg_centos6/lv_root changed from 8.51 GiB (2178 extents) to 39.90 GiB (10215 extents).
  Logical volume lv_root successfully resized
 
 
复制代码
[root@dev-vhost017 ~]# resize2fs /dev/vg_centos6/lv_root

resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_centos6/lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 3
Performing an on-line resize of /dev/vg_centos6/lv_root to 10460160 (4k) blocks.
The filesystem on /dev/vg_centos6/lv_root is now 10460160 blocks long.
 
 
复制代码
[root@dev-vhost017 ~]# pvs

  PV         VG         Fmt  Attr PSize  PFree
  /dev/sda2  vg_centos6 lvm2 a--   9.51g    0
  /dev/sda3  vg_centos6 lvm2 a--  40.00g 8.60g

复制代码
[root@dev-vhost017 ~]# vgs

  VG         #PV #LV #SN Attr   VSize  VFree
  vg_centos6   2   2   0 wz--n- 49.50g 8.60g

复制代码
[root@dev-vhost017 ~]# lvs

  LV      VG         Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv_root vg_centos6 -wi-ao---- 39.90g                                                  
  lv_swap vg_centos6 -wi-ao----  1.00g