5

When formatting my EFI partition I get this error:

Not enough clusters for a 32 bit FAT!" 

My disk use 4096 sector size.

#mkfs.fat -v -F 32 -S 4096 /dev/sde1

mkfs.fat 4.1 (2017-01-24)
WARNING: Not enough clusters for a 32 bit FAT!
/dev/sde1 has 255 heads and 63 sectors per track,
hidden sectors 0x4000;
logical sector size is 4096,
using 0xf8 media descriptor, with 67584 sectors;
drive number 0x80;
filesystem has 2 32-bit FATs and 8 sectors per cluster.
FAT size is 16 sectors, and provides 8440 clusters.
There are 32 reserved sectors.
Volume ID is 05deb9f7, no volume label.

My disk partition:

gdisk -l /dev/sde
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
   MBR: protective
   BSD: not present
   APM: not present
   GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sde: 244190646 sectors, 931.5 GiB
Logical sector size: 4096 bytes
Disk identifier (GUID): D0BA102E-86C5-4379-B314-9534F873C377
Partition table holds up to 128 entries
First usable sector is 6, last usable sector is 244190640
Partitions will be aligned on 256-sector boundaries
Total free space is 244123051 sectors (931.3 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048           69631   264.0 MiB   0700  EFI_FAT32

fsck.fat give the following:

#fsck.fat -v /dev/sde1
fsck.fat 4.1 (2017-01-24)
Checking we can access the last sector of the filesystem
Warning: Filesystem is FAT32 according to fat_length and fat32_length fields,
  but has only 8440 clusters, less than the required minimum of 65525.
  This may lead to problems on some systems.
Boot sector contents:
System ID "mkfs.fat"
Media byte 0xf8 (hard disk)
      4096 bytes per logical sector
     32768 bytes per cluster
        32 reserved sectors
First FAT starts at byte 131072 (sector 32)
         2 FATs, 32 bit entries
     65536 bytes per FAT (= 16 sectors)
Root directory start at cluster 2 (arbitrary size)
Data area starts at byte 262144 (sector 64)
      8440 data clusters (276561920 bytes)
63 sectors/track, 255 heads
     16384 hidden sectors
     67584 sectors total
Checking for unused clusters.
Checking free cluster summary.
/dev/sde1: 1 files, 1/8440 clusters
BMWW
  • 133
  • 3
  • 9

1 Answers1

8

A FAT32 filesystem has a minimum size: it should contain at least 65525 clusters*. The cluster size is a multiple of the sector size. In your case the sector size is 4096 and mkfs.vfat has used a default multiple of 8 for the number of sectors per cluster. Use -s 1 to specify one sector per cluster:

mkfs.fat -v -F 32 -S 4096 -s 1 /dev/sde1

This results in a cluster size of 4096, which should be small enough to fit more than the minimum of 65525 clusters in your 264 MiB partition.


* From the Windows documentation on UEFI/GPT-based hard drive partitions:

For Advanced Format 4K Native drives (4-KB-per-sector) drives, the minimum size is 260 MB, due to a limitation of the FAT32 file format. The minimum partition size of FAT32 drives is calculated as sector size (4KB) x 65527 = 256 MB.

Advanced Format 512e drives are not affected by this limitation, because their emulated sector size is 512 bytes. 512 bytes x 65527 = 32 MB

Cristian Ciupitu
  • 2,430
  • 1
  • 22
  • 29
Johan Myréen
  • 12,862
  • 1
  • 32
  • 33
  • 2
    With FreeBSD it it is not `-s`, but `-c` as in `newfs_msdos -F32 -S 4096 -c 1 -L boot02 /dev/ada0p1`. – m4xcp Mar 27 '21 at 15:28