VMWare&CentOS7硬盘扩容

1,虚拟机关机,虚拟机设置->硬盘->磁盘实用工具->扩展,设置更大的磁盘总量。

2,虚拟机开机,fdisk -l看到/dev/sda:显示的容量已经扩大,后面还需要  (创建物理卷)->(加入卷组)->(扩容逻辑卷)->(操作系统reload)

        创建物理卷:命令 fdisk /dev/sda   (在现有sda下创建设备sda3)

[root@localhost ~]# fdisk /dev/sda

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

依次选择执行n、p、t、w   (序号会自增为3,即设备名为sda3)

pvdisplay查看现有物理卷(PV Name:/dev/sda2;VG Name:centos),依然没有sda3

[root@localhost ~]# reboot

[root@localhost ~]# pvcreate /dev/sda3

重启后,执行pvcreate /dev/sda3   可添加相应的物理卷。

        加入卷组:vgdisplay命令查看卷组,加入原有的卷组即可(VG Name:centos),执行vgextend centos /dev/sda3将新建的sda3物理卷加入原有的centos组

        扩容逻辑卷:lvdisplay查看所有逻辑卷,找到需要扩容的逻辑卷的LV Path属性,

执行lvextend -L +20G /dev/centos/root将物理容量20G纳入逻辑卷。

也可执行lvextend /dev/centos/root /dev/sda3 将物理卷sda3全部纳入逻辑卷。

        操作系统reload:执行xfs_growfs /dev/mapper/centos-root重新检测文件系统容量,这里的目录是fdisk -l查看到的逻辑磁盘名称

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值