1.查看块设备信息
[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 100G 0 part /
├─sda3 8:3 0 50G 0 part /data
├─sda4 8:4 0 1K 0 part
├─sda5 8:5 0 4G 0 part [SWAP]
├─sda6 8:6 0 1G 0 part
└─sda7 8:7 0 2G 0 part
sdb 8:16 0 200G 0 disk
sdc 8:32 0 20G 0 disk
sdd 8:48 0 10G 0 disk
sr0 11:0 1 1024M 0 rom
sr1 11:1 1 1024M 0 rom
以下将在sdb磁盘作为操作目标
- 在sdb磁盘上创建大小为2G的分区
[root@centos7 ~]#fdisk /dev/sdd
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 0x87a3f767.
Command (m for help):