fix: remove zvol delete from run_delete_lu to eliminate false negative (#240)

ZFSPlugin's free_image deletes the zvol via SSH after calling our
run_delete_lu. Our earlier addition of freenas_delete_zvol in
run_delete_lu caused a double-delete: SSH would fail, free_image's
error recovery would call run_create_lu on the now-missing zvol,
producing a spurious "Unable to create lun (rolled back)" in the task
log even though the migration had already succeeded.

freenas_delete_zvol remains in run_create_lu's rollback path where it
correctly cleans up zvols orphaned by a failed LUN creation (#239).

Also documents ZFS blocksize requirements for TrueNAS SCALE (16k) vs
CORE (8k) in README configuration and troubleshooting sections (#241).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Kevin Adams 2026-05-20 11:50:12 -04:00
parent 267e14ebfa
commit 6571ab23d1
2 changed files with 36 additions and 4 deletions

View File

@ -165,6 +165,30 @@ After installation, **refresh your browser** to load the updated Proxmox UI. The
> **Security note:** Username/password authentication sends credentials on every API call. API token authentication is preferred and may be required in future TrueNAS releases. > **Security note:** Username/password authentication sends credentials on every API call. API token authentication is preferred and may be required in future TrueNAS releases.
### ZFS Block Size
The **ZFS Blocksize** field controls the `-b` argument passed to `zfs create` when Proxmox provisions a new zvol on TrueNAS. Set this when adding the storage — it cannot be changed afterward without editing the config directly.
| TrueNAS Product | Recommended blocksize |
|:----------------|:----------------------|
| TrueNAS SCALE (any version) | **16k (16384)** |
| TrueNAS CORE | **8k (8192)** |
TrueNAS SCALE ships a newer ZFS that requires a minimum block size of 16k. If you leave this at the Proxmox default of 8k on a SCALE system, every disk creation will log:
```
Warning: volblocksize (8192) is less than the default minimum block size (16384).
To reduce wasted space a volblocksize of 16384 is recommended.
```
The disk is created successfully despite this warning, but the suboptimal block size wastes space due to internal ZFS padding on every write.
**Fixing an existing storage entry:**
Edit `/etc/pve/storage.cfg` on any cluster node and change `blocksize 8192` to `blocksize 16384` for your TrueNAS SCALE storage entry. No data migration is needed — only newly created zvols use the updated value. Existing zvols are unaffected.
> **Note:** Automatic blocksize detection based on TrueNAS version is planned for v2.4.0 (see [#241](https://github.com/TheGrandWazoo/freenas-proxmox/issues/241)).
--- ---
## Upgrading ## Upgrading
@ -203,9 +227,15 @@ Common causes:
- API token expired or revoked - API token expired or revoked
- TrueNAS iSCSI service not running - TrueNAS iSCSI service not running
### "volblocksize is less than the default minimum block size" warning on disk creation
This warning appears on TrueNAS SCALE when the storage is configured with a blocksize below 16k. The disk is created successfully — the warning is cosmetic but indicates suboptimal storage efficiency.
**Fix:** see [ZFS Block Size](#zfs-block-size) in the Configuration section above. Change the blocksize for your SCALE storage entry from 8k to 16k.
### Dangling extents on TrueNAS after a failed operation ### Dangling extents on TrueNAS after a failed operation
If you see iSCSI extents in TrueNAS that are not associated with any target, they can be safely deleted from the TrueNAS UI. The v3.x plugin release adds automatic rollback to prevent this. If you see iSCSI extents in TrueNAS that are not associated with any target, they can be safely deleted from the TrueNAS UI. v2.3.0 and later automatically roll back and clean up after a failed LUN creation.
### Filing a Bug Report ### Filing a Bug Report

View File

@ -332,9 +332,11 @@ sub run_delete_lu {
# Remove the link # Remove the link
my $remove_link = freenas_iscsi_remove_target_to_extent($scfg, $link->{'id'}); my $remove_link = freenas_iscsi_remove_target_to_extent($scfg, $link->{'id'});
# Explicitly delete the underlying zvol — remove:true on extent DELETE is # NOTE: zvol deletion is intentionally left to ZFSPlugin's SSH path (zfs_delete_zvol).
# unreliable on TrueNAS SCALE 24.10+ (#239) # Deleting it here caused a double-delete: SSH would fail, ZFSPlugin's error recovery
freenas_delete_zvol($scfg, $params[0]); # would call run_create_lu on a missing zvol, producing a false "Unable to create lun"
# error in the task log (#240). freenas_delete_zvol belongs only in run_create_lu's
# rollback path (#239).
if($remove_link == 1 && $remove_extent == 1) { if($remove_link == 1 && $remove_extent == 1) {
syslog("info", (caller(0))[3] . "(lun_path=$lun_path) : successful"); syslog("info", (caller(0))[3] . "(lun_path=$lun_path) : successful");