1、执行fdisk /dev/vda命令对磁盘剩余空间进行分区;当遇到Command (m for help):时输入n,表示新建分区;然后当需要输入时,直接按Enter键;当再次遇到Command (m for help):时输入w,表示写入保存。
[root@host-192-168-60-16 ~]# fdisk /dev/vda
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p):
Using default response p
Partition number (3,4, default 3):
First sector (20971520-104857599, default 20971520):
Using default value 20971520
Last sector, +sectors or +size{K,M,G} (20971520-104857599, default 104857599):
Using default value 104857599
Partition 3 of type Linux and of size 40 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
2、执行以下命令更新磁盘分区表
[root@host-192-168-60-16 ~]# partprobe
3、查看刚刚新建的分区,发现名字为vda3,大小为40G
[root@host-192-168-60-16 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 458K 0 rom
vda 252:0 0 50G 0 disk
├─vda1 252:1 0 1G 0 part /boot
├─vda2 252:2 0 9G 0 part
│ ├─centos-root 253:0 0 8G 0 lvm /
│ └─centos-swap 253:1 0 1G 0 lvm [SWAP]
└─vda3 252:3 0 40G 0 part
[root@host-192-168-60-16 ~]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 48.99 GiB
PE Size 4.00 MiB
Total PE 12542
Alloc PE / Size 2303 / <9.00 GiB
Free PE / Size 10239 / <40.00 GiB
VG UUID JuOM4n-bUuZ-eSbn-33eU-Q01c-aXcC-8CMiMD