Subject: port-macppc/23924: newfs -v creates bad 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:18
>Number:         23924
>Category:       port-macppc
>Synopsis:       newfs -v creates bad APPLE_UFS filesystems
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-macppc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 29 05:18:00 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 newfs for testing, but its from a -current source tree.
(Including minor tweaks for the cross compile.)

>Description:

If you use netbsd's newfs to create an Apple UFS filesystem,
it is incompatible with 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"

  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 fsck and the kernel.

>How-To-Repeat:

The following transcript was manually edited for readability.

Script started on Sun Dec 28 23:06:07 2003

$ nbnewfs -v foo -s 1G -F foo
    foo: 1024.0MB (2097152 sectors) block size 4096, fragment size 1024
            using 51 cylinder groups of 20.08MB, 5141 blks, 4960 inodes.
    super-block backups (for fsck -b #) at:
          32,   41160,   82288,  123416,  164544,  205672,  246800,  287928,
      329056,  370184,  411312,  452440,  493568,  534696,  575824,  616952,
      658080,  699208,  740336,  781464,  822592,  863720,  904848,  945976,
      987104, 1028232, 1069360, 1110488, 1151616, 1192744, 1233872, 1275000,
     1316128, 1357256, 1398384, 1439512, 1480640, 1521768, 1562896, 1604024,
     1645152, 1686280, 1727408, 1768536, 1809664, 1850792, 1891920, 1933048,
     1974176, 2015304, 2056432,

$ fsck -n -f foo
    foo is not a character device
    CONTINUE? yes
    
    ** foo (NO WRITE)
    BAD SUPER BLOCK: VALUES IN SUPER BLOCK DISAGREE WITH THOSE IN FIRST ALTERNATE
    ioctl (GCINFO): Inappropriate ioctl for device
    fsck: foo: can't read disk label

$ fsck -b 32 -n -f foo
    Alternate super block location: 32
    foo is not a character device
    CONTINUE? yes
    
    ** foo (NO WRITE)
    ** 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
    SUMMARY INFORMATION BAD
    SALVAGE? no
    
    FREE BLK COUNT(S) WRONG IN SUPERBLK
    SALVAGE? no
    
    1 files, 1 used, 1016327 free (3 frags, 254081 blocks, 0.0% fragmentation)

$ fsck -b 32 -y -f foo
    Alternate super block location: 32
    foo is not a character device
    CONTINUE? yes
    
    ** foo
    ** 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
    SUMMARY INFORMATION BAD
    SALVAGE? yes
    
    FREE BLK COUNT(S) WRONG IN SUPERBLK
    SALVAGE? yes
    
    1 files, 1 used, 1016326 free (6 frags, 254080 blocks, 0.0% fragmentation)
    
    UPDATE STANDARD SUPERBLOCK? yes
    
    
    ***** FILE SYSTEM WAS MODIFIED *****

$ fsck -n -f foo
    foo is not a character device
    CONTINUE? yes
    
    ** foo (NO WRITE)
    ** 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
    1 files, 1 used, 1016326 free (6 frags, 254080 blocks, 0.0% fragmentation)

$ exit
    
Script done on Sun Dec 28 23:07:42 2003


>Fix:

Immediate workaround is to create apple ufs filesystems on osX.
I am working on fix that creates filesystems with a compatible
superblock.
>Release-Note:
>Audit-Trail:
>Unformatted: