1.查看空闲的空间

[root@idc ~]# fdisk -l

2.使用fdisk开始分区

[root@idc ~]# fdisk /dev/sdb
Command (m for help): p    #查看当前磁盘信息
Disk /dev/sdb: 139.6 GB, 139586437120 bytes, 272629760 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: 0xe81de2df
   Device Boot      Start         End      Blocks   Id  System
Command (m for help): n    #创建分区
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p    #主分区
Partition number (1-4, default 1):    #回车默认
First sector (2048-272629759, default 2048):    #回车默认
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-272629759, default 272629759):    #默认使用所有空间,可以+自 
己想要的空间
Using default value 272629759
Partition 1 of type Linux and of size 130 GiB is set
Command (m for help): w    #保存
The partition table has been altered!

3.使用fdisk再次查看该磁盘信息

[root@idc ~]# 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.
Command (m for help): p
Disk /dev/sdb: 139.6 GB, 139586437120 bytes, 272629760 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: 0xe81de2df
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   272629759   136313856   83  Linux
Command (m for help): q

4.格式化文件系统

[root@idc ~]# mkfs.ext4 /dev/sdb1

5.进行挂载分区

[root@idc ~]# mount /dev/sdb1 /emmm/

6.df -h查看挂载信息

[root@idc ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   48G  3.2G   45G   7% /
devtmpfs                 991M     0  991M   0% /dev
tmpfs                   1001M     0 1001M   0% /dev/shm
tmpfs                   1001M  100M  902M  10% /run
tmpfs                   1001M     0 1001M   0% /sys/fs/cgroup
/dev/sda1                497M  134M  363M  27% /boot
tmpfs                    201M     0  201M   0% /run/user/0
/dev/sdb1                128G   61M  122G   1% /emmm

7.查看该分区的UUID号

[root@idc ~]# blkid /dev/sdb1
/dev/sdb1: UUID="5dc66a53-27b2-4395-abc6-4dbffe7c1a6d" TYPE="ext4"

8.编辑/etc/fstab文件设置自动挂载

[root@idc ~]# vi /etc/fstab
UUID="5dc66a53-27b2-4395-abc6-4dbffe7c1a6d" /emmm ext4 defaults 0 0

9.验证自动挂载

[root@idc ~]# mount -a