vmWare ZFS and Trim

Dean E. Weimer dweimer at dweimer.net
Wed Apr 21 15:37:50 UTC 2021

Does anybody have trim working correctly with ZFS on vmWare? I decided 
to try working on it again after switching a system to ParaVirtual SCSI 
and EFI boot during my 12.2 - 13.0 upgrade. The system is on ESXi 6.7 
with vmfs6 file system and thin provisioned disks. vmWare's backend 
storage is an iSCSI conenction to a Nimble array (with encryption if 
that matters).

Disk information from dmesg shows unmap support:
a2 at pvscsi0 bus 0 scbus32 target 2 lun 0
da2: <VMware Virtual disk 2.0> Fixed Direct Access SPC-4 SCSI device
da2: 750.000MB/s transfers
da2: Command Queueing enabled
da2: 8192MB (16777216 512 byte sectors)
da2: quirks=0x140<RETRY_BUSY,STRICT_UNMAP>

Disk Information output shows trim/unmap support.
# diskinfo -v da2
         512             # sectorsize
         8589934592      # mediasize in bytes (8.0G)
         16777216        # mediasize in sectors
         1048576         # stripesize
         0               # stripeoffset
         1044            # Cylinders according to firmware.
         255             # Heads according to firmware.
         63              # Sectors according to firmware.
         VMware Virtual disk     # Disk descr.
                         # Disk ident.
         pvscsi0         # Attachment
         Yes             # TRIM/UNMAP support
         0               # Rotation rate in RPM
         Not_Zoned       # Zone Mode

But issuing a trim command still causes errors.
(da2:pvscsi0:0:2:0): UNMAP failed, disabling BIO_DELETE
(da2:pvscsi0:0:2:0): UNMAP. CDB: 42 00 00 00 00 00 00 00 08 00
(da2:pvscsi0:0:2:0): CAM status: SCSI Status Error
(da2:pvscsi0:0:2:0): SCSI status: Check Condition
(da2:pvscsi0:0:2:0): SCSI sense: ILLEGAL REQUEST asc:24,0 (Invalid field 
in CDB)
(da2:pvscsi0:0:2:0): Command byte 7 is invalid
(da2:pvscsi0:0:2:0): Error 22, Unretryable error

During my searching I kept finding old information from vmfs5 and making 
sure to set some advanced options for UNMAP, however non of that is 
supposed to be necessary on current versions of ESX with vmfs6. Does 
anyone have any insight to what I missed? or if it just still doesn't 

    Dean E. Weimer

More information about the freebsd-questions mailing list