Subject: Re: mismatch between readdisklabel() and writedisklabel()
To: None <itojun@iijlab.net>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 06/19/2002 14:21:57
On Wed, 19 Jun 2002 itojun@iijlab.net wrote:

> 	while looking at making (part of) readdisklabel() and writedisklabel()
> 	MI, i've noticed the following:
> 	- readdisklabel() tries to search for disklabel starting from
> 	  LABELOFFSET byte within the sector, by checking magic number.
> 	  so it can end up reading disklabel from some place other than
> 	  LABELOFFSET.
> 	- in most cases, writedisklabel() is hardcoded to write disklabel back
> 	  to LABELOFFSET.
>
> 	therefore, writedisklabel() can write disklabel to location which is
> 	different from readdisklabel() have used.  is it intentional? (to
> 	force placement of disklabel at LABELOFFSET)  or a mistake where
> 	writedisklabel() should be corrected to follow the location found
> 	by readdisklabel()?

I think it was intentional, and I can see arguements for and against it.

For: it consolidates where the label is located. Against: it might stomp
on other data.

I think the best thing to do is move away from having the kernel write
disklabels. It should be able to update parition info (say when you make
it an LFS partition), but leave major re-writing to userland.

So I think it'd be fine to write the new label where the old one was.

Take care,

Bill