Subject: LABELSECTOR, LABELOFFSET:disklabel in different architectures
To: None <tech-kern@NetBSD.org>
From: anand lalgondar <anandlalgondar@hotmail.com>
List: tech-kern
Date: 11/05/2003 11:03:54
Hello,

Why do different architectures have different LABELSECTOR and LABELOFFSET 
values.
For example in i386 the values are:
--------------------------------------------------------------------------------------------------------------------
#define	LABELSECTOR	1	/* sector containing label */
#define	LABELOFFSET	0	/* offset of label in sector */
#define	MAXPARTITIONS	16	/* number of partitions */
#define	OLDMAXPARTITIONS 	8	/* number of partitions before 1.6 */
#define	RAW_PART	3	/* raw partition: XX?d (XXX) */
--------------------------------------------------------------------------------------------------------------------

where as in evbmips the values are:
--------------------------------------------------------------------------------------------------------------------
#define	LABELSECTOR	0	/* sector containing label */
#define	LABELOFFSET	64	/* offset of label in sector */
#define	MAXPARTITIONS	16	/* number of partitions */
#define	RAW_PART	2	/* raw partition: xx?c */
--------------------------------------------------------------------------------------------------------------------

Is it because different arhitectures have a standard to store the partition 
information at some standard location. Or is there any other reason.

We came across something weared while performing partitions in USB HDD.
We connected a USB HDD to i386 NetBSD1.6 machine. Since that was a new HDD 
the disklabel displayed "d" partition. As per disklabel, in NetBSD "d" 
represents the whole disk and "c" represents the NetBSD partition.  So We 
created 3 partitions "e" as MSDOS, "c" as unused for NetBSD and "a" as a 
4.2BSD present in the range of the unused.

Later the same USB HDD was connected to a evbmips Target Board ported with 
NetBSD1.6. The disklabel showed a "c" partition representing the whole disk. 
We could not get the information of the partition created in i386 machine. 
So to over come this we changed the LABELSECTOR and LABELOFFSET values of 
evbmips "disklabel.h" to that of i386. Then recompiled the kernel and loaded 
it to the evbmips Target Board. Now running the disklabel showed the 
paritions created intact and were able to access those partitions also.

Is there a work around in disklabel to overcome this. Can the disklabel have 
options to read the disklabel of a HDD from a specified sector and offset.
eg: disklabel sd0 sector=1 offset=0
The same thing should also be provided to mbrlabel since it is used to 
update the in-core disklabel.

And also a chart in the man page of disklabel should be specified as:
----------------------------------------------------------------------------------------
Architecture          LABELSECTOR                     LABELOFFSET
----------------------------------------------------------------------------------------
i386                              1                                       0
evbmips                         0                                      64
----------------------------------------------------------------------------------------

But the main point is how to find out on what architecture the partitions 
was created, since the disklabel will be stored in the LABELSECTOR and 
LABELOFFSET specified by that architecture.

Hope to get some information. Thanks anyways.

- Anand

_________________________________________________________________
Get head-hunted by 10,000 recruiters. http://go.msnserver.com/IN/35984.asp 
Post your CV on naukri.com today.