Finder showing wrong sizes through statfs

165 views
Skip to first unread message

Roberto Carlos Fernandez Gerhardt

unread,
Apr 3, 2016, 4:37:54 PM4/3/16
to OSXFUSE
Hi!

I'm new to FUSE development, so I'd like to ask you a few questions.

I made a filesystem to be able to extract files from old floppy image files. That is working well, but then I decided to add the statfs operation which seems to show the right values on linux, but not OSX.

For a 180KB disk image the values I return are the following:

f_bsize  = 256; // Sector size
f_frsize  = 256;
f_blocks = 40 * 1 * 18; // 40 tracks, 1 side, 18 sectors per track, 256 byte sector size. 180KB

Sometimes I get 360KB, or 10,9MB...

One thing I've noticed is that I can make it shoe 180KB by dividing f_blocks times 2, but if I do make the sector size the half, it won't affect the size shown.

Am I doing something wrong here (most probably) or is it another kind of problem?

Thank you for your help!

arritje nof

unread,
Apr 5, 2016, 7:02:48 AM4/5/16
to OSXFUSE
Although i assume that the dimensions of a floppy-disk image will not cause the overflow problems that i had, but perhaps there's still some valuable information in the topic i started:


In my case, a 32bit variable involved in calculating capacity, used and free overflowed, resulting in bogus values being reported. I was experiencing this problem when working with a storage-cluster of ~ 60PB.

Roberto Carlos Fernandez Gerhardt

unread,
Apr 8, 2016, 7:02:53 AM4/8/16
to OSXFUSE
Hi!

After reading the thread, I think that the system is using a value of bsize of 512 and really doesn't care that my filesystem is returning a different value through statfs.

As I mentioned, changing bsize doesn't change the value shown by finder, only the number of blocks.

Not that there's a huge problem for me, but I guess that if you are queried the block size is because it's going to be used on the size calculation.

Would that be a FUSE problem? OSX? Should I report this somewhere?

Thank you very much! 

Roberto Carlos Fernandez Gerhardt

unread,
Apr 8, 2016, 4:36:00 PM4/8/16
to OSXFUSE
Reading through the mount options wiki page, this has come to my attention:

iosize
iosize=N, where N is the I/O size in bytes.
You can use this option to specify the I/O size osxfuse should use while accessing the hypothetical storage device corresponding to a osxfuse volume. The minimum possible I/O size is 512 bytes, whereas the largest is 1MB. The size must also be a power of 2.

What's the reason behind the 512 byte minimum IO size? 

If this is indeed the problem I'm having, I could halve the number of block in the filesystem but I would prefer not to do such a dirty hack.

Cheers,
Rob

Roberto Carlos Fernandez Gerhardt

unread,
Apr 10, 2016, 6:21:37 PM4/10/16
to OSXFUSE
Hi!

I compiled the latest version (3.2.0) with "#define FUSE_MIN_BLOCKSIZE 256", but failed to make it start, so I downloaded the official 3.2.0 and managed to get the right values shown in Finder by halving the block numbers in the statfs structure.

Even though it works, it's a dirty hack. So, I'd like to ask if there's any reason for the 512 byte lower limit, or could it be safely lowered to 256 bytes.

Cheers,
Rob


On Sunday, April 3, 2016 at 10:37:54 PM UTC+2, Roberto Carlos Fernandez Gerhardt wrote:

Sam Moffatt

unread,
Apr 10, 2016, 8:36:54 PM4/10/16
to osxfus...@googlegroups.com
My gut feel is that the 512 byte lower limit is an Apple limitation because it’s their definition of a sector in line with the legacy HDD sector size. I’m not sure you could get around that safely if that’s the case.

--
You received this message because you are subscribed to the Google Groups "OSXFUSE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osxfuse-grou...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Benjamin Fleischer

unread,
May 12, 2016, 2:26:08 AM5/12/16
to osxfus...@googlegroups.com
Hi,

I’ve spent some time looking into this matter. The 512 bytes lower block size limit stems from the old MacFUSE days but does not seem to be an Apple limitation. I was able to lower the minimum block size to 128 bytes, which should be sufficient even for floppy images. At the same time I increased the maximum block size from MAXPHYS (= 128 KiB) to MAXBSIZE (= 1MiB). MAXBSIZE seems to be the maximum block size supported by OS X. These changes will be in the next osxfuse release.

Regards,
Benjamin
Reply all
Reply to author
Forward
0 new messages