Subject: Re: Disklabel and non 512-byte media
To: Steve Woodford <>
From: Reinoud Zandijk <>
List: tech-kern
Date: 10/16/2006 13:30:54
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Dear folks,

On Fri, Oct 13, 2006 at 11:05:44PM +0100, Steve Woodford wrote:
> I've noticed an interesting oddity with disklabels on media with 
> physical sector size != DEV_BSIZE. Here's one I prepared earlier based 
> on a Samsung YP-U2 USB MP3 player:
> sd0 at scsibus0 target 0 lun 0: <Samsung, YP-U2, 0100> disk removable
> sd0: fabricating a geometry
> sd0: 999 MB, 249 cyl, 64 head, 32 sec, 2048 bytes/sect x 511616 sectors
> # disklabel sd0
> ...
> bytes/sector: 2048
> ...
> 5 partitions:
> #        size  offset   fstype [fsize bsize cpg/sgs]
>  d:   2046464       0   unused      0     0        # (Cyl. 0 - 999+)
>  e:    511560      56    MSDOS                     # (Cyl. 0*- 249*)

I've encountered the same problem with UDF and CD's. The disclabel's sector 
size is 2048 but the drive's disklabels are to be specified in 
DEV_BLKSIZE or it will go wrong.

The main curlpits are the disk partition range checking functions (check 
with label etc.) in the device drivers. They ought to honour the 
sectorsize. I've patched them once but for some reason i can't remember 
they never got committed. Maybe the mail archives will tell us why.

As for msdosfs on USB sticks, i think you'd have to look at 
dev/scsipi/sd.c's default label generation.

With regards,

Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.4.2.1 (NetBSD)