Bug 243178

Summary: newfs_msdos: wrong FAT type determination
Product: Base System Reporter: Xin LI <delphij>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Many People CC: emaste, nc
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Xin LI freebsd_committer freebsd_triage 2020-01-08 08:40:06 UTC
Creating a bug so this is not lost.

The automatic FAT type determination is broken.

Reproduction case:

$ truncate -s 2147483648 test
$ newfs_msdos ./test
newfs_msdos: warning, ./test is not a character device
newfs_msdos: 65519 clusters too few clusters for FAT32, need 65525
Comment 1 Neel Chauhan freebsd_committer freebsd_triage 2020-08-28 13:13:05 UTC
I believe the issue is the cluster detection mechanism (Line 334 to 351).

For instance, this works:

newfs_msdos -c 128 ./test
Comment 2 Neel Chauhan freebsd_committer freebsd_triage 2020-08-28 13:13:44 UTC
The lines are in sbin/newfs_msdos/mkfs_msdos.c