liunx 磁盘扩容(centos7)

1.服务器扩容前

[root@car-template ~]# fdisk  -l

2.服务器增加磁盘容量后

[root@car-template ~]# partprobe 
[root@car-template ~]# fdisk -l

3.给分区扩容

[root@car-template ~]# fdisk  /dev/sda

4.使用partprobe刷新磁盘,查看到新的磁盘 /dev/sda3

[root@car-template ~]# ll /dev/sda*
[root@car-template ~]# partprobe 
[root@car-template ~]# ll /dev/sda*

5.使用pvcreate /dev/sda3

[root@car-template ~]# pvcreate /dev/sda3
  Physical volume "/dev/sda3" successfully created.

 6.使用vgdisplay 命令显示VG Name

7.使用vgextend命令向卷组”centos″中添加物理卷。也可以写成vgextend /dev/mapper/centos /dev/sda3

[root@car-template ~]#  vgextend  centos /dev/sda3
  Volume group "centos" successfully extended

8.使用vgs命令查看容量

[root@car-template ~]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree 
  centos   2   2   0 wz--n- 58.99g 20.00g

9.使用 lvextend  -L 扩展逻辑卷的大小

[root@car-template ~]# lvextend  -L +19.99G /dev/mapper/centos-root
  Rounding size to boundary between physical extents: 19.99 GiB.
  Size of logical volume centos/root changed from <35.12 GiB (8990 extents) to <55.11 GiB (14108 extents).
  Logical volume centos/root successfully resized.

10.使用 xfs_growfs 调整分区大小  centos6.* 使用resize2fs

[root@car-template ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512    agcount=4, agsize=2301440 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=9205760, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=4495, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 9205760 to 14446592

 11.查看调整后的分区大小

posted @ 2019-11-25 15:17  caonw  阅读(430)  评论(0编辑  收藏  举报