Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#14539 closed bug (fixed)

Unable to mount UEFI partition on r1/beta1

Reported by: kallisti5 Owned by: nobody
Priority: normal Milestone: R1/beta2
Component: File Systems/FAT Version: R1/beta1
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

It would be nice to obtain the haiku_loader.efi from the uefi partition in the hrev1/beta1 anyboot image... however when you attempt to mount it in Haiku, you get a general system error.

Mounting on the command line shows the real issue:

mount: Partition is too small to contain filesystem

The UEFI partition is 2MiB since our loader is < 500KiB

Change History (10)

comment:1 by axeld, 6 years ago

I don't understand why anyone should complain if there is a valid file system on the partition. Strange idea. FAT also worked on those rather small disks a couple of decades ago, anyway.

Looking at the sources, the only place where this happens is: http://xref.plausible.coop/source/xref/haiku/src/add-ons/kernel/file_systems/fat/dosfs.c#599

However, this suggests that the file system actually is malformed.

comment:2 by axeld, 6 years ago

Looking in some FAT specification (), the situation seems to be different:

"Check your assumptions about the value in the BPB_TotSec16/32 field. Assume we have a disk or partition of size in sectors DskSz. If the BPB TotSec field (either BPB_TotSec16 or BPB_TotSec32 — whichever is non-zero) is less than or equal to DskSz, there is nothing whatsoever wrong with the FAT volume. In fact, it is not at all unusual to have a BPB_TotSec16/32 value that is slightly smaller than DskSz. It is also perfectly OK for the BPB_TotSec16/32 value to be considerably smaller than DskSz.

All this means is that disk space is being wasted."

IOW it seems that this check is incorrect, and should be the other way around (the count must not be larger than the disk).

comment:3 by axeld, 6 years ago

Damn, no, the code actually does the right thing, the volume really seems to be invalid.

comment:4 by kallisti5, 6 years ago

Is it purely a size issue? I know the FAT32 specification states partitions must be a minimum of 32MiB.

Per Wikipedia:

FAT16B
  Min. volume size
    8 MiB (with 128 byte sectors)
    32 MiB (with 512 byte sectors)
    256 MiB (with 4 KiB sectors)

FAT32
  Min. volume size
    32 MiB-4.5 KiB (with 65525 clusters and 512 byte sectors)
    256 MiB-36 KiB (with 65525 clusters and 4 KiB sectors)

I'm using mtools to form it, and UEFI + linux identifies it as a valid partition though.

https://git.haiku-os.org/haiku/tree/3rdparty/kallisti5/greasy_uefi.sh?h=r1beta1#n56

comment:5 by kallisti5, 6 years ago

Linux FSCK seems to agree it's too small.. otherwise it mounts without error:

  sudo fsck /dev/sda2 
  fsck from util-linux 2.32.1
  fsck.fat 4.1 (2017-01-24)
  Seek to 65801728:Invalid argument

So, i bet changing to FAT16 and changing the partition to 8 MiB would solve it.

This alone doesn't seem to be worth an r1beta1 rc2. Maybe i'll just stick the efi loader in the release directory for now.

comment:6 by axeld, 6 years ago

We could just mount it read-only in such a case. How do you create the partition, anyway? And, as I said: FAT16 has been used on 360 KiB disks. There is no way it can have an actual 8 MiB limit anywhere.

in reply to:  6 comment:7 by kallisti5, 6 years ago

Replying to axeld:

We could just mount it read-only in such a case.

Indeed. I tried read/write + read only, both mounts generate the same error.

How do you create the partition, anyway?

We generate the EFI filesystem here:

https://git.haiku-os.org/haiku/tree/3rdparty/kallisti5/greasy_uefi.sh?h=r1beta1#n56

I added code to the anyboot tool some time ago to create a new partition "the size of the passed EFI filesystem"

https://git.haiku-os.org/haiku/tree/src/tools/anyboot/anyboot.cpp#n52

And, as I said: FAT16 has been used on 360 KiB disks. There is no way it can have an actual 8 MiB limit anywhere.

Per wikipedia (which is never wrong) FAT16B has a minimum of 8MiB. FAT16 has no documented minimum :-)

comment:8 by waddlesplash, 6 years ago

Milestone: R1/beta1Unscheduled

comment:9 by waddlesplash, 6 years ago

Resolution: fixed
Status: newclosed

Fixed in hrev52390.

comment:10 by nielx, 4 years ago

Milestone: UnscheduledR1/beta2

Assign tickets with status=closed and resolution=fixed within the R1/beta2 development window to the R1/beta2 Milestone

Note: See TracTickets for help on using tickets.