一、执行parted
parted
执行print命令,查看当前分区情况
(parted) print
Model: ATA VMware Virtual S (scsi)
Disk /dev/sda: 17.2GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
128 17.4kB 262kB 245kB bios_grub
1 262kB 134MB 134MB fat16 legacy_boot
2 134MB 403MB 268MB
3 403MB 10.0GB 9597MB ext4
二、这里对分区3进行扩容,完成后退出
(parted) resizepart
Partition number? 3 //第3个分区
Warning: Partition /dev/sda3 is being used. Are you sure you want to continue?
Yes/No? yes
End? [9597MB]? 1G //设置大小
(parted) quit
Information: You may need to update /etc/fstab.
三、执行resize2fs对文件系统进行扩容
resize2fs -p /dev/sda3
四、执行df -h可以看到分区大小已经更新,则证明扩容成功
df -h