宜蘭縣教育支援平台 會員登入 會員註冊 我的i教書

« 上一篇 | 下一篇 »

參考網站:
Ubuntu 16.04 LTS : iSCSI Taregt(iscsitarget) : Server World
Ubuntu 16.04 LTS : iSCSI Initiator(Ubuntu) : Server World
Ubuntu 16.04 LTS : iSCSI Taregt(targetcli) : Server World

1. 安裝 targetcli 套件
# apt-get -y install targetcli

2. 建立目錄
# mkdir /iscsi_disks

3. 進入 iscsi 管理介面
# /usr/bin/targetcli
Warning: Could not load preferences file /root/.targetcli/prefs.bin.
targetcli 3.0.pre4.1~ga55d018 (rtslib 3.0.pre4.1~g1b33ceb)
Copyright (c) 2011-2014 by Datera, Inc.
All rights reserved.

/> cd backstores/fileio
/backstores/fileio> create linux-disk /iscsi_disks/linux-disk.img 10G
Using buffered mode.
Created fileio linux-disk.
/backstores/fileio> cd /iscsi
/iscsi> create iqn.2017-04.tces.test:linux.disk
Created target iqn.2017-04.tces.test:linux.disk.
Selected TPG Tag 1.
Created TPG 1.

/iscsi> cd iqn.2017-04.tces.test:linux.disk/tpg1/portals
/iscsi/iqn.20.../tpg1/portals> create 0.0.0.0
Using default IP port 3260
Created network portal 0.0.0.0:3260.

/iscsi/iqn.20.../tpg1/portals>
cd ../luns
/iscsi/iqn.20...isk/tpg1/luns> create /backstores/fileio/linux-disk
Selected LUN 0.
Created LUN 0.

/iscsi/iqn.20...isk/tpg1/luns> cd ../acls
/iscsi/iqn.20...isk/tpg1/acls> create iqn.2017-04.tces.test:linux-pc
Created Node ACL for iqn.2017-04.tces.test:linux-pc
Created mapped LUN 0.
/iscsi/iqn.20...isk/tpg1/acls> cd iqn.2017-04.tces.test:linux-pc
/iscsi/iqn.20...test:linux-pc> set auth userid=username
Parameter userid is now 'username'.
/iscsi/iqn.20...test:linux-pc> set auth password=password
Parameter password is now 'password'.
/iscsi/iqn.20...test:linux-pc> exit
Comparing startup and running configs...
Some changes need saving.
Save configuration? [Y/n]: y
Saving new startup configuration

4. 檢查是否有正常執行
# netstat -antulp | grep :3260
tcp        0      0 0.0.0.0:3260            0.0.0.0:*               LISTEN      -

5. 設定開機啟動
# systemctl enable target.service
target.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install enable target




 
 
 
用LINE傳送

發表迴響

 暱稱 (必填)

 悄悄話

 標題

 個人網頁

 電子郵件

authimage 
 認證碼 (必填)