14
2025
04
22:53:49

iscsi 存储服务

iscsi 存储可以通过以太网挂载块设备(磁盘),换句话就是通网就能用。扩硬盘最方便的方式就是挂iscsi存储。

这里使用 ubuntu 作为 iscsi 服务端(target端)进行演示。首先在服务器上安装 targetcli 工具,方便管理 target 端。














# apt-get install targetcli-fb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:  
python3-configshell-fb python3-pyudev python3-rtslib-fb python3-urwidSuggested packages:  
python-urwid-docThe following NEW packages will be installed:  
python3-configshell-fb python3-pyudev python3-rtslib-fb python3-urwid targetcli-fb
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 323 kB of archives.
After this operation, 2,047 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
安装完 targetcli 工具,就可以开始创建存储介质了。这里使用文件模拟硬盘。使用 fallocate 快速创建大文件(类似windows上的fsutil工具,可以参考上期文章:Windows下的稀疏文件)。

fallocate -l 64T disk_win_64T.img
在 targetcli 中创建存储资源:




$ targetcli
targetcli shell version 2.1.53
/> cd /backstores/fileio
/backstores/fileio> create name=disk1 file_or_dev=/data/hyang0/disk_win_64T.img
创建 target


/> cd /iscsi
/iscsi> create inq.2025-04.vip.it:st-target1
绑定 target 和 存储


/> cd /iscsi/inq.2025-04.vip.it:st-target1/tpg1/
iscsi/iqn...../tpg1/luns> create /backstores/fileio/disk1
设置 ACL


> cd acls
> create iqn.1991-05.com.microsoft:win-11hxxxx
服务端配置完成,后面是配置 windows 客户端:
在 iscsi Initiator 中输出服务器IP或域名,点击快速连接。连接成功后,在 initiator 中可以看到目标。
在 windows 磁盘管理中可以看到挂起的新磁盘:
右键初始化磁盘,为磁盘分区。
格式化磁盘后,到资源管理器中查看挂载的磁盘目录。
最后测个速:
千兆网卡,iscsi 存储受限于网速。




推荐本站淘宝优惠价购买喜欢的宝贝:

image.png

本文链接:https://zblog.hqyman.cn/post/10528.html 非本站原创文章欢迎转载,原创文章需保留本站地址!

分享到:
打赏





休息一下~~


« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

请先 登录 再评论,若不是会员请先 注册

您的IP地址是: