Clone
4
2.5 TGT
jsc-wiki edited this page 2026-10-14 06:27:29 +00:00
This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

TGT

第2章 網路與儲存 · 來源:JSC 知識庫

簡介

在 Debian 以 TGT 提供 iSCSI 目標,並將 LVM 虛擬磁碟分享出去。

如果使用 PVE 的 CT,版本需要選擇 12.X

步驟

1. 安裝相關套件

apt update && apt install -y tgt lvm2

2. 啟動 TGT 服務

systemctl enable tgt && systemctl start tgt

3. 建立 LVM 虛擬磁碟

dd if=/dev/zero of=/root/target.img bs=1G count=0 seek=512
  • of:位置
  • bs:單位
  • count:?
  • seek:數量,範例為 512G (bs * seek)

4. 設定 TGT 服務到 LVM 虛擬磁碟

nano /etc/tgt/conf.d/target.conf

內容如下

<target iqn.2026-01.jsc.idv.me:target>
    backing-store /root/target.img
</target>

5. 重啟 TGT 服務

systemctl restart tgt && tgt-admin --show

← 2.4 停用 SMB 服務 · 本章目錄 · 全書目錄 · 2.6 OpenSSH →