EFBIG
Linux / POSIXERRORCommonFile SystemHIGH confidence

File Too Large

Production Risk

Common in logging and backup pipelines — log rotation or size monitoring should prevent unbounded growth.

What this means

EFBIG (errno 27) is returned when a write would cause a file to exceed the maximum file size allowed by the filesystem, the OS, or the process's resource limit (RLIMIT_FSIZE).

Why it happens
  1. 1Writing to a file on a FAT32 filesystem that would exceed the 4 GB file size limit
  2. 2The process has a per-process file size limit (ulimit -f) set too low
  3. 3An append-only log file has grown beyond the filesystem's maximum file size
How to reproduce

Writing to a FAT32-formatted drive beyond 4 GB.

trigger — this will error
trigger — this will error
# Writing a file larger than FAT32 limit:
dd if=/dev/zero of=/mnt/fat32drive/bigfile bs=1M count=4097
# dd: error writing '/mnt/fat32drive/bigfile': File too large

expected output

write: File too large (EFBIG)

Fix 1

Use a filesystem that supports large files

WHEN When working with files larger than 4 GB

Use a filesystem that supports large files
# Format with ext4 or XFS instead of FAT32:
mkfs.ext4 /dev/sdX1
# ext4 supports files up to 16 TB

Why this works

FAT32 has a hard 4 GB per-file limit. ext4, XFS, and NTFS all support much larger files.

Fix 2

Increase or remove the process file size limit

WHEN When ulimit -f is set too low

Increase or remove the process file size limit
# Check current limit:
ulimit -f
# Remove limit:
ulimit -f unlimited

Why this works

RLIMIT_FSIZE is a per-process limit on file size. Raising it allows the process to write larger files.

Sources
Official documentation ↗

Linux Programmer Manual write(2)

getrlimit(2)

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Linux / POSIX errors