用户工具

站点工具


freebsd:os:iscsi_over_zfs

这是本文档旧的修订版!


iSCSI Over ZFS Cheat Code

FreeBSD 官方文档: https://www.freebsd.org/doc/handbook/network-iscsi.html

以下例子为本机同时做 Target 和 Initiator

ZFS

# zfs create -o compress=lz4 -o volblocksize=64k -s -V 10G tank/iscsi

/etc/ctl.conf

auth-group ag0 {
	chap user 1234567890123456
}

portal-group pg0 {
	discovery-auth-group no-authentication
	listen 0.0.0.0
	listen [::]
}

target iqn.2016-10.org.hshh:target0 {
	auth-group ag0
	portal-group pg0
	lun 0 {
		path /dev/zvol/tank/iscsi
	}
}

/etc/iscsi.conf

t0 {
	TargetAddress	= 127.0.0.1
	TargetName	= iqn.2016-10.org.hshh:target0
	AuthMethod	= CHAP
	chapIName	= user
	chapSecret	= 1234567890123456
}

/etc/rc.conf

ctld_enable="YES"
iscsid_enable="YES"
iscsictl_enable="YES"
iscsictl_flags="-Aa"

iSCSI Target (Server)

# service ctld start

iSCSI Initiator (Client)

# service iscsid start
# service iscsictl start

Disk

# camcontrol devlist
# gpart create -s gpt da6
# gpart add -t freebsd-ufs da6
# newfs -j da6p1
# mount /dev/da6p1 /mnt

Remove

# umount /mnt
# iscsictl -L
# iscsictl -Ra
# service iscsid stop
# service ctld stop
# kldstat
freebsd/os/iscsi_over_zfs.1475743774.txt.gz · 最后更改: 2016/10/06 16:49 由 Hshh

工业和信息化部备案管理系统网站 浙ICP备05015161号-1