Re: FAT32 support on freebsd
- Reply: Andreas Hecht : "Re: FAT32 support on freebsd"
- In reply to: Andreas Hecht : "FAT32 support on freebsd"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 20 Oct 2024 18:57:13 UTC
Am 20.10.24 um 20:07 schrieb Andreas Hecht: > My FAT32 formatted portable SSD "Western Digital My Passport 25F3" does not > seem to be supported by FreeBSD. Mounting the drive works fine but I can not > access the data stored within it: > > # mount -t msdosfs /dev/da0s1 /mnt > # cd /mnt > # ls -al > total 0 > > The 'ls -al' above should show a folder named 'data' stored in the > top level diretory of the drive. The folder does not show up but during > execution of 'ls -al' the following kernel message appears: > > getblkx: maxsize(66560) > maxbcachebuf(65536) > > I found that this particular drive uses 128 sectors per cluster. This > multiplied with 512 bytes per sector results in 65536 bytes per sector > which per FAT specification seems to be too much: > (https://www.cs.fsu.edu/~cop4610t/assignments/project3/spec/fatspec.pdf) > "Note however, that a value should never be used that results in a “bytes per > cluster” value (BPB_BytsPerSec * BPB_SecPerClus) greater than 32K (32 * 1024). > There is a misconception that values greater than this are OK." > > What makes me wonder is that the same drive works fine with Debian 12 and > NetBSD 10. Is FreeBSD supposed to support this drive? Shall I send a problem > report? Without knowing the exact details of your FAT32 partition, I do assume that the clusters are not aligned to a 4 KB boundary. The MSDOSFS in FreeBSD maps sectors of the FAT32 partition to pages in such a way that the first sector of a cluster may be in the middle of a VM page. That leads to cluster of 128 * 512 Bytes to require 17 instead of 16 pages in the buffer cache. The newfs_msdos command in FreeBSD has been modified to adjust the first sector in each data cluster to a multiple of the page size, which avoids this issue. You can mount your FAT32 file system if you add the following to your loader configuration file /boot/loader.conf: vfs.maxbcachebuf=131072 In fact, setting this value to 69632 (17 * 4096) should suffice ... I plan to remove this limit from FAT32, but setting vfs.maxbcachebuf should allow you to work with that drive. Beste Grüße, STefan