Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jun 2002 00:59:45 +0300
From:      Giorgos Keramidas <keramida@FreeBSD.ORG>
To:        "Greg 'groggy' Lehey" <grog@FreeBSD.ORG>
Cc:        Akthar Hussain <ahussain_fbsd@msn.com>, questions@FreeBSD.ORG
Subject:   Re: Mounting Freebsd part in Linux
Message-ID:  <20020611215945.GD45825@hades.hell.gr>
In-Reply-To: <20020611051421.GD3644@wantadilla.lemis.com>
References:  <DAV22cqJGzaBkNc2DIz000125f8@hotmail.com> <20020611051421.GD3644@wantadilla.lemis.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2002-06-11 14:44 +0930, Greg 'groggy' Lehey wrote:
> On Tuesday, 11 June 2002 at 10:29:03 +0530, Akthar Hussain wrote:
> > Hi,
> >
> > I had compiled new kernel in Linux to mount NTFS and UFS.Also able
> > to read BSD disk label.
> >
> > in kernel >>fileSYSTEM options I had selected ,create modules for
> > NTFS ,UFS,and read BSD disk label.
> >
> > if I boot my system with new kennel I can able to mount only ntfs
> > partitions.but if I try to mount my FreeBSD partitions it gives error
> > "unable to mount or invalid superbalck"
> >
> > also ufs and ntfs modules are available in
> > /lib/modules/..8.-cus/kernel/fs/.
> 
> > my partitions are
> >
> > hda1 = /boot (Linux)
> > hda2 or ad0s2 = freebsd
> > hda3 = / for Linux
> >
> > hdb1 = ntfs
> > hdb2 = ntfs
> >
> > they way i tried to mount freebsd is
> >
> > mount -t ufs /dev/hda2 /mnt
> >
> > or
> >
> > mount -t ufs -o ufstype=44bsd /dev/hda2 /mnt
> >
> > also some time it gives your kernel support only read only
> > options.but i tried with -r , no improvement.
> >
> > if any one can help me ?
> >
> > do i have to do any extra changes in my kernet to mount ufs (freebsd
> > partitions)
> >
> > is it my way of mounting is right ??
> >
> > my linux kernel is 2.4.18. redhat 7.3.
> 
> This appears to be a Linux problem.  It's possible that the Linux ufs
> implementation doesn't correctly recognize modern FreeBSD file
> systems.

One of the modern 2.4.x kernels that a friend was using, had a strange
`bug' that required patching the Linux kernel to solve.  It appears
that the Linux kernel uses a list of block & fragment sizes to check
against the values stored within the filesystem, and aborts the mount
if the block or fragment sizes of the filesystem can't be matched with
one of the ``valid sizes'' of its list.

When this is the case, then the Linux kernel prints a message to its
logs, similar to:

	> ufs_read_super: fs_bsize 16384 != {4096, 8192, 32768}
	> ufs_read_super: bad magic number

Recent FreeBSD releases autosize block & fragment sizes to values more
proper for the total partition size (I think the first time this
reached a -RELEASE of FreeBSD was with 4.5-RELEASE), and might end up
using a block size of 16384 or a block size larger than 32768 for some
partition sizes.  Since the resulting block size is not listed in the
valid block sizes of the Linux ufs support module code, all attempts
to mount the partition with Linux's ufs support will fail.

It is relatively easy to add a single line of C code in the file
/usr/src/linux/fs/ufs/super.c, near line 655 that checks for a valid
block size.  All it takes is an additional ``&& uspi->s_bsize != 16384''
and then the Linux kernel will accept 16384 as a valid block size too.

This is a relatively ugly hack to make the Linux kernel `just work',
but don't ask me how I managed to find this out, and why I do remember
it after a few months.  [ The original post, that triggered the
discussion of this in a Greek Linux users list, was sent in Feb 27. ]

If this is the case, I hope this helps to solve the problems :-)

- Giorgos


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020611215945.GD45825>