新增 Service:TGT
44
Service%EF%BC%9ATGT.md
Normal file
44
Service%EF%BC%9ATGT.md
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
如果使用 PVE 的 CT,版本需要選擇 12.X
|
||||||
|
|
||||||
|
# 安裝相關套件
|
||||||
|
|
||||||
|
```bash
|
||||||
|
apt update && apt install -y tgt lvm2
|
||||||
|
```
|
||||||
|
|
||||||
|
# 啟動 TGT 服務
|
||||||
|
|
||||||
|
```bash
|
||||||
|
systemctl enable tgt && systemctl start tgt
|
||||||
|
```
|
||||||
|
|
||||||
|
# 建立 LVM 虛擬磁碟
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dd if=/dev/zero of=/root/target.img bs=1G count=0 seek=512
|
||||||
|
```
|
||||||
|
|
||||||
|
- of:位置
|
||||||
|
- bs:單位
|
||||||
|
- count:?
|
||||||
|
- seek:數量,範例為 512G (bs * seek)
|
||||||
|
|
||||||
|
# 設定 TGT 服務到 LVM 虛擬磁碟
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nano /etc/tgt/conf.d/target.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
內容如下
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<target iqn.2026-01.jsc.idv.me:target>
|
||||||
|
backing-store /root/target.img
|
||||||
|
</target>
|
||||||
|
```
|
||||||
|
|
||||||
|
# 重啟 TGT 服務
|
||||||
|
|
||||||
|
```bash
|
||||||
|
systemctl restart tgt && tgt-admin --show
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user