Subject: port-macppc/23925: fsck corrupts APPLE_UFS filesystems
To: None <gnats-bugs@gnats.netbsd.org>
From: Darrin B. Jewell <dbj@netbsd.org>
List: netbsd-bugs
Date: 12/29/2003 00:17:21
>Number: 23925
>Category: port-macppc
>Synopsis: fsck_ffs corrupts APPLE_UFS filesystems
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-macppc-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Dec 29 05:18:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Darrin B. jewell
>Release: -current, updated via cvs ~20031227T2330Z
>Organization:
>Environment:
$ uname -a
Darwin Quiteria 7.2.0 Darwin Kernel Version 7.2.0: Thu Dec 11 16:20:23 PST 2003;
root:xnu/xnu-517.3.7.obj~1/RELEASE_PPC Power Macintosh powerpc
I used a cross compiled fsck for testing, but its from a -current source tree.
(Including minor tweaks for the cross compile.)
>Description:
If you run netbsd's fsck on an Apple UFS filesystem, it will upgrade
the superblock, corrupting it for use by MacOS X.
This problem was introduced with the changes to support ffsv2.
It is related to pr's kern/21404 and kern/21283, which discuss
ffs compatibility issues betweeen netbsd-1-6 and -current.
See also:
kern/17345 "Apple UFS filesystem support, patches included"
cvs revision 1.57 of src/sbin/fsck_ffs/setup.c
kern/21404 "new kernel breaks file system for old kernels"
kern/21283 "current FFS (not v2) incompatible with older NetBSD releases"
I also have related prs pending submission for newfs and the kernel.
>How-To-Repeat:
The following transcript was manually edited for readability.
Script started on Sun Dec 28 21:18:53 2003
$ uname -a
Darwin Quiteria 7.2.0 Darwin Kernel Version 7.2.0: Thu Dec 11 16:20:23 PST 2003;
root:xnu/xnu-517.3.7.obj~1/RELEASE_PPC Power Macintosh powerpc
$ nbfsck_ffs -y -d -f -F nbsd4.osx-10_3_2.ufs.img
** nbsd4.osx-10_3_2.ufs.img
clean = 1
** File system is already clean
isappleufs = 1, dirblksiz = 1024
** Last Mounted on /Volumes/nbsd4ufs
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
SUMMARY INFORMATION BAD
SALVAGE? yes
BLK(S) MISSING IN BIT MAPS
SALVAGE? yes
4 files, 4 used, 1016054 free (6 frags, 254012 blocks, 0.0% fragmentation)
cache missed 199 of 12 (1658%)
***** FILE SYSTEM WAS MODIFIED *****
$ fsck -y -d -f nbsd4.osx-10_3_2.ufs.img
nbsd4.osx-10_3_2.ufs.img is not a character device
CONTINUE? yes
** nbsd4.osx-10_3_2.ufs.img
superblock mismatches
offset 215, original 4096, alternate 65535
offset 253, original 3, alternate 0
offset 255, original 254012, alternate 0
offset 257, original 253754, alternate 0
offset 259, original 6, alternate 0
offset 269, original 1072664356, alternate 0
offset 271, original 1048576, alternate 0
offset 273, original 1016058, alternate 0
offset 275, original 516, alternate 0
BAD SUPER BLOCK: VALUES IN SUPER BLOCK DISAGREE WITH THOSE IN FIRST ALTERNATE
ioctl (GCINFO): Inappropriate ioctl for device
fsck: nbsd4.osx-10_3_2.ufs.img: can't read disk label
$ fsck -b 32 -y -d -f nbsd4.osx-10_3_2.ufs.img
Alternate super block location: 32
nbsd4.osx-10_3_2.ufs.img is not a character device
CONTINUE? yes
** nbsd4.osx-10_3_2.ufs.img
** Last Mounted on
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
BLK(S) MISSING IN BIT MAPS
SALVAGE? yes
SUMMARY INFORMATION BAD
SALVAGE? yes
FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE? yes
4 files, 4 used, 1016054 free (6 frags, 254012 blocks, 0.0% fragmentation)
UPDATE STANDARD SUPERBLOCK? yes
cache missed 68 of 12 (566%)
***** FILE SYSTEM WAS MODIFIED *****
$ fsck -y -d -f nbsd4.osx-10_3_2.ufs.img
nbsd4.osx-10_3_2.ufs.img is not a character device
CONTINUE? yes
** nbsd4.osx-10_3_2.ufs.img
** Last Mounted on
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
4 files, 4 used, 1016054 free (6 frags, 254012 blocks, 0.0% fragmentation)
cache missed 69 of 12 (575%)
$ exit
Script done on Sun Dec 28 21:20:24 2003
>Fix:
Immediate workaround is to manually run MacOS X fsck with -b 32.
I am working on fix that doesn't incompatibly upgrade the superblock.
>Release-Note:
>Audit-Trail:
>Unformatted: