• Welcome to LiuJason's Blog!

Proxmox下新建ZFS volume并使用iSCSI共享

Linux笔记 Jason 2 years ago (2021-10-22) 342 Views 0 Comments QR code of this page
文章目录[隐藏]

前言

最近在做无盘集群,使用到iPXE+TFTP+iSCSI的方案,其中iSCSI是基于ZFS的volume的,这里记录一下部署流程。

服务端部署

首先确定target名称:iqn.2021-10.cn.cloudraft.pve.us01:node.02
命名规范:iqn.-.:

<yyyy> – The year in 4-digit format. i.e. 2021, 2018
<mm> – The numeric month in 2-digit format. Should be in the range 01-12. i.e. 01 (for January), 08 (for August), 12 (December)
<fqdn-reverse-format> – The fully qualified domain name in reverse format. i.e. iscsi.linuxhint.com should be written as com.linuxhint.iscsi.
<unique-identifier> – It can be anything unique in your setup. For small home and office setup, you may use the ZFS pool name and volume name (i.e., pool1.vol1, pool1.vol2) or the department/branch name (i.e., engineering.pc1, account.pc2, engineering.us-1, account.uk-2) of the clients that will use these shared volumes. That should be unique enough. In a large company, you may use a unique UUID for each target.

准备依赖环境

apt install open-iscsi tgt -y

新建target

tgtadm --lld iscsi --op new --mode target --tid 2 --targetname iqn.2021-10.cn.cloudraft.pve.us01:node.02
tgtadm --lld iscsi --op show --mode target

新建存储设备

zfs create -V 32G rpool/node-02

绑定存储设备

tgtadm --lld iscsi --op new --mode logicalunit --tid 2 --lun 1 --backing-store /dev/rpool/node-02

设置允许访问的ip地址

tgtadm --lld iscsi --op bind --mode target --tid 2 --initiator-address 192.168.1.2

保存设置

tgt-admin --dump | tee /etc/tgt/targets.conf

重新载入tgt服务

service tgt reload

查看tgt服务状态

root@PVE-US01-01:~# ss -tlpn
State        Recv-Q       Send-Q             Local Address:Port             Peer Address:Port      Process                                                                                                                                               
....                                                                                                         
LISTEN       0            4096                        [::]:3260                     [::]:*          users:(("tgtd",pid=1062978,fd=7)) 
....

客户端部署

安装依赖环境

apt install open-iscsi

读取iSCSI信息

iscsiadm --mode discovery --type sendtargets --portal 192.168.1.1

连接iSCSI磁盘

iscsiadm --mode node --targetname iqn.2021-10.cn.cloudraft.pve.us01:node.02 -p 192.168.1.1 --login

This article is under CC BY-NC-SA 4.0 license.
Please quote the original link:https://www.liujason.com/article/1192.html
Like (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址