1、准备磁盘环境
确认系统识别到新加的磁盘
[root@ kitty ~]# ll /dev/sdb
brw-rw----. 1 root disk 8, 16 Apr 21 03:35 /dev/sdb
2、开始进行配置
[root@ kitty ~]# 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): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help):
创建一个新的分区
Command (m for help): n
All primary partitions are in use
Adding logical partition 5
First sector (6295552-20971519, default 6295552):
Using default value 6295552
Last sector, +sectors or +size{K,M,G} (6295552-20971519, default 20971519): +1G
Partition 5 of type Linux and of size 1 GiB is set
保存退出。
3、加载识别分区文件
[root@ kitty ~]# partprobe /dev/sdb
4、格式化
[root@ kitty ~]# mkfs -t xfs /dev/sdb2
5、挂载设置好的磁盘
[root@ kitty ~]# mount /dev/sdb1 /mount01
[root@ kitty ~]# mount /dev/sdb2 /mount02
6、检查
[root@ kitty ~]# df -h
/dev/sdb1 1014M 33M 982M 4% /mount01
/dev/sdb2 1014M 33M 982M 4% /mount02
7、配置/etc/fatab
[root@ kitty ~]# vim /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Mar 11 06:25:14 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=27748e47-5e09-4192-b240-954926fd8423 /boot xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
UUID="132557cb-1f86-4dff-9810-75d07fb37a00" / xfs defaults 0 0
UUID="fa95acd2-7867-4b65-9b27-1de1ca0a4a0a /boot xfs defaults 0 0
UUID="570599b8-980c-422e-812e-f07a1a180fc6" /swap swap defaults 0 0