Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c =================================================================== --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c @@ -802,7 +802,9 @@ } /* - * TRIM the whole thing so that we start with a clean slate. + * TRIM the whole thing, excluding the blank space and boot header + * as specified by ZFS On-Disk Specification (section 1.3), so that + * we start with a clean slate. * It's just an optimization, so we don't care if it fails. * Don't TRIM if removing so that we don't interfere with zpool * disaster recovery. @@ -810,7 +812,8 @@ if (zfs_trim_enabled && vdev_trim_on_init && !vd->vdev_notrim && (reason == VDEV_LABEL_CREATE || reason == VDEV_LABEL_SPARE || reason == VDEV_LABEL_L2CACHE)) - zio_wait(zio_trim(NULL, spa, vd, 0, vd->vdev_psize)); + zio_wait(zio_trim(NULL, spa, vd, VDEV_SKIP_SIZE, + vd->vdev_psize - VDEV_SKIP_SIZE)); /* * Initialize its label.