搭建硬盘
- 集群分片有要求,避免同步失败
- 硬盘数量相同
- 硬盘地址相同
**
选择 SCSI 磁盘类型,不需要 cpu 参与控制
![image.png](https://cdn.nlark.com/yuque/0/2020/png/367873/1589360667378-ff5e880b-0d25-4363-ba86-c5f3c6b1b478.png#align=left&display=inline&height=362&margin=%5Bobject%20Object%5D&name=image.png&originHeight=469&originWidth=430&size=68365&status=done&style=none&width=332) ![image.png](https://cdn.nlark.com/yuque/0/2020/png/367873/1589360674511-cf90f793-587f-4dc6-9894-df20af1490ac.png#align=left&display=inline&height=74&margin=%5Bobject%20Object%5D&name=image.png&originHeight=74&originWidth=352&size=4923&status=done&style=none&width=352)
- 挂载多两个硬盘
给硬盘分区
- 查看当前硬盘
fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 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: 0x00022f87
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM
---
Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 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 /dev/sdc: 1073 MB, 1073741824 bytes, 2097152 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
- 可以看到多了
/dev/sdb
和/dev/sdc
两块硬盘
- 创建分区
- 仅创建主分区
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 0x06d08c49.
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): n
Partition type:
p primary (0 primary, 0 extended, 4 free) # 主分区
e extended # 拓展分区
Select (default p): p
Partition number (1-4, default 1): 1 # 分区编号
First sector (2048-2097151, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151):
Using default value 2097151
Partition 1 of type Linux and of size 1023 MiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
- 再次键入
fdisk -l
会发现/dev/sdb
的分区信息 ```shell
Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 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: 0x06d08c49
Device Boot Start End Blocks Id System /dev/sdb1 2048 2097151 1047552 83 Linux
- 格式化分区
> mkfs -t ext4 /dev/sdb1
- 永久挂载硬盘
> vim /etc/fstab
```shell
# 在后面加载分区对应挂载目录
/dev/sdb1 /mnt/p0 ext4 defaults 0 0
重启
挂载的目录可以访问了
cd /mnt/p0
- 对另外的硬盘和其他分片虚拟机也进行上面的操作