NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/60938: makefs -o version=2 makes UFS2ea, unlike newfs -O 2
>Number: 60938
>Category: bin
>Synopsis: makefs -o version=2 makes UFS2ea, unlike newfs -O 2
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Oct 29 17:20:00 +0000 2026
>Originator: Showta Ishizaki
>Release: NetBSD 11.0 and -current (11.99.9)
>Organization:
>Environment:
System: NetBSD 11.0 amd64
Architecture: x86_64
Machine: amd64
>Description:
I noticed this while booting a -current kernel from 2021 on a disk
image made with makefs -t ffs -o version=2: the kernel refused the root
file system with EFTYPE. The image had magic 0x19012038, UFS2ea, and
not plain UFS2.
Since the UFS2ea split of 2022-11-17, newfs -O 2 makes plain UFS2 and
UFS2ea needs -O 2ea. makefs got an extattr option in the same commit,
but its default is 1, so -o version=2 alone gives UFS2ea. makefs(8)
lists the option without saying what the default is.
The 11.0 release images are made this way too.
distrib/amd64/installimage and liveimage set IMGFFSVERSION=2 and pass no
extattr, and the root partitions of NetBSD-11.0-amd64-install.img and
NetBSD-11.0-amd64-live.img both carry magic 0x19012038. They boot fine,
since the 11.0 boot loader knows UFS2ea, but a kernel from before the
split cannot mount them (the 2021 one above gave EFTYPE). alpha's
emuimage and the wii image use version 2 as well.
>How-To-Repeat:
$ mkdir root && echo hello > root/f
$ makefs -t ffs -s 8m -o version=2 a.img root
$ od -A n -t x4 -j 9564 -N 4 a.img
19012038
With -o version=2,extattr=0 the same command gives 19540119.
>Fix:
Make the default 0, so that makefs and newfs agree, and say so in the
manual. -o extattr=1 still gives UFS2ea for anyone who wants it.
I built makefs from -current (ac67e1168) on NetBSD 11.0/amd64 with and
without the diff. With it, -o version=2 gives 19540119; extattr=0,
extattr=1 and version=1 give the same magic as before. fsck_ffs -fn
from 11.0 is clean on every image. The makefs steps of
tests/sbin/fsck_ffs/t_check_quotas.sh, the one test that runs makefs -o
version=2, give the expected quota messages with the new makefs. I did
not mount the images (no root on that machine).
Diff against -current of 2026-10-30:
--- usr.sbin/makefs/ffs.c
+++ usr.sbin/makefs/ffs.c
@@ -205,7 +205,7 @@ ffs_prep_opts(fsinfo_t *fsopts)
ffs_opts->avgfilesize= -1;
ffs_opts->avgfpdir= -1;
ffs_opts->version = 1;
- ffs_opts->extattr = 1;
+ ffs_opts->extattr = 0; /* plain UFS2, as newfs -O 2 */
fsopts->fs_specific = ffs_opts;
fsopts->fs_options = copy_opts(ffs_options);
--- usr.sbin/makefs/makefs.8
+++ usr.sbin/makefs/makefs.8
@@ -374,7 +374,7 @@ Range: 1..2147483647.
.It Cm extattr= Ns Ar num , Cm e= Ns Ar num
UFS2 with extended attributes.
One of:
-0 to disable, or
+0 to disable (default), or
1 to enable.
.It Cm extent= Ns Ar num , Cm x= Ns Ar num
Maximum extent size.
Home |
Main Index |
Thread Index |
Old Index