Update Servers/Virtualization/Proxmox/Configuring iSCSI-based Cluster Storage.md
All checks were successful
GitOps Automatic Deployment / GitOps Automatic Deployment (push) Successful in 6s

This commit is contained in:
2026-01-06 21:36:03 -07:00
parent 8b684e836e
commit 25d859af8f

View File

@@ -8,8 +8,6 @@ This approach is intended to:
- Avoid third-party plugins or middleware - Avoid third-party plugins or middleware
- Be fully reproducible via CLI - Be fully reproducible via CLI
---
## Assumptions ## Assumptions
- TrueNAS **CORE** (not SCALE) - TrueNAS **CORE** (not SCALE)
- ZFS pool already exists and is healthy - ZFS pool already exists and is healthy
@@ -21,8 +19,6 @@ This approach is intended to:
!!! warning "Important" !!! warning "Important"
`volblocksize` **cannot be changed after zvol creation**. Choose carefully. `volblocksize` **cannot be changed after zvol creation**. Choose carefully.
---
## Target Architecture ## Target Architecture
``` ```
@@ -34,14 +30,12 @@ ZFS Pool
└─ VM Disks └─ VM Disks
``` ```
---
## Step 1 Create a Dedicated Zvol for Proxmox ## Step 1 Create a Dedicated Zvol for Proxmox
### Variables ### Variables
Adjust as needed before execution. Adjust as needed before execution.
``` ```sh
POOL_NAME="CLUSTER-STORAGE" POOL_NAME="CLUSTER-STORAGE"
ZVOL_NAME="iscsi-proxmox" ZVOL_NAME="iscsi-proxmox"
ZVOL_SIZE="14T" ZVOL_SIZE="14T"
@@ -49,7 +43,7 @@ VOLBLOCKSIZE="16K"
``` ```
### Create the Zvol (Thick-Provisioned) ### Create the Zvol (Thick-Provisioned)
``` ```sh
zfs create -V ${ZVOL_SIZE} \ zfs create -V ${ZVOL_SIZE} \
-o volblocksize=${VOLBLOCKSIZE} \ -o volblocksize=${VOLBLOCKSIZE} \
-o compression=lz4 \ -o compression=lz4 \
@@ -63,110 +57,66 @@ zfs create -V ${ZVOL_SIZE} \
--- ---
## Step 2 Configure iSCSI Target (TrueNAS CLI) ## Step 2 Configure iSCSI Target (TrueNAS CLI)
```sh
### Enable iSCSI Service # Enable iSCSI Service
```
service iscsitarget start service iscsitarget start
sysrc iscsitarget_enable=YES sysrc iscsitarget_enable=YES
```
--- # Create iSCSI Portal
### Create iSCSI Portal
```
ctladm create -p 0.0.0.0 ctladm create -p 0.0.0.0
```
--- # Create Target
### Create Target
```
ctladm create -t proxmox-target ctladm create -t proxmox-target
```
--- # Create Extent
ctladm create -b block -l /dev/zvol/${POOL_NAME}/${ZVOL_NAME} proxmox-extent
### Create Extent
```
ctladm create -b block \
-l /dev/zvol/${POOL_NAME}/${ZVOL_NAME} \
proxmox-extent
```
---
### Associate Target + Extent ### Associate Target + Extent
```
ctladm add -t proxmox-target -l proxmox-extent ctladm add -t proxmox-target -l proxmox-extent
``` ```
!!! tip !!! tip
At this point, the LUN is live and can be discovered by initiators. At this point, the LUN is live and can be discovered by initiators.
---
## Step 3 Connect from Proxmox VE Nodes ## Step 3 Connect from Proxmox VE Nodes
Perform the following **on each Proxmox node**. Perform the following **on each Proxmox node**.
```sh
### Install iSCSI Utilities # Install iSCSI Utilities
```
apt update apt update
apt install -y open-iscsi lvm2 apt install -y open-iscsi lvm2
```
--- # Discover Target
### Discover Target
```
iscsiadm -m discovery -t sendtargets -p <TRUENAS_IP> iscsiadm -m discovery -t sendtargets -p <TRUENAS_IP>
```
--- # Log In
### Log In
```
iscsiadm -m node --login iscsiadm -m node --login
```
---
### Verify Device ### Verify Device
```
lsblk lsblk
``` ```
---
## Step 4 Create Shared LVM (One Node Only) ## Step 4 Create Shared LVM (One Node Only)
!!! warning "Important" !!! warning "Important"
**Only run LVM creation on ONE node**. All other nodes will only scan. **Only run LVM creation on ONE node**. All other nodes will only scan.
### Initialize Physical Volume ```sh
``` # Initialize Physical Volume
pvcreate /dev/sdX pvcreate /dev/sdX
```
--- # Create Volume Group
### Create Volume Group
```
vgcreate vg_proxmox_iscsi /dev/sdX vgcreate vg_proxmox_iscsi /dev/sdX
``` ```
---
## Step 5 Register Storage in Proxmox ## Step 5 Register Storage in Proxmox
### Rescan LVM (Other Nodes) ### Rescan LVM (Other Nodes)
``` ```sh
pvscan pvscan
vgscan vgscan
``` ```
---
### Add Storage (GUI or CLI) ### Add Storage (GUI or CLI)
**Datacenter → Storage → Add → LVM** **Datacenter → Storage → Add → LVM**
@@ -176,8 +126,6 @@ vgscan
- Content: `Disk image` - Content: `Disk image`
- Shared: ✔️ - Shared: ✔️
---
## Step 6 Validation ## Step 6 Validation
- Snapshot create / revert / delete - Snapshot create / revert / delete
@@ -187,34 +135,19 @@ vgscan
!!! success !!! success
If all validation tests pass, the storage is production-ready. If all validation tests pass, the storage is production-ready.
---
## Step 7 Decommission NFS (After Cutover) ## Step 7 Decommission NFS (After Cutover)
``` ```sh
zfs destroy CLUSTER-STORAGE/NFS-STORAGE zfs destroy CLUSTER-STORAGE/NFS-STORAGE
``` ```
---
## Step 8 Expand iSCSI Storage (No Downtime) ## Step 8 Expand iSCSI Storage (No Downtime)
### Expand Zvol (TrueNAS) ```sh
``` # Expand Zvol (TrueNAS)
zfs set volsize=16T CLUSTER-STORAGE/iscsi-proxmox zfs set volsize=16T CLUSTER-STORAGE/iscsi-proxmox
zfs set refreservation=16T CLUSTER-STORAGE/iscsi-proxmox zfs set refreservation=16T CLUSTER-STORAGE/iscsi-proxmox
```
--- # Rescan on Proxmox Nodes
### Rescan on Proxmox Nodes
```
pvresize /dev/sdX pvresize /dev/sdX
``` ```
---
## Final Notes
- Maintain ≥1520% free pool capacity
- Monitor pool usage and fragmentation
- Prefer PBS restores for large migrations