Subject: Re: This is gonna be a FAQ: FFS types
To: NetBSD/macppc list <port-macppc@netbsd.org>
From: John Valdes <valdes@uchicago.edu>
List: port-macppc
Date: 07/11/2001 21:46:59
On Wed, Jul 11, 2001 at 10:12:01AM -0700, Henry B. Hotz wrote:
> I notice that if I newfs a partition under MacOS X I can mount it in 
> the install kernel of NetBSD.  I can't do the converse:  OSX fsck 
> complains about something with the directories being 1024 instead of 
> 512.

Playing with filesystems on a Zip disk, I found the same results as
you did.  However, even though NetBSD (1.5 release kernel btw) could
mount the OS X ufs filesystem, there were errors when I tried ls'ing
various directories.  The OS X manpage for mounts lists a mount_ffs
command under the SEE ALSO section, but there doesn't appear to be
such a mount command under /sbin (where the others reside).  Don't
know if such a command were available whether it'd be possible to
mount NetBSD partitions under OS X (OS X's kernel would still need
driver support of NetBSD ffs).

> Could someone comment on what the differences are

From what I could find in the Darwin archives on www.darwinfo.org, the
OS X ufs is the same as the OpenStep ufs (gee, what a surprise :) ).
Accordingly, I can mount an OS X ufs filesystem (read only) under
LinuxPPC using "mount -r -t ufs -o ufstype=openstep /dev/..." and read
it w/o problems.  LinuxPPC can similarly mount NetBSD ffs using "mount
-t ufs -o ufstype=44bsd /dev/..." and read/write it w/o problems.

In the Linux ufs driver, I only see these differences between the two:

  switch ( ... ) {

  case UFS_MOUNT_UFSTYPE_44BSD:
      UFSD(("ufstype=44bsd\n"))
      uspi->s_fsize = block_size = 512;
      uspi->s_fmask = ~(512 - 1);
      uspi->s_fshift = 9;
      uspi->s_sbsize = super_block_size = 1536;
      uspi->s_sbbase = 0;
      flags |= UFS_DE_44BSD | UFS_UID_44BSD | UFS_ST_44BSD | UFS_CG_44BSD;
      break;

  case UFS_MOUNT_UFSTYPE_OPENSTEP:
      UFSD(("ufstype=openstep\n"))
      uspi->s_fsize = block_size = 1024;
      uspi->s_fmask = ~(1024 - 1);
      uspi->s_fshift = 10;
      uspi->s_sbsize = super_block_size = 2048;
      uspi->s_sbbase = 0;
      flags |= UFS_DE_44BSD | UFS_UID_44BSD | UFS_ST_44BSD | UFS_CG_44BSD;
      break;

(plus for OpenStep, a loop which seems to search for uspi->s_sbbase
(superblock base??) in increments of 8 up to 256).  So the main
differences appear to be that the fs blocksize in NetBSD is 512
vs. 1024 in OS X (openstep), and the size of the superblock.

John