Bug 276571 - makefs(8) creates broken UFS images with sectorsize option (-S)
Summary: makefs(8) creates broken UFS images with sectorsize option (-S)
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 14.0-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-23 20:55 UTC by Stefan Schlosser
Modified: 2024-03-22 19:04 UTC (History)
1 user (show)

See Also:
linimon: mfc-stable14?
linimon: mfc-stable13?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Schlosser 2024-01-23 20:55:05 UTC
# freebsd-version
14.0-RELEASE-p4

# makefs -S4096 rescue.img /rescue
Calculated size of `rescue.img': 20054016 bytes, 5 inodes
Extent size set to 32768
rescue.img: 19.1MB (4896 sectors) block size 32768, fragment size 4096
	using 1 cylinder groups of 19.12MB, 612 blks, 256 inodes.
super-block backups (for fsck -b #) at:
 8
Populating `rescue.img'
Image `rescue.img' complete

# mdconfig rescue.img
md0

# mount /dev/md0 /mnt
mount: /dev/md0: Invalid fstype: Invalid argument

# fsck md0
UFS1 superblock failed: fs->fs_old_nspf (1) != fs->fs_fsize / sectorsize (8)
UFS1 superblock failed: fs->fs_fsbtodb (0) != ILOG2(fs->fs_fsize / sectorsize) (3)
Attempted recovery for standard superblock: failed
Attempted extraction of recovery data from standard superblock: failed
Attempt to find boot zone recovery data.
Finding an alternate superblock failed.
Check for only non-critical errors in standard superblock
UFS1 superblock failed: fs->fs_old_nspf (1) != fs->fs_fsize / sectorsize (8) (Ignored)
UFS1 superblock failed: fs->fs_old_spc (4896) != fs->fs_fpg * fs->fs_old_nspf (39168) (Ignored)
UFS1 superblock failed: fs->fs_old_nsect (4896) != fs->fs_old_spc (39168) (Ignored)
UFS1 superblock failed: fs->fs_old_npsect (4896) != fs->fs_old_spc (39168) (Ignored)
UFS1 superblock failed: fs->fs_fsbtodb (0) != ILOG2(fs->fs_fsize / sectorsize) (3)
Failed, superblock has critical errors
SEARCH FOR ALTERNATE SUPER-BLOCK FAILED. YOU MUST USE THE
-b OPTION TO FSCK TO SPECIFY THE LOCATION OF AN ALTERNATE
SUPER-BLOCK TO SUPPLY NEEDED INFORMATION; SEE fsck_ffs(8).
Comment 1 Warner Losh freebsd_committer freebsd_triage 2024-01-26 20:01:58 UTC
I'd think that you'd need to mdconfig -S4096 as well, but even with that I get the same kinds of errors.
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-01-26 22:29:45 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=176b9e0d724b4c1a24d2c46a1256381784f04edc

commit 176b9e0d724b4c1a24d2c46a1256381784f04edc
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-01-25 01:47:36 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-01-26 22:27:57 +0000

    makefs: warn that ffs sectorsize other than 512 may not work

    newfs always sets sectorsize to DEV_BSIZE (512) and derives some other
    values based on the number of 512-byte sectors per real sector.  Similar
    logic is required in makefs.  Until that happens, emit a warning that
    the image may be incorrect.

    PR:             276571

 usr.sbin/makefs/ffs.c | 3 +++
 1 file changed, 3 insertions(+)
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2024-02-08 02:56:28 UTC
^Triage: assign to committer.
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-03-22 18:44:06 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=8e402178193f7b273a956b864d8d8b288ce62ee7

commit 8e402178193f7b273a956b864d8d8b288ce62ee7
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-01-25 01:47:36 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-03-22 18:42:59 +0000

    makefs: warn that ffs sectorsize other than 512 may not work

    newfs always sets sectorsize to DEV_BSIZE (512) and derives some other
    values based on the number of 512-byte sectors per real sector.  Similar
    logic is required in makefs.  Until that happens, emit a warning that
    the image may be incorrect.

    PR:             276571
    (cherry picked from commit 176b9e0d724b4c1a24d2c46a1256381784f04edc)

 usr.sbin/makefs/ffs.c | 3 +++
 1 file changed, 3 insertions(+)
Comment 5 Ed Maste freebsd_committer freebsd_triage 2024-03-22 19:02:58 UTC
Unassign: I added a warning that the result may be nonfunctional, but am not currently working on fixing the actual issue
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-03-22 19:04:12 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=0459337491cdfdd752507c0d2722999a6a9781ef

commit 0459337491cdfdd752507c0d2722999a6a9781ef
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-01-25 01:47:36 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-03-22 19:03:48 +0000

    makefs: warn that ffs sectorsize other than 512 may not work

    newfs always sets sectorsize to DEV_BSIZE (512) and derives some other
    values based on the number of 512-byte sectors per real sector.  Similar
    logic is required in makefs.  Until that happens, emit a warning that
    the image may be incorrect.

    PR:             276571
    (cherry picked from commit 176b9e0d724b4c1a24d2c46a1256381784f04edc)
    (cherry picked from commit 8e402178193f7b273a956b864d8d8b288ce62ee7)

 usr.sbin/makefs/ffs.c | 3 +++
 1 file changed, 3 insertions(+)