cross mounting fs between SysV and BSD

cross mounting fs between SysV and BSD

Post by Allen M Theoba » Sun, 06 Feb 1994 05:07:10

I can't believe i'm the only person who wants to do this!  Am I in the
wrong group?


Quote:> I did a "newfs /dev/rfd0a floppy" on my SUN workstation to create a fs
> on my 3.5 HDD floppy.  I mounted this fs successfully, and copied
> to/from it ok.  When I take the floppy home to use on my FreeBSD and
> try to mount, I get the following error:
>    mount failed : bogus super-block.
> This is no verbatim, but close enough.  This is the advice I got from
> a co-worker:
> "Your problem with the newfs command is probably from an item in the
> superblock called the "magic number".  The superblocks have undergone
> so many format changes from vendor to vendor that not all superblocks
> can be read by a particular OS.  To prevent corruption from an
> "incorrectly" formatted superblock from another vendor, most vendors
> come up with a "unique" magic number for their superblock.  You can
> think of the "magic number" as a serial number.  If the serial number
> doesn't match, then we can't read this format.
> This is only a guess, but your simptoms match my experience.  I was
> not suprised you would have problems doing this.  You may be able to
> write a superblock conversion routine though.  The header file for
> describing a superblock is contained in the /usr/include
> subdirectories.  If the required data is compatible you could simply
> translate the Sun superblock format to a BSD superblock format and
> overwrite the Sun superblock.  Then the disk could be mountable on a
> BSD system.  (Some times all this translation requires is to change
> the magic number.)"
> The question is... how do I mount a SUN newfs'd file system on a BSD
> box (and vice versa)?
>            Thanks,
>            Allen


cross mounting fs between SysV and BSD

Post by Terry Lambe » Sun, 06 Feb 1994 22:10:34

[ ... try to mount a Sun mkfs'ed disk on a FreeBSD box ... ]

Quote:>   mount failed : bogus super-block.

>This is no verbatim, but close enough.  This is the advice I got from
>a co-worker:

[ ... possibly correct, but certainly irrelevant advice from coworker ... ]

Quote:>The question is... how do I mount a SUN newfs'd file system on a BSD
>box (and vice versa)?

You don't unless it's a Sun 386i, and here's why:  Byte order.  This
is also why your coworkes advice is irrelevant; there may indeed be
differences in layout policy between the machines (what I saw when I
looked was trivial "clean bit" and other fs struct differences), but
the magic number is still the right birthday on both systems (whose
birthday is left as an exercise for the reader).

But the byte order is different, so datum written as more than single
byte units (ie: inode numbers and file system type identifiers, etc.)
don't have the same values.

As an exercise to prove I'm not lying, write a program to fill out a
struct containing one of every type of object to a file as a unit,
and then ftp (or tar) the file over to the other machine and read it

something like:

struct foo {
        long    l;
        char    c;
        short   s;
        int     i;      /* happen to konw it's 32 bits*/


struct foo writeme = {


struct foo readme;

        int fd;

#ifdef READIT
        fd = open( "my_foo, 0, 0);

        read( fd, readme, sizeof(readme));
        printf( "long    %x\n", readme.l);
        printf( "char    %x\n", readme.c);
        printf( "short   %x\n", readme.s);
        printf( "int     %x\n", readme.i);
        fd = open( "my_foo", 2, 0666);

        write( fd, writeme, sizeof(writeme));


If you are real lucky and use a screwy compiler, the structure packing will
not be the same, and you will even get different file sizes on each machine;
but if not, it will be obvious when you "cc -DREADIT ..." on one machine
and run it on the data produced by the "cc ..." on the other machine, that
you don't have the same byte order.

Basically, you'd have to put byte order adjustemnets into the FS source
on one machine and compile it up on the other and link it into the kernel
to mount one systems disk on the other system.  This is non-trivial,
mostly because the underlying kernel structure that the FS on each machine
depends on is very different, and it simply won't compile wtihout a lot
of work and a lot of knowledge.

You should either use tar or another archiver, or use the DOS FS on both
machines instead (the Sun pcfs type has the byte order adjustments in it

                                        Terry Lambert

Any opinions in this posting are my own and not those of my present
or previous employers.


1. Can BSD fs be mounted on Solaris?

I have a SyJet on my DECstation 3100 at home, and one on my SPARC-20
at work.  (That's ULTRIX V4.4 and Solaris 2.4, respectively).

I have been trying to mount disks with the BSD (ULTRIX) filesystem on my
SPARC-20, and not yet been successful.

It totally ignored the disk/drive until we wrote a Solaris label (I don't
know if ULTRIX will mount it now).  But, Solaris still won't mount the

Does anyone have any suggestions on how to get this to work?

I have not yet tried mounting a Solaris filesystem on my ULTRIX machine.
But, I suspect that has even less chance of working.

Thanks  /  Ray

Chapel Hill NC, or Sutton Mills NH. |    The corner stones of coexistence.

2. ROM-able support

3. Mount Problems (RH7.0) Mounting an "old" SYSV/Xinit Disk!

4. help talking to NNTP server

5. external modem

6. Kyocera FS 1600 or FS 1600+ Printer drivers ( FS-1600 FS-1600+)

7. X programming newbie qustion

8. What's the difference between SYSV and BSD?

9. help remote print to bsd from sysV

10. dump (BSD) for SYSV?

11. SYSV / BSD file systems

12. Main differences between BSD and SysV?