lkml.org 
[lkml]   [1999]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: UFS/Disklabel strangeness
On Tue, Feb 23, 1999 at 04:23:34PM +1030, Jonathan Woithe wrote:
> The jaz disk in question had been formatted under FreeBSD using
> disklabel -rwB sd0 auto
> newfs sd0c
Unless the FreeBSD bunch changed something recently, this is incorrect
usage. Specifically, lower partition numbers have very special
purposes. a is boot, b is swap, c is the whole disk, and d the reserved
FreeBSD portion (or c <-> d, possibly, as OpenBSD has done away with d).

`fdisk' gives you information about the physical disposition of the disk.
> In addition, subsequent disklabel commands under FreeBSD give
> %/sbin/disklabel /dev/sd0
[...]
> 3 partitions:
> # size offset fstype [fsize bsize bps/cpg]
> c: 2091050 0 unused 0 0 # (Cyl. 0 -1021*)

Notice that c is correctly marked as `unused' there... It is not expected
that you use it directly. It is just the disk marker for FreeBSD to proceed.

You should use disklabel to add a proper partition within c.

> and this is what is visible to Linux's disklabel/partitioning code.
> Therefore detection of the FreeBSD filesystem fails on 2 counts:
> 1) the disklabel "partition" used by newfs is marked as not in use
From the man page:
`newfs builds a file system on the specified special device, basing its
defaults on the information in the disk label'. So, newfs won't change
disklabel information. In the present case, it looks like it's giving
you too much rope to hang you, and that it should at least warn that
the partition you're formatting is `unused'.
> 2) the linux code in check_and_add_bsd_partition() detects an apparent
> overlap of partitions (between the BSD partition and those defined in
> the disklabel) and exits without doing anything
That's perfectly natural, as you're trying to use a whole disk as a
partition. It's acting as it's supposed to do.
> If the kernel is hacked to ignore these 2 issues, the resulting partition
> (on /dev/sda5) mounts as ufs and is quite usable.
... which does not mean it is correct...
Please do check your official FreeBSD documentation. I might be wrong and
there might be evidence that what you say is correct on that system.
In such a case, we may wish to pass the partition type around to disable
partition checking for FreeBSD, but I can assure you that your ufs partition
usage looks quite bogus to me.

> (1) is not too hard to circumvent - a few lines of (non-kernel) source code
> can fix that. (2) is a problem through. Looking through the code, the
> overlap test will cause nothing to be done if a disklabel partition is equal
> to a partition-table partition in addition to the overlap trouble already
> mentioned so simply resetting the partition table to include the whole disk
> won't help. Therefore I'm not sure what exactly to do here
> - is the kernel at fault and if so, how can the code be rewritten
> consistantly? The type of the partition isn't visible to
> check_and_add_bsd_partition(); is it safe to ignore such overlaps?
> - if BSD is at fault, how can the disk be set up to allow Linux to read it?
Write a correct partition table in the first place. Linux is noticing that
something is VERY amiss, which is good. Where partitions are concerned,
it is much better to be a little bit conservative than mount a disk any
which way and overwrite sensitive information.

> A related fault is that this jaz disk's disklabel can't be read under Linux
> fdisk since
> Partition /dev/sda4 has invalid starting sector 0
> according to fdisk. It could be argued though that this is a result of
> the bogus fdisk partition entry so i'm not all that fussed about it.
This is quite another problem, ask the Linux fdisk maintainer
--
Marc Espie
|anime, sf, juggling, unicycle, acrobatics, comics...
|AmigaOS, OpenBSD, C++, perl, Icon, PostScript...
| `real programmers don't die, they just get out of beta'

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:50    [W:0.040 / U:0.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site