前期准备:Vmware workstaton虚拟机软件及可用的Centos7系统
1、在虚拟机中新添一块120G的硬盘,已备分区使用,重启系统即可进行分区操作。
2、查看系统上是否识别出的新增的硬盘:
[root@centos7 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 200G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 50G 0 part /
├─sda3 8:3 0 2G 0 part [SWAP]
├─sda4 8:4 0 1K 0 part
└─sda5 8:5 0 10G 0 part /data
sdb 8:16 0 120G 0 disk
sr0 11:0 1 10G 0 rom
3、下面对/dev/sdb硬盘进行分区,硬盘一共120G要求分3个分区,第一个分区为40G,第二个分区为50G,第三个分区为30G:
[root@centos7 ~]# fdisk /dev/sdb
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.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x15c20061.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-251658239, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-251658239, default 251658239): +40G
Partition 1 of type Linux and of size 40 GiB is set
Command (m for help): N
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p):
Using default response p
Partition number (2-4, default 2):
First sector (83888128-251658239, default 83888128):
Using default value 83888128
Last sector, +sectors or +size{K,M,G} (83888128-251658239, default 251658239): +50G
Partitio