虚拟机磁盘空间已满,扩容磁盘空间(vmware)

确定磁盘空间是否已满:
[root@xlaravel healsbackend]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos_xlaravel-root 17G 17G 0G 100% /
devtmpfs 894M 0 894M 0% /dev
tmpfs 910M 0 910M 0% /dev/shm
tmpfs 910M 11M 900M 2% /run
tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/sda1 1014M 179M 836M 18% /boot
tmpfs 182M 12K 182M 1% /run/user/42
tmpfs 182M 0 182M 0% /run/user/0

可见磁盘空间已满

拓展;
第一步:
在这里插入图片描述
磁盘大小变更为适合大小

[root@xlaravel healsbackend]# fdisk /dev/sda 对该硬盘进行操作

The number of cylinders for this disk is set to 5221.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

  1. software that runs at boot time (e.g., old versions of LILO)

  2. booting and partitioning software from other OSs

(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n 新建分区

p 主分区

Selected partition 3 默认的分区编号
w 保存

重启系统

重启后,确认新的分区

[root@xlaravel healsbackend]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track, 5221 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 1 13 104391 83 Linux

/dev/sda2 14 2610 20860402+ 8e Linux LVM

/dev/sda3 2611 5221 20972857+ 83 Linux

————————————————–

4.将新建磁盘分区作为文件系统的扩展

扩展LVM

创建物理卷(pv):在刚刚创建的磁盘分区上创建pv

[root@xlaravel healsbackend]# pvcreate /dev/sda3

Physical volume “/dev/sda3″ successfully created

扩展卷组(vg): 把刚刚创建的Pv加载到卷组上

[root@xlaravel healsbackend]# vgextend /dev/mapper/centos_xlaravel /dev/sda3

Volume group “centos_xlaravel″ successfully extended

扩展逻辑卷(lv):将卷组上的逻辑卷扩容

[root@xlaravel healsbackend]# lvextend -L +19.99G /dev/mapper/centos_xlaravel-root

Extending logical volume LogVol00 to 37.91 GB

Logical volume LogVol00 successfully resized

扩展文件系统:刷新逻辑卷上的文件系统可用空间大小
执行 resize2fs /dev/mapper/centos_xlaravel-root报错
改为执行xfs_growfs /dev/mapper/centos_xlaravel-root

resize2fs 针对文件系统ext2 ext3 ext4
xfs_growfs 针对文件系统xfs

————————————————–

  1. 核实磁盘空间是否增大

[root@xlaravel healsbackend]]# df -h

文件系统 容量 已用 可用 已用% 挂载点

/dev/mapper/centos_xlaravel-root 37G 15G 21G 42% /

/dev/sda1 99M 14M 80M 15% /boot

tmpfs 872M 0 872M 0% /dev/shm

none 872M 104K 872M 1% /var/lib/xenstored

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值