HomeFreeBSD

fstyp: search for file system headers with the largest offset first

Description

fstyp: search for file system headers with the largest offset first

fstyp can misidentify a UFS file system as MS-DOS if the device was
repurposed from MS-DOS to UFS via newfs.

This happens for the following reasons:

  • the header for MS-DOS begins at offset 0
  • the superblock for UFS begins at offset 64k, 8k, 0k, or 256k
  • newfs does not clear the area in front of UFS's superblock, leaving the MS-DOS header intact.
  • fstyp searches for file system headers alphabetically

To avoid this misidentification, have fstyp search for file system
headers with the largest offset first instead of alphabetically.

The implemented fix was suggested by reporter, Richard M. Kreuter.

PR: 252787
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D47855

Details

Provenance
rewAuthored on Dec 4 2024, 7:19 AM
Reviewer
imp
Differential Revision
D47855: fstyp: search for file systems labels by largest offset first
Parents
rGd6ed5ff4ac7d: git-arc: fix diff2reviewers() with multiple reviewers
Branches
Unknown
Tags
Unknown