Other How to format 32MB DOS MBR partition

newfs_msdos -F32 /dev/da0s2

newfs_msdos: 8172 clusters too few clusters for FAT32, need 65525

This is on a 32MB partition. I guess I need to set the cluster size to something appropriate, but what?
 
First answer: Do it on a windows machine. Native tools usually work better.

Second answer: Have you tried to learn about what you're trying to do? Like read the documentation?

If you insist on using non-native (i.e., FreeBSD) tools: Let's start by trying some simple math. The error message says very clearly: you need 65525 clusters, but the 32 MB partition only has room for 8172. From this I can calculate that at the current cluster size, the minimum size required to create a FAT32 file is a little over 256 MB. A really quick web search finds documentation from the horse's mouth: The minimum size required to create a FAT32 file system is 512 MB.

Doctor, it hurts when I do this. Well, then stop doing it.
 
From my recent experience, minimal supported size on a disk with 512b sectors is around 32MB. For 4K sectors the minimum is around 256MB.
 
yes you need partition with size of ~33MB for Fat32 with 512bytes per cluster

# gpart add -t fat32 -s 32M da1
da1s1 added
# newfs_msdos -F 32 -c 1 /dev/da1s1
newfs_msdos: 64496 clusters too few clusters for FAT32, need 65525
---
# gpart delete -i 1 da1
da1s1 deleted
# gpart add -t fat32 -s 33M da1
da1s1 added
# newfs_msdos -F 32 -c 1 /dev/da1s1
/dev/da1s1: 66512 sectors in 66512 FAT32 clusters (512 bytes/cluster)
BytesPerSec=512 SecPerClust=1 ResSectors=32 FATs=2 Media=0xf0 SecPerTrack=32 Heads=64 HiddenSecs=0 HugeSectors=67584 FATsecs=520 RootCluster=2 FSInfo=1 Backup=2

 
newfs_msdos -F32 /dev/da0s2

newfs_msdos: 8172 clusters too few clusters for FAT32, need 65525
This is on a 32MB partition. I guess I need to set the cluster size to something appropriate, but what?

When you added the partition, presumably with
# gpart add -t $type ...
, was type=fat32 or fat32lba ?

I suspect it was fat32, which is limited to 32GiB partition size, and that VladiBG who specified '-t fat32 -s 33M' would have forced it into fat32lba mode for >32GiB.

If I'm wrong you can check with gpart show -p da0 where fat32 shows as type !11 & fat32lba as !12.

I always use fat32lba, keeping FreeBSD and Android (via OTG) happy, maybe Windows too.
 
Back
Top