输入fdisk -l 出现 Disk /dev/vdb: 128.8 GB, 128849018880 bytes, 251658240 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x873f9756
Device Boot Start End Blocks Id System /dev/vdb1 128 209715072 104857472+ 83 Linux 我们查看到 分区/dev/vdb1 容量为100G /dev/vdb容量为120G
第一步 卸载原有分区 umount /dev/vdb1
第二步 输入parted /dev/vdb 进入分区编辑 GNU Parted 3.1 Using /dev/vdb Welcome to GNU Parted! Type 'help' to view a list of commands. 输入resizepart 1 120G 然后输入quit 退出编辑
第三步 修复分区 因为分区新添加的后部 没有进行分区信息写入 我们需要进行修复 ext4格式 : e2fsck -f /dev/vdb1 xfs格式 : xfs_repair -L /dev/vdb1
第四步 调整文件系统大小 虽然分区大小已经扩容,但文件系统大小尚未调整。此时,我们需要使用resize2fs命令来调整文件系统大小。 resize2fs /dev/vdb1
第五步 重新挂载 mount /dev/vdb1 /www Disk /dev/vdb: 128.8 GB, 128849018880 bytes, 251658240 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x873f9756
Device Boot Start End Blocks Id System /dev/vdb1 128 234375000 117187436+ 83 Linux
查看到扩容成功

评论框