moving disks between archs

Scott Long scottl at samsco.org
Fri Feb 10 23:26:57 PST 2006


James Tanis wrote:
> On 2/10/06, Kris Kennaway <kris at obsecurity.org> wrote:
> 
>>On Fri, Feb 10, 2006 at 12:51:18PM -0500, James Tanis wrote:
>>
>>>Tar will work, but not a drive formatted on an i386 with a tar file on
>>>it.
>>
>>Not if you store the tar file in a UFS filesystem on the drive, but I
>>suggested writing it to the raw disk where it is just a stream of bits
>>and therefore endian-neutral.
>>
> 
> 
> That would imply that endianness is a function of the OS/filesystem
> rather than the architecture, which is wrong. If you don't take my
> word for it, a quick google will find you,
> (http://developers.sun.com/solaris/articles/support_for_x86.html)..
> "File systems are neutral to endianness in general, and swapping files
> between Solaris SPARC and x86 is not an issue. But applications
> storing raw data that can be shared between platforms would be an
> issue. For example, if an application on the Solaris SPARC platform
> writes the data structures in a raw format to the files, then the data
> stored in these files would be endian-dependent."
> 
> 

You are quoting a feature of Solaris UFS, not a fundamental invariant of
all filesystems.  Filesystems do store 16, 32, and 64 bit metadata
quantities, and it's up to the reader/writer implementation on how to
interpret them.  You either need to decide that the on-disk metadata
will always be either big or little endian, and leave it up to the
implementation to do the appropriate byte swapping (similar to the
network protocols that are big-endian by definition), or you have to
provide some way for the filesystem to indicate which endian format it
is in and let the OS adapt accordingly.  I don't know about Solaris, but
I do know that NetBSD implements a form of the latter.  FreeBSD does
not; UFS metadata is written in the endian format of the host, and
no mechanisms for provided to allow detection and conversion of this.
It would be a nice feature to adopt from NetBSD at some point.

Scott


More information about the freebsd-sparc64 mailing list