From nobody Sat Aug 29 20:57:41 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hXSJB6r40z6r6HF for ; Sat, 29 Aug 2026 20:57:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hXSJB5m6xz45Yb for ; Sat, 29 Aug 2026 20:57:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788037066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=btO53fn+loGzUjs/z5pvCPzh0f+tzCsEBNcqG9B9chg=; b=SNRPWfsHFzxsh5TMzKdLs0KbqoocQyZhzS4Oe0Bxr+onWWKoYTAh8RFBFMGOUe9QSnYM6F qZ8hrjBz8JbU0zKdpLEaz9//N4R+FPjiUNDehxrKul86hnK/273w85n02Q6sFh6ZzZNERm Uy1etpl0smeBCO7De5HQnZ+QangrVgReRCCKAVwVTc2O7JaYv9lZju/oAvmpKwkatdY5X9 A/346QET69qbOYZJNB4DG5r3WMsP+N0GltaDeeQH2FHtVGxXTqh2zt+LFJcUyf+NO+ovNU Z0DZuswLw6hOZ1VcCnYA5ij83GDK6hiZhmSpDUSnZlE8DIGm6DKnxp18P/uZ4A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1788037066; a=rsa-sha256; cv=none; b=EFCXl41BCu4IdRLUk3VpvZXFpzTk3kFi0gRifqoQ+45Va3FXOrOoxQPxyi2UzocKd4B3zS MzqHbBSLP9kyewU5LKiX6LA9wZggLmMfvwAb0RBcp88h0n6KAJlUcPinHtMSs5SFxSbR7f 24tv1uojBNMtfczvEUUqtgiSGg2Hw+CYQvYvpsCurfyneixkiRi1ZAHx/qi7u0Ic7U0yez d1DmNYPceOPiKzvW1g8tgNemViBSZxFUxw5D+sEOx0lWwcyyGYOUawJhbevh4jyldbuxAM CgdgMnzdi8qRXfScG1WWExTcAgxiC8kXhyizE1GgSBhAwfAH6GgIq3cEjiSZlQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788037066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=btO53fn+loGzUjs/z5pvCPzh0f+tzCsEBNcqG9B9chg=; b=mVxFKH17zuwWzU/UbJ2Oq/TLI6vVsfnq5FEbTEEPsur2c2hGxUOHAVYBZf6PAnMjG1JE05 rY80ItPwugre/MNnJJsy1GwXj521iBxygjvmQyxznYvE1ORolNhGCrloyzVeUlz6/Wkw2L DGt7ieOy12QXUKV6yd4BRND8xHpXWXNH9ofc5CKCV4H79cp+BngctFv+kzRHPQUMuh68kX gU8UZwpfL0b57MGHqHgd9IR04PTPetwJrs2G/Zi5PGpNHX8DVCbj4w50AsUsAj+ZgXZFto gniEy99w6up6a5UN2D9uvk4ZuYBti/q1OBmuy6heNkZjNB8ALJ+qLbcds1gmyA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hXSJB4NJTzvv7 for ; Sat, 29 Aug 2026 20:57:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 18886 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 29 Aug 2026 20:57:41 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jose Luis Duran Subject: git: 019d13dafed6 - stable/15 - makefs: zfs: Allow the path vdev property to be set List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 019d13dafed63bb923866b8e0be12163cecde3e6 Auto-Submitted: auto-generated Date: Sat, 29 Aug 2026 20:57:41 +0000 Message-Id: <6a9347c5.18886.55b94553@gitrepo.freebsd.org> The branch stable/15 has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=019d13dafed63bb923866b8e0be12163cecde3e6 commit 019d13dafed63bb923866b8e0be12163cecde3e6 Author: Jose Luis Duran AuthorDate: 2026-08-21 19:02:04 +0000 Commit: Jose Luis Duran CommitDate: 2026-08-29 20:56:56 +0000 makefs: zfs: Allow the path vdev property to be set This allows specifying custom vdev paths (such as GPT labels like /dev/gpt/...) when creating ZFS filesystem images via makefs(8), rather than defaulting to /dev/null. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D59031 (cherry picked from commit 5fece2484324be52737e4cea86658a4b8d3107fc) --- usr.sbin/makefs/makefs.8 | 38 ++++++++++++++------------ usr.sbin/makefs/tests/makefs_zfs_tests.sh | 45 +++++++++++++++++++++++++++++++ usr.sbin/makefs/zfs.c | 10 ++++++- usr.sbin/makefs/zfs/zfs.h | 1 + 4 files changed, 76 insertions(+), 18 deletions(-) diff --git a/usr.sbin/makefs/makefs.8 b/usr.sbin/makefs/makefs.8 index f77e07902ad2..56e2ffda956f 100644 --- a/usr.sbin/makefs/makefs.8 +++ b/usr.sbin/makefs/makefs.8 @@ -33,7 +33,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 5, 2026 +.Dd August 12, 2026 .Dt MAKEFS 8 .Os .Sh NAME @@ -452,7 +452,7 @@ The following keywords are supported (see .Xr newfs_msdos 8 for more details): .Pp -.Bl -tag -width omit-trailing-period -offset indent -compact +.Bl -tag -width sectors_per_cluster -offset indent -compact .It Cm backup_sector Location of the backup boot sector. .It Cm block_size @@ -531,36 +531,40 @@ The arguments consist of a keyword, an equal sign and a value. The following keywords are supported: .Pp -.Bl -tag -width omit-trailing-period -offset indent -compact -.It ashift +.Bl -tag -width verify-txgs -offset indent -compact +.It Cm ashift The base-2 logarithm of the minimum block size. Typical values are 9 (512B blocks) and 12 (4KB blocks). The default value is 12. -.It bootfs +.It Cm bootfs The name of the bootable dataset for the pool. Specifying this option causes the .Ql bootfs property to be set in the created pool. -.It mssize +.It Cm mssize The size of metaslabs in the created pool. By default, .Nm allocates large (up to 512MB) metaslabs with the expectation that the image will be auto-expanded upon first use. This option allows the default heuristic to be overridden. -.It verify-txgs +.It Cm path +The path to the device for this vdev. +The default is +.Pa /dev/null . +.It Cm verify-txgs Prompt OpenZFS to verify pool metadata during import. This is disabled by default as it may significantly increase import times. -.It poolguid +.It Cm poolguid Use the specified 64-bit integer as the pool GUID. If this option is not specified, the pool GUID will be random but fixed across multiple identical invocations of .Nm . This option is useful for testing but not required for reproducibility. -.It poolname +.It Cm poolname The name of the ZFS pool. This option must be specified. -.It rootpath +.It Cm rootpath An implicit path prefix added to dataset mountpoints. By default it is .Pa / . @@ -570,7 +574,7 @@ should be set to .Pa / . At least one dataset must have a mountpoint equal to .Va rootpath . -.It fs +.It Cm fs Create an additional dataset. This option may be specified multiple times. The argument value must be of the form @@ -600,12 +604,12 @@ may be specified following the dataset name. The following properties may be set for a dataset: .Pp .Bl -hang -compact -offset indent -.It atime -.It canmount -.It compression -.It exec -.It mountpoint -.It setuid +.It Cm atime +.It Cm canmount +.It Cm compression +.It Cm exec +.It Cm mountpoint +.It Cm setuid .El Note that .Nm diff --git a/usr.sbin/makefs/tests/makefs_zfs_tests.sh b/usr.sbin/makefs/tests/makefs_zfs_tests.sh index 5b6c701ca291..22adfda00d2b 100644 --- a/usr.sbin/makefs/tests/makefs_zfs_tests.sh +++ b/usr.sbin/makefs/tests/makefs_zfs_tests.sh @@ -947,6 +947,50 @@ used_space_props_cleanup() common_cleanup } +# +# Test setting the path of the vdev. +# +# The pool is associated to /dev/md0 by default, i.e., when no path is specified. +# When the path vdevprops(7) is specified, verify it gets set. +# +atf_test_case path_vdev_props cleanup +path_vdev_props_body() +{ + local md zdb_path + local vdev_path="/dev/gpt/testdisk" + + create_test_inputs + + atf_check $MAKEFS -s 1g -o rootpath=/ \ + -o poolname=$ZFS_POOL_NAME \ + -o path=${vdev_path} \ + $TEST_IMAGE $TEST_INPUTS_DIR + + # Check the raw path property before import_image. + atf_check -o save:$TEST_MD_DEVICE_FILE mdconfig -a -f $TEST_IMAGE + zdb_path=$(zdb -C -e -p /dev/$(cat $TEST_MD_DEVICE_FILE) \ + $ZFS_POOL_NAME 2>/dev/null | awk -F"'" '/path:/ {print $2; exit}') + atf_check -o inline:"${vdev_path}\n" echo "$zdb_path" + + # Cleanup before import_image. + if [ -f "$TEST_MD_DEVICE_FILE" ]; then + md=$(cat $TEST_MD_DEVICE_FILE) + if [ -c /dev/"$md" ]; then + mdconfig -o force -d -u "$md" + fi + fi + + # Once imported, the path will be /dev/$(cat $TEST_MD_DEVICE_FILE), + # as /dev/gpt/testdisk does not really exist. + import_image + + check_image_contents +} +path_vdev_props_cleanup() +{ + common_cleanup +} + # Verify that file permissions are set properly. Make sure that non-executable # files can't be executed. atf_test_case perms cleanup @@ -1089,6 +1133,7 @@ atf_init_test_cases() atf_add_test_case soft_links atf_add_test_case root_props atf_add_test_case used_space_props + atf_add_test_case path_vdev_props atf_add_test_case perms atf_add_test_case T_flag_dir atf_add_test_case T_flag_F_flag diff --git a/usr.sbin/makefs/zfs.c b/usr.sbin/makefs/zfs.c index e33a182e5c8f..1288c52141ab 100644 --- a/usr.sbin/makefs/zfs.c +++ b/usr.sbin/makefs/zfs.c @@ -86,6 +86,8 @@ zfs_prep_opts(fsinfo_t *fsopts) 0, 0, "Bootable dataset" }, { '\0', "mssize", &zfs->mssize, OPT_INT64, MINMSSIZE, MAXMSSIZE, "Metaslab size" }, + { '\0', "path", &zfs->vdevpath, OPT_STRPTR, + 0, 0, "The path to the device for this vdev" }, { '\0', "poolguid", &zfs->poolguid, OPT_INT64, 0, INT64_MAX, "ZFS pool GUID" }, { '\0', "poolname", &zfs->poolname, OPT_STRPTR, @@ -240,6 +242,11 @@ zfs_check_opts(fsinfo_t *fsopts) if (zfs->rootpath[0] != '/') errx(1, "mountpoint `%s' must be absolute", zfs->rootpath); + if (zfs->vdevpath == NULL) + easprintf(&zfs->vdevpath, "/dev/null"); + if (zfs->vdevpath[0] != '/') + errx(1, "path `%s' must be absolute", zfs->vdevpath); + if (zfs->ashift == 0) zfs->ashift = 12; @@ -254,6 +261,7 @@ zfs_cleanup_opts(fsinfo_t *fsopts) zfs = fsopts->fs_specific; free(zfs->rootpath); + free(zfs->vdevpath); free(zfs->bootfs); free(__DECONST(void *, zfs->poolname)); STAILQ_FOREACH_SAFE(d, &zfs->datasetdescs, next, tmp) { @@ -330,7 +338,7 @@ pool_disk_vdev_config_nvcreate(zfs_opt_t *zfs) nvlist_add_uint64(diskvdevnv, ZPOOL_CONFIG_ASIZE, zfs->asize); nvlist_add_uint64(diskvdevnv, ZPOOL_CONFIG_GUID, zfs->vdevguid); nvlist_add_uint64(diskvdevnv, ZPOOL_CONFIG_ID, 0); - nvlist_add_string(diskvdevnv, ZPOOL_CONFIG_PATH, "/dev/null"); + nvlist_add_string(diskvdevnv, ZPOOL_CONFIG_PATH, zfs->vdevpath); nvlist_add_uint64(diskvdevnv, ZPOOL_CONFIG_WHOLE_DISK, 1); nvlist_add_uint64(diskvdevnv, ZPOOL_CONFIG_CREATE_TXG, TXG); nvlist_add_uint64(diskvdevnv, ZPOOL_CONFIG_METASLAB_ARRAY, diff --git a/usr.sbin/makefs/zfs/zfs.h b/usr.sbin/makefs/zfs/zfs.h index 33694e2bdbee..13f2ece43c69 100644 --- a/usr.sbin/makefs/zfs/zfs.h +++ b/usr.sbin/makefs/zfs/zfs.h @@ -79,6 +79,7 @@ typedef struct { /* Pool parameters. */ const char *poolname; char *rootpath; /* implicit mount point prefix */ + char *vdevpath; /* vdev path, pool property */ char *bootfs; /* bootable dataset, pool property */ int ashift; /* vdev block size */ uint64_t mssize; /* metaslab size */