If partition is smaller than 32MB, mount_msdos(8) will yield "not an MSDOS
filesystem".

pmp->pm_Sectors is set by newfs_msdos(8) when the number of sectors is less
than MAXU16 even if asked to format in FAT32.

I choosed to fix mounting instead of formatting (newfs_msdos.c frightens me...)

FreeBSD fixed this in 2013.

Index: msdosfs_vfsops.c
===================================================================
RCS file: /cvs/src/sys/msdosfs/msdosfs_vfsops.c,v
retrieving revision 1.94
diff -u -p -r1.94 msdosfs_vfsops.c
--- msdosfs_vfsops.c    10 Aug 2020 05:18:46 -0000      1.94
+++ msdosfs_vfsops.c    22 Apr 2021 19:35:40 -0000
@@ -334,8 +334,7 @@ msdosfs_mountfs(struct vnode *devvp, str
        }
 
        if (pmp->pm_RootDirEnts == 0) {
-               if (pmp->pm_Sectors || pmp->pm_FATsecs ||
-                   getushort(b710->bpbFSVers)) {
+               if (pmp->pm_FATsecs || getushort(b710->bpbFSVers)) {
                        error = EINVAL;
                        goto error_exit;
                }

Reply via email to