Akemi

ESXI存储--使用NFS与ISCSI提供存储

2025/06/04

本地存储

即安装ESXI时,服务器上的本地磁盘
但是使用时,需要格式化成VMFS文件系统
以下是创建本地存储的步骤:
选择之后会列出本地可见的块存储,然后可以选择创建指定大小的文件系统
我这里因为没有本地存储就略过了,毕竟很简单

NFS存储

Centos7搭建NFS服务器

1
2
3
4
5
6
7
8
9
10
11
12
13
# 搭建NFS
yum -y install nfs-utils
mkdir /public
chmod 777 /public
echo '/public 10.163.2.0/24(rw)' > /etc/exports
systemctl enable nfs-server.service --now

systemctl disable firewalld.service --now
setenforce 0

# 验证
exportfs -arv
exporting 10.163.2.0/24:/public

ESXI添加存储网络

1.添加虚拟交换机Storage-绑定到vmnic1(第二块网卡)

2.添加端口组storage-隶属于虚拟交换机Storage

3.添加VMkernel网卡-隶属于端口组storage

测试与Centos的网络

创建NFS存储

IPSAN存储

搭建iscsi

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 还是原本那台服务器
yum -y install targetcli
systemctl enable target --now

# 查看磁盘使用情况
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 10G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 9G 0 part
├─centos-root 253:0 0 8G 0 lvm /
└─centos-swap 253:1 0 1G 0 lvm [SWAP]
sdb 8:16 0 500G 0 disk
sdc 8:32 0 500G 0 disk
sdd 8:48 0 500G 0 disk

# 准备使用sdb,配置iscsi
targetcli
/> /backstores/block create ipsan /dev/sdb
/> /iscsi/iqn.1998-01.com.linux:localhost:1786971024:66/tpg1/
/> /iscsi/iqn.1998-01.com.linux:localhost:1786971024:66/tpg1/luns create /backstores/block/ipsan
/> /iscsi/iqn.1998-01.com.linux:localhost:1786971024:66/tpg1/acls create iqn.1998-01.com.vmware:localhost:1786971024:65

这个是vmware的iqn,后面能看到

ss -tunlp |grep 32
tcp LISTEN 0 256 *:3260 *:*

添加iscsi

CATALOG
  1. 1. 本地存储
  2. 2. NFS存储
    1. 2.1. Centos7搭建NFS服务器
    2. 2.2. ESXI添加存储网络
    3. 2.3. 创建NFS存储
  3. 3. IPSAN存储
    1. 3.1. 搭建iscsi
    2. 3.2. 添加iscsi