Subject: Re: Accessing ext2fs from NetBSD/alpha?
To: None <port-alpha@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-alpha
Date: 05/24/1999 00:32:06
> I'm a new user of NetBSD, and so far have been quite impressed with
> it.

Welcome!

> The only problem I have is getting data from an ext2 partition on my
> alpha's secondary disk (sd1) after migrating from Debian Linux to
> NetBSD.  [...]

> Anyway, I'm curious if NetBSD/alpha can read PC-style partitions (the
> partition in question was made with Debian/alpha, by its fdisk).

I don't know this.  But I maybe can help a little....

Disclaimer: I've never tried NetBSD ext2fs support at all, much less on
an alpha.  But I have no reason to think it doesn't work.

It seems to be the biggest problem is finding the filesystem; since
mounting the whole-disk partition didn't work, it probably (as you
surmise) isn't starting at offset zero.

If I were faced with that problem and couldn't somehow get the disk and
Linux together on the same machine, what I'd probably do is this:

- Write a small program (based on the NetBSD ext2fs code) to check
   whether a given block could be an ext2fs superblock.  (Rudimentary
   checks like magic number and reasonable values for some superblock
   fields (eg, filesystem sizes larger than the disk are out).  If the
   ext2fs superblock has redundant fields (I know ffs does), check them
   for consistency.)

- Use this program to scan the disk and collect a list of blocks that
   might be superblocks.

- Figure out (again, based on the ext2fs support) what the offset is
   from the beginning of the partition to the superblock (eg, the
   analogous value for ffs would be 8K).

- Try partitioning the disk in the NetBSD way, placing the partition
   beginnings so as to put the various possibly-superblocks in the
   superblock position in the partition.

- Run fsck_ext2fs -n on each attempted partitioning to see if it's
   right.

I realize this may not be a whole lot of help, since it assumes a
nontrivial degree of programming knowledge and skill, and a readiness
to dive in and get your hands dirty with relatively complicated bits of
the system.  Unfortunately, I don't know of any ready-to-roll program
that does what you're after.  Also unfortunately, I don't have any
ext2fs filesystems around, or I might try it myself.  (How big is the
disk, and is what's on it sufficiently sensitive that you wouldn't want
to let a copy get out?  I'm considering dumping a dd image of the disk
on a NetBSD/alpha machine I have access to and trying more or less what
I've outlined above...but of course my doing that would require that
the disk be small enough for it to fit, and that you be willing to
trust me with a copy of the data.)

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B