NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: efi msdos puzzle



On Mon, Sep 09, 2019 at 05:53:03PM +0100, Patrick Welche wrote:
> On Mon, Sep 09, 2019 at 11:23:49AM -0500, Jonathan A. Kollasch wrote:
> > On Mon, Sep 09, 2019 at 04:58:01PM +0100, Patrick Welche wrote:
> > > gpt add -a 1024k -l efi0 -s 256M -t efi wd0   (on -current/amd64)
> > > 
> > > dk0: efi0, 524288 blocks at 2048, type: msdos
> > > 
> > > # newfs_msdos -F 32 -b 4096 /dev/rdk0
> > > newfs_msdos: 65404 clusters too few clusters for FAT32, need 65525
> > > 
> > > but 65525 * 8 = 524200 < 524288 ?
> > > 
> > > Where does 65404 come from?
> > > 
> > 
> > The FATs and various other FS internal data structures take space,
> > apparently to the tune of 132 clusters, or 1056 sectors, or 540672 bytes.
> > 
> > A 32-bit FAT for up to 65408 clusters is 511 sectors, FAT32 keeps a
> > duplicate copy of the fat, so you're up to 1022 sectors used already.
> > 
> > There's also the boot sector and it's backup, the file system
> > information block(s?), any reserved sectors, and I forget how
> > it worked on FAT32 (it's different than FAT16/12) but maybe also the
> > root directory entries.
> > 
> > The bit-width of the FAT is a function of the number of data clusters,
> > you'll just end up getting failures like this if you specify any more
> > than two of the partition/FS size, the cluster size, and the FAT width.
> > 
> > Microsoft was helpful enough to publish the FAT spec specifically for
> > use in the EFI context.
> 
> Thanks - I'll experiment to find the magic number!

gpt add -a 4k -l efi0 -s 525256 -t efi wd0

seems to be the minimum...


Cheers,

Patrick


Home | Main Index | Thread Index | Old Index