Opened 5 years ago
Last modified 4 years ago
#16113 new bug
Mounting bfs via fuse not working
Reported by: | Alexco | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | Unscheduled |
Component: | File Systems | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
On my FreeBSD12.1 setup I downloaded the latest haiku sources and build the bfs_fuse module. When I try to mount my bfs partition (only bfs partition on this machine, and haiku beta2 boots up from there without issues), I get the following error:
bfs_fuse /dev/ada0p8 ~/haiku bfs: Disk size (138976911360 bytes) < file system size (138977214464 bytes)! bfs: Mount:207: Invalid argument bfs: bfs_mount:184: Invalid argument Error: Mounting FS failed: Invalid argument
But my partition is fine (output of gpart list):
Name: ada0p8 Mediasize: 138977214464 (129G) Sectorsize: 512 Stripesize: 4096 Stripeoffset: 0 Mode: r0w0e0 efimedia: HD(8,GPT,345c2ac9-ac6e-a24d-ae52-7f53eb4aab7b,0x27b65800,0x102dd800) rawuuid: 345c2ac9-ac6e-a24d-ae52-7f53eb4aab7b rawtype: 42465331-3ba3-10f1-802a-4861696b7521 label: Haiku length: 138977214464 offset: 341125890048 type: !42465331-3ba3-10f1-802a-4861696b7521 index: 8 end: 937701375 start: 666261504
So where is the difference of 592 blocks/303104 bytes coming from? I must admit that I didn't understand the code at all...
Change History (3)
comment:1 by , 5 years ago
Component: | - General → File Systems |
---|
comment:2 by , 4 years ago
comment:3 by , 4 years ago
Sorry, I already wrote that here https://discuss.haiku-os.org/t/compiling-bfs-for-fuse/9566. The C/H/S conversion does not work correctly, since a sector number of 63 is returned, which results in rounding errors. I still wonder why we need to do stupid CHS conversions and just can't forward the media size. Is Haiku internally still using CHS? By the way, I used a similar fake geometry for FreeBSD as used for Linux and this works, but I was too lazy to prepare a patch so far...
From what I see, file system size comes from the fs superblock, and given gpart output it seems correct. Disk size would come from the GET_GEOMETRY ioctl which, if I'm right, would be managed in unistd.cpp, and that hasn't changed recently for FreeBSD. It uses some ioctls to get cylinders, sectors per track, etc. And indeed the value fits nicely in a CHS scheme: 138976911360 = 512 * 63 * 16 * 269285, but it's not the real value. As found in FreeBSD's disk.h for two of those ioctl:
It seems for Linux a fake geometry is first tried from just the total size if available. Can't a similar thing be done for FreeBSD from DIOCGMEDIASIZE?
Given diver's comment in #16171 and the code, darwin is also affected. It uses size, but tries a more typical CHS configuration than in Linux when BLKGETSIZE64 works.